Workshop › Asteroids › Step 37 of 41
Losing the last life ends the game. While there are lives left, crash resets the ship and returns; otherwise the state
becomes 'over'.
```js
function crash() {
lives -= 1
if (lives > 0) {
resetShip()
return
}
state = 'over'
}
```return skips the rest. Only the last crash reaches state = 'over'.In crash, put resetShip() inside if (lives > 0) { ... return } and write state = 'over' after it.
Skills: Game states
← Playing or over Best score →