Endless scrolling (randomized) backgrounds?
razielhiwatari
Member Posts: 2
I currently have a self-repeating scrolling background (following this tutorial and I have different background images that tile on the Y axis. I want to make it so that when the player gets X score, the active background smoothly transitions to a different image. The problem is that with my current settup, the image just pops in place right where the 1st actor was...
tldr; I have background A and B. Background A repeats itself until player gets X score, at which it immediately spawns Background B and destroys itself. How do I make it so that Background B follows the last scrolling cycle of Background A? Or is there a completely different way I should go about this? Any help on this would be appreciated.
Comments
You could have another background that's the same size on top of it that is constrained to the background you have that's moving. Turn its alpha down to 0. Then, when that X score happens, interpolate that alpha up to 1. Then you could have the background beneath it change to something else for the next time you want a background change. Then the next time you need a background change, turn down the alpha on the upper background again. Repeat this cycle forever!
Edit: My above example was assuming you were recycling actors, which you might want to do anyway. Just when the background goes off one side, have it pop on over to the other side instead of destroying itself.
Alternately, I have a similar issue in a game that I'm making. What I decided to do was spawn a big white actor on top of the background I wanted to change. Have that white actor's alpha start at 0, then interpolate up to 1 very quickly, then back down to 0. When it's up to 1, I have the background below it change to a different image. It makes it look like there's a bright flash and then there's a new background. You could also do it with black instead of white if you wanted a different mood.
Vote for Nearest Neighbor Scaling option in gamesalad! Let's make our games look truly stunning!
Sorry I couldn't get back to you sooner, but thank you very much for your input! I will try out both methods you mentioned and get back to you soon.