# How to implement arcade-style spawning?

In many arcade-style games with a horizontally scrolling camera, enemies spawn offscreen, either left or right, and traverse the screen in the opposite direction.

Spawning enemies is easy enough, but my question concerns the logic of getting them to spawn in an arcade-type way, just offscreen and according to the predefined patterns of the designer.

One idea I thought of was designating trigger areas in my level. When the player enters a trigger, enemy spawn points associated with that trigger then spawn enemies. But with a scrolling camera, sometimes as the camera scrolls, those spawn points enter the viewport and enemies spawn on screen out of nowhere.

What is a good technique to achieve arcade-style enemy spawns?

Here are two examples of the types of spawns I am thinking about:

https://youtu.be/Z7lAZExM21k?t=310 (Blazing Chrome by Joymasher) https://youtu.be/UAOFcpOfOVs?t=362 (Nightmare Busters by Arcade Zone)

• Presumably you could just calculate the spawn position relative to the screen edge, eg camera.RightEdge + spawnDistance or camera.LeftEdge - spawnDistance - where did you run into trouble making this work? – DMGregory Aug 4 at 3:30