I’m going to develop a shot em up game like Gradius (horizontal scrolling).
For the levels, instead of moving the space ship, I’m going to move the level, spawning the actors which are going to appear on the right of the screen, and destroy them when they disappear. But I don’t know how to do it.
I have thought to have some kind of data structure with the actors, and a counter (or something similar). With this counter I will access the data structure and I get the actors to spawn. And also, another counter to destroy them.
Another option is level streaming.
Are there other options to do it? Or, what do you recommend me?
Yes…why not just move the camera?
Your ship actor can have the camera included.
The camera always moves to the right.
The ship is attached to the camera so if you don’t do anything your ship will move with the camera and stay fixed in the screen.
You can clamp the horizontal location of the ship so you have limits in the screen you can’t surpass.
you can put two box colliders in the same camera/ship actor: one is in front, outside the camera view (far right side) that ACTIVATES the other actors (enemies/powerups/whatever
other box collider behind, outside the camera view too that will destroy the elements left behind.
For scrolling you move the whole ship/camera/colliders actor.
Here is some practical example:
The ship blueprint should look something like this:
For scrolling you scroll the whole actor
I added some action keys in the settings for moving the ship and the movement is clamped so the ship wont leave the screen zone like this:
here is the logic for moving the ship:
the other object actors have an ID tag so the end colliders of the ship can detect them and react.
this is the other actors tag:
then in the ON Begin Overlap Event of the ships collider I activate the other actors at the start and destroy them at the end like this:
Here is a short video I prepared for you just showing this method:
Hope it helps!