Setting up an enemy wave
We need to set up the amount of green balls that get spawned. When we push the WaveButton, a new wave should start. Let's go ahead and add a global variable by right-clicking on the event sheet and adding a global variable. Let's call it waveCount
and set its Initial value to 3
, as shown in the following screenshot:
Create another variable called ballCount
. Set its Initial value to 0
. The wave count is going to count how many total green balls are going to be spawned in a wave, and the ball count will count how many balls are on screen. We need both of these variables in order to make it work. Generally, you want to try and use the least amount of variables as possible—but often the least amount can still be a lot of variables. Even in some small games I've seen, the variable count exceeds 200.
Once you have created this global variable, let's use it. Add an event to the green ball and select the On created event, as shown in the following screenshot:
Once you have...