Scrolling ("endless") Background

iPhoneDevForMeiPhoneDevForMe Member Posts: 362
edited November -1 in Working with GS (Mac)
I have posted a demo showing how to create a "endless" scrolling background. This is the exact same method as found on RH's demo, only I have adjusted it so that it is the iPhone screen size.

When you preview it in GameSalad, it works exactly as it should; however, when you preview on a device, it stops working.

http://gamesalad.com/game/play/60407

Anyone care to take a look and test if this is a problem on your device as well? Thanks!

-Kyle

Comments

  • JCFordJCFord Member Posts: 785
    Hi I had a quick look at your project and there is a judder so the scrolling is not smooth, on looking I see you are Spawning the background this is NOT a good idea as it uses up a lot of CPU and will cause you alot of frames to be dropped once you add on other graphics etc.

    You have the right idea but do not SPAWN, instead have two backgrounds following each other side-by-side and as soon as one if off screen use a change attribute to move it back to the other side of the screen so they are swapping over each other.

    MOVE direction 180
    WHEN self.position.X <-240 then
    Change atribute self.position.X to self.position.X +720

    You wil have to play with the numbers depending on your size graphics etc.

    Good luck
    JCFord
  • RHRH Member Posts: 1,079
    Yeh, I was going to change that in mine but never did because i was too lazy :P

    But i think that if you do that (the moving actors) you will need to do it with three rather than two.
  • iPhoneDevForMeiPhoneDevForMe Member Posts: 362
    Great, ill check it out and see if I can make it work. That is a MUCH better idea! I will upload a new demo using that method when it is complete! I've gotta drill it into my head "AVOID spawing when possible!"

    Thanks man!
  • JCFordJCFord Member Posts: 785
    You only need 2 images both screen size so, you always have one on screen whie the other switches to the back I did it here:
    http://gamesalad.com/game/play/33976

    JCFord
  • JCFordJCFord Member Posts: 785
    Also have a look at Wayne's Demo here:
    http://gamesalad.com/game/play/52419
  • AfterBurnettAfterBurnett Member Posts: 3,474
    Thanks, that helped heaps! I too was using spawn... though for some reason, this method is giving me some stuttering... every now and then.
  • RHRH Member Posts: 1,079
    Yeh, you're right :P
  • ZillaZilla Member Posts: 157
    Check out my free game that uses an endless scrolling background:

    http://itunes.com/apps/freeeastereggandspoonrace
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    I would like to do this in a scene that is much wider than the iphone screen. any ideas that are not processor intensive (ie no spawning, minimal constraining).
  • AfterBurnettAfterBurnett Member Posts: 3,474
    Yes, make the game for iPad :-D
  • RHRH Member Posts: 1,079
    I haven't tried it but it might be possible to do it with just one actor if you make it twice the size of the image and wrap the horizontal graphics. Slightly changing the movement rules.

    I have no idea whether this would be better or not.
  • AfterBurnettAfterBurnett Member Posts: 3,474
    Hey, that's a point... would wrapping the X axis adjust the size of the scene if the graphic is bigger than the screen width or would it just shrink or cut the bigger graphic? Interesting...
Sign In or Register to comment.