Enemy Wave Implementation

Aaron Lowe
2 min readDec 21, 2023

--

I decided with my enemy wave, the spawn enemy method in my spawn manager would be triggered by player score. This sounds easier than it was, and here is what my first attempt looked like.

This was from a typo in a for statement. Getting started I opened my spawn manager script. I added these variables, which may be too easy and need to be adjusted later.

The method I chose for implementing my spawn manager:

I used a loop that goes through each element in the score thresholds and for each element it checks for the player’s score. Then, it stops the loop using break. After the loop, if the player score meets or exceeds the threshold, the spawn delay is reduced. Next was calling this from the UI Manager, which I did when the player score updated.

And the final result:

At 400, the spawnmanager will be set to end the enemy spawn and spawn whatever is next to come.

--

--