Hello,
i did a 2D scrolling background system, but it needs an upgrade, and i need your help!
Here's a neat little graphic to help with explaining:
There are 5 background images of identican dimensions seamlessly connected to one another, first two (
Empty Stars 1 and
Empty Stars 2) and the last two (
Empty Stars 3 and
Empty Stars 4) are empty starfield.
The player starts the game on the
Empty Stars 2 field, and the background scrolls left to give an illusion of moving right. As the player moves through the level and passes on to the
Empty Stars 3 and
Empty Stars 4, only those two should loop until the end of the level occurs.
I though of doing it by simply activating the FSM on
Empty Stars 3 when it becomes visibile and checking the isVisible state of it. When it's not visible anymore, it relocates by double its width towards right. Same goes for
Empty Stars 4.
When the level ends, the hyperspeed state occurs in which the background movement speed increases (and continuously loops through
Empty Stars 3 and
Empty Stars 4 for an effect of speeding through space), some effects kick in and the screen fades to white.
At that moment, all the background elements are relocated to their original positions so the seamless background loop can be continued. The
Full Background image is changed to present another level. During the slowdown to normal speed,
Empty Stars 1 and
Empty Stars 2 are looped the same way as
Empty Stars 3 and
Empty Stars 4 when entering hyperspace to avoid looping the
Full Background Image. When the speed settles to normal, looping is off, and continues it's normal flow towards the end images. The FSM's for movement, waiting to be seen and relocation are reset and wait for them to be triggered again.
Actually, i wanted to ask the proper way of doing this since i only had a simple variant of it, but as i typed i got it all together lol. But be free to suggest a better solution if you have it.