2D Shooter: Powerup Spawn Manager

Objective: Spawn the powerup collectible every 3–7 seconds at random places on the x-axis.

This time we will be working with the Spawn Manager object once again, this is an empty object we made quite a while ago for spawning enemies.

Make sure that the powerup collectible is turned into a prefab.

Now, open up the script for the spawn manager. For the sake of organization, let’s rename the routine we made previously as “SpawnEnemyRoutine”. Now make another IEnumerator method named “SpawnTripleShotRoutine”. Like before we’ll want to make a while loop that is true while the player is still alive. This time, we just don’t need a container because once the powerup leaves the screen, its destroyed.

Do make a variable to hold the tripleshot powerup though.

Once this is complete, just call the method in start using StartCoroutine().

--

--

Sabrina Windsor

Currently learning to code with the help of GamedevHQ in order to someday my my game ideas come to life!