✓ Test your program - it should be displaying "Wave - 0" at the top.
Create a new method called nextWave() and call it from update(). The next wave method does the following:
Looks through each object, checking if it is an enemy
If it finds a single enemy, quits the method early
Increases the wave count by one
✓ Test your program - it should be displaying wave at the top. When you run out of enemies on the screen, it should rapidly increase forever.
✓ Test your program - it should advance to wave 1, spawn these enemies, then advance forever once the wave is completed. Try adding in more waves and make sure it works as intended.
STEAMLINING YOUR CODE
In the code above, we have a whole bunch of stuff inside each wave. Imagine if you were creating 3 different types of enemies across 5-10 waves. It's a lot of clutter!
Let's simplify this by making a helper method for spawning the EvilSquare.
This lets us make spawnEnemies() way simpler. Look at how simple the new version is by comparison:
Spawn Above The Screen
This means the squares spawn at the top of the screen, but they're actually spawning on the screen. If you look closely, you can see enemies "pop" on screen between waves. Instead, considering making them appear off screen.
Consider having enemies that come from different directions. You could have a group of enemies spawn on the left side, move to the right, and wrap in that direction.
Careful! If you have an enemy that "bounces" off all four sides, you won't (easily) be able to have it spawn off the screen. You can do so with some careful coding, but may want to consider just having them appear already on the screen.