#9 | 18-08-24 | Wave System


Hello!

The main task of the last two days has been creating the wave spawning system. I've been beating my head against this challenge relentlessly.

In order to create the wave spawning mechanic, I had to rewrite the script several times from scratch. Pictured below is the current version, it'll need to be rewritten when I add multiple enemy types.

In order to make sure that the next wave starts only after the last enemy is killed, incorporated checks to determine how many enemies were in the scene. If there were none present, the next wave would be able to start.

Each "wave" shares very similar code to the coroutine for wave one.


I've only shown a small portion of this script, the logic parts that make the waves spawn. Majority of the code (300 - 400 lines) is the spawning instructions for each individual wave. In the future, I plan to optimize it so that I can have many different waves with minimal code. This script is the longest and most complex I have written.

One idea that I've been thinking about is having multiple different maps the player can choose from. Because the amount of enemies spawned is proportional to the amount of spawn points, smaller maps with few spawn points will be easier to survive whereas larger maps with more spawn points will be tougher. That would add more depth to the game. I'll ponder the idea for a few days before committing to it.

Now that wave mechanics are done, the next task will be getting the game ready for the alpha build and gathering testers.

Thanks for reading!

Get Dead Alert

Leave a comment

Log in with itch.io to leave a comment.