Workshop › Missile Command-style Defense › Step 28 of 35
When the last city falls, the game is 'over': nothing moves any more. And you can only fire while playing.
```js
if (state === 'over') return
if (!cities.some((c) => c.alive)) {
state = 'over'
return
}
if (state !== 'playing' || ammo === 0 || ty > BASE.y - 10) return
```update: when over, do nothing.!cities.some((c) => c.alive) is true when no city is alive: the game is over. return skips the wave-end bonus.fire now also refuses when the state is not 'playing'.update, above the between block, write if (state === 'over') return.if, write the lost-cities block.fire, add state !== 'playing' || at the start of the condition.Skills: Game states
← The end of a wave Play again →