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)

  • 1
    \$\begingroup\$ 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? \$\endgroup\$
    – DMGregory
    Commented Aug 4, 2019 at 3:30

1 Answer 1


Don't trigger based on the camera's position. Trigger based on the player's.

Once the player enters the trigger you spawn the enemies just outside the edges of the camera's view. Since the camera should be following the player anyway, you can derive the edges of the screen from its position and the screen dimensions. Then it's a simple matter of adding/subtracting to the calculated position to hide the pop-in off screen.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .