What is the best way to handle Off Screen Enemies in a SHMUP?

Hello,

I’m working on fixed position vertical scroller. The player’s ship can’t move off screen, rather the level comes to him. The best example of this is Art in Game’s Air Attack HD. I’m also looking at a lot of classic arcade shooters like 1943. My question, How do those games handle off screen enemies?

In my current game build, I create triggers that are attached to a scrolling background. When the player goes through the trigger, an enemy spawns at an off screen trigger point. this kind of works, but the enemies sometimes appear in the middle of the screen, not really ideal. As it stands, I have to create a ton of triggers. Is there a better solution?

I assume your visible screen clip is defined by a rect of some sort. If you’re using an orthographic camera it will be defined by the orthographic size and then adjusted by your screen resolution. You want to hone in on that rect and use the far right bound and spawn mobs to the right of that.

If your scrolling speed is constant you can spawn waves of mobs based on time but that may complicate your level lay out. You can cut your number of triggers by having a single trigger begin a series of spawns(a wave) and then assign that wave to one trigger, and a different wave to the next trigger.

For offscreen spawning the easiest way I’ve found is to simply define a 2d bounding box that you’re going to spawn mobs into and place it above(or in your case to the right) your viewport and high enough where the largest spawned mob is still not visible even if you spawn it at the nearest part of your bounding box.

My approach is code-centric and is simply a function of time. My scroll speed is constant so I simply spawn waves of mobs based on time and after a few playthroughs you get a feel for what spawn speed does to your level of difficulty. The benefit of this approach is that when you implement difficulty levels you can crank up the number of mobs easily as well as their strength.

Well you would often do those based on a timer rather than triggers and you can work out what that timer would be based on the position of the object and the speed of the scrolling so that it is enabled just off screen.