Trying to make a looping background

GamepencilerGamepenciler Artist/Game DeveloperMember, PRO Posts: 326
Hi I seem to encounter a problem, not sure if i did wrong but I try to do a looping background in ipad size
Actor size is 1024x250
then I have this attribute:
If self.position.x = -512, change attribute self.position.x = 1536

It suppose to reposition at 1536 but it isn't, I think gamesalad cannot reach that value because I tried values inside the display size. Does anyboy have a suggestion?

Best Answer

  • HoneyTribeStudiosHoneyTribeStudios Posts: 1,792
    Accepted Answer
    You can change an actor to whatever position you want as long as it no more than 500 px beyond your scene size.

Answers

  • HoneyTribeStudiosHoneyTribeStudios Member Posts: 1,792
    edited October 2013
    You have the right idea, and GS can do this kind of looping background easily.

    Try:

    When position.x is less than or equal to -512 change position to...(whatever you want)

    If you are using the move, accelerate, change velocity or self.motion.linear.x behaviors then you will never have exact positions. That's why you use 'less than or equal to'.
  • GamepencilerGamepenciler Artist/Game Developer Member, PRO Posts: 326
    i used lesser equals to nothing is happening
  • GamepencilerGamepenciler Artist/Game Developer Member, PRO Posts: 326
    Anyway here is my file that i'm trying to do if you guys can check it out..
  • HoneyTribeStudiosHoneyTribeStudios Member Posts: 1,792
    If you use display text and you can display relevant attributes such as position.x while you test the game. You will then be able to know what is happening. That might inform you or what you need to change to make it work.

    Also make sure your scene is big enough. An actor off the scene by more than 500 px is automatically destroyed.
  • GamepencilerGamepenciler Artist/Game Developer Member, PRO Posts: 326
    Yeah that might be the cause,because i'm trying to put it at -512 and respawn it at 1536
  • GamepencilerGamepenciler Artist/Game Developer Member, PRO Posts: 326
    That actually works thanks @HoneyTribeStudios
  • HoneyTribeStudiosHoneyTribeStudios Member Posts: 1,792
    I looked at your file. The actors are automatically being destroyed because they are off scene by more then 500 px. i.e -512.

    So just make your scene bigger and move the camera position.

    The game will not be played at camera.origin.x of 0.

    Instead move the camera origin along by how ever much you want. And this becomes your new play area.
  • GamepencilerGamepenciler Artist/Game Developer Member, PRO Posts: 326
    Oh i see i'll try that
  • BBEnkBBEnk Member Posts: 1,764
    You could also change your image size to 2048 px then change to tile 1024 and when image is =< then 0 setback to 1024..

    heres your file with the changes.

    https://dl.dropboxusercontent.com/u/58782733/loopingBG.zip
Sign In or Register to comment.