Workshop › Missile Command-style Defense › Step 25 of 35
The game comes in waves. nextWave() starts the next one: a few more missiles each time, and a little more ammo.
reset() starts from wave 0 and calls it.
```js
let wave
function nextWave() {
wave += 1
toLaunch = 8 + wave * 2
launchIn = 30
ammo = 12 + wave * 2
}
wave = 0
score = 0
nextWave()
```nextWave adds 1 to wave and sets up that wave: 8 + wave * 2 missiles and 12 + wave * 2 interceptors.reset sets wave = 0, so its call to nextWave() starts wave 1.let toLaunch write let wave.// A new enemy missile ... comment, write nextWave, followed by an empty line.reset, replace the lines score = 0, toLaunch = 20, launchIn = 30, ammo = 14 with the three new lines.Skills: Game states, Functions
← Limited ammo Each wave is harder →