Workshop › Space Invaders-style › Step 14 of 21
You have 3 lives. A bomb that touches the ship costs one, and clears the other bombs so you get a moment to breathe. Lives are shown top right.
```js
let lives = 3
function loseLife() {
lives -= 1
bombs = []
}
if (bombs.some((bomb) => overlaps(bomb, ship))) loseLife()
ctx.textAlign = 'right'
ctx.fillText('LIVES ' + lives, canvas.width - 10, 24)
```some is true if at least one bomb overlaps the ship; the same overlaps as for bullets.textAlign = 'right' makes the text end at x = canvas width − 10.score, write lives; under dropBomb, write loseLife.update, under the bomb filter line, check the ship.draw, write the lives after the score.Skills: Collision detection, Game states