Best Way to Do an Endless Side Scroller
JackSoft
Member Posts: 27
I'm just trying to understand the best way to do this. Right now I'm trying to set it up with a scrolling background and an actor the stays on the left side of the screen. But, im having problems with the scrolling background. My scene size is 480 x 320. To start, Im using 2 instances of the background actor, one on screen, one directly off the right side. I have the background actors linear velocity X set to -150, so that it moves from right to left. When the background is completely off screen(self.positionX = -240), I use change attribute self.positionX to 720. The background does loop but I get gaps each time it loops. These gaps vary in width, sometimes no gap, sometimes very little, sometimes larger.
So, is that the best way to setup an endless sidescroller? I have reach the point of spawning actors yet but I plan to recycle them rather than constantly spawn new actors. Not sure how that will work yet.
So, is that the best way to setup an endless sidescroller? I have reach the point of spawning actors yet but I plan to recycle them rather than constantly spawn new actors. Not sure how that will work yet.
Answers
Check this out: http://ezinterweb.com/gamesalad/platform-spawner
I'm currently making my third side scoller game for iOS. Take it from me, using the above method will save you from the agony of puling your hair out strand by strand.
Thanks for the reply. I actually have that example already and its really interesting. So are you saying that the best method is to setup static actors throughout the scene? Static backgrounds as well?
You can easily make smaller backgrounds scroll together and remain joined without gaps.
Now I'm working on recycling actors for pickups and enemies/obstacles. Actually, right now I'm stuck on how best to destroy/hide bullets/weapons without them wrapping around.
My scene is 480px wide. My bullets are 10px wide. So my thought was to destroy/hide the bullet when it reaches X = 475px. That works. But when I go wild and loose 5 or 6 bullets, 1 or 2 break through that rule somehow and wrap around. Then eventually, at random, will destroy the next time or maybe the 2nd or 3rd time they wrap around. Weird. Any ideas?
Change your x = 475 to x >= 475. This should catch any that misfire at 475.
If that still doesn't work add a timer to the bullet to automatically destroy after x amount of time
Base this on the biggest distance your bullet can possibly travel.
Or don't worry about calculations and make the wall 100 or 200px wide.
Put the wall outside of the scene though, unless of course wrap wraps the moment it goes off screen, in which case ignore everything I've said
Heres a quick vid of it in action.
Nightmare Run also resets the hero if you don't collect all the lanterns to wake up from the Nightmare.
You could also keep the hero still and move the platforms like my other one.
Or do it like Eric suggested so theres 3 options.
Darren.
@DeepBlueApps Your Jet Pack is great. I actually purchased the Tap Tap Runner template from you earlier and instantly learned a great deal about what I need to do. Thats where the scene wrapping idea came from. So I'm simply wrapping a 480px scene and plan to change backgrounds based on time. Actually, I'm getting ready to load Tap Tap back up and look into how you were spawning pickups and enemies(mushrooms i think it was.) Great templating btw! I just looked at Platform Engine V3 and that's very cool. Also downloaded bumps on my iphone today. Though i cant seem to locate your jetpack template now?
EDIT. Got it.
Thanks for buying Bumps i hope you enjoy it.
Darren.
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
Do you have a process when designing your logic? I know you mention spending the extra time up front do develop your logic, but I'm wondering if you've developed any habits in laying out initial logic.
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS