Best way to define the entrance time and position of enemies in a shoot'em up?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Leandro

Greetings… I’m developing a shmup. Each stage background will be composed of cyclic parallax images, no big deal, but on each stage enemies will appear on predetermined time and screen positions. Currently my already made enemy ships simply are dumped on screen at a -100 y coordinate, but I now I think about a counter variable (that will of course be changed according to delta) in such a way that if the counter reaches a certain value, it’ll add a certain enemy at a certain position, and so on.

But I have no idea about how to do it in a less tiresome way, or if is there any other way to do it instead of my solution. Any ideas?

Thanks in advance.

P.S.: This is my game prototype so far…

:bust_in_silhouette: Reply From: kidscancode

Have a look at the Timer node. You can have timers attached to individual enemies, or global one(s) that trigger separate events.

:bust_in_silhouette: Reply From: fossegutten

I am making a similar game, but in my game there is a moving camera. I use VisibilityNotifier2D node. Make sure the enemy doesnt move until screen_entered signal is emitted :slight_smile:

If your camera doesnt move, maybe you can have a Path2D that moves through the camera, and place the enemies and obstacles in a Pathfollow2D node?

:bust_in_silhouette: Reply From: Leandro

Someone gave me a simpler solution: I simply put visually enemies on the 2D editor. I did not know that if I added objects above the screen, the visual area on the editor would expand. I’m simply adding enemies on it and changing their scripts to make them move vertically and get active only when they enter the screen.