Workshop › Bomberman-style Arena › Step 27 of 42
At zero lives the game is over: state becomes 'lost', update stops doing anything and no more bombs can be
dropped.
```js
let state // 'playing', 'won' or 'lost'
state = 'playing'
function hurt() {
lives -= 1
if (lives === 0) {
state = 'lost'
return
}
function update() {
if (state !== 'playing') return
if (state !== 'playing' || bombs.length >= maxBombs) return
```hurt ends the game at 0 lives and leaves before moving the player.!== means "is not equal to": when not playing, update returns at once, so nothing moves or burns.dropBomb also leaves when not playing (|| means "or").let safe write let state; in reset, under safe = 0, write state = 'playing'.hurt, under lives -= 1, write the if block.if (state !== 'playing') return as the first line of update.dropBomb with state !== 'playing' ||.Skills: Game states