Infinite scrolling on the y-axis without using wrap

Cameron.WebbCameron.Webb Member Posts: 7
edited November -1 in Working with GS (Mac)
Hello,

I am wanting to create a game in which you are to weave in and out of on coming traffic.
The players car is constraint on the y-axis so obviously to create the illusion of motion the background has to move downwards so the car looks like it is moving forward.

However when I use wrap y all of the other actors are moving with the wrap even though they are on different layers and aren't scrollable.

Is there a rule I can use for the background so it has a fluid motion independent from the other actors?

Thanks

Comments

  • tvappstvapps Member, PRO Posts: 42
    One way to do it is to have your main character stationary and have the background move behind it. The other actors move relative to the main character. This is generally how the illusion of an infinite level is done.
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    have a rule when attribute self.position.y is less then or equal to zero
    -change attribute self.position.y to 480

    depending on the size of the actor you'll have to play around with the numbers a little, but that will make it when the actor reaches the bottom of the screen it will change to the top
  • Cameron.WebbCameron.Webb Member Posts: 7
    Hey guys,

    Thanks a lot for you comments and ideas!

    tvapps - thats what i am trying to achieve, I am not sure how to make the background loop for an infinite amount of time so it appears the main_player is moving (but having the player actor remaining stationary). I tried using wrap but when the other cars are randomly spawned they wrap back as well, so I don't particularly want to use that.

    JohnPapiomaitis - thanks for your comment also. But what I am wanting is to have the main character stationary but the background moving, could the background use the rule instead or was that what you were getting at?

    Thanks again
  • Cameron.WebbCameron.Webb Member Posts: 7
    never mind!

    Thanks JohnPapiomitis - I used your suggestion for the background and it works! Had to tweak the numbers as you said and it works perfectly!

    Thanks again to both!
    Cameron
  • sss90sss90 Member Posts: 2
    I'm trying to do the same thing but I get a gap. Cameron.Webb what numbers did you use?
  • HoneyTribeStudiosHoneyTribeStudios Member Posts: 1,792
    Also, if your background is one screen (and full alpha), so 320x480 on iphone, you can have one actor and use replicate in both directions.
    ___________
    www.HoneyTribeStudios.com
Sign In or Register to comment.