Workshop › Doodle Jump-style Climber › Step 15 of 24
The floor goes away. Miss a platform and you fall; once you drop below the bottom of the screen, the game is over.
```js
let state = 'playing' // 'playing' or 'over'
if (state !== 'playing') return
if (player.y > cameraY + canvas.height) {
state = 'over'
}
if (state === 'over') {
ctx.fillStyle = 'rgba(248, 250, 252, 0.85)'
ctx.fillRect(0, 0, canvas.width, canvas.height)
ctx.fillStyle = '#0f172a'
ctx.textAlign = 'center'
ctx.font = 'bold 32px sans-serif'
ctx.fillText('Game Over', canvas.width / 2, canvas.height / 2)
ctx.font = '18px sans-serif'
ctx.fillText('Press Space to play again', canvas.width / 2, canvas.height / 2 + 32)
}
```FLOOR and the floor bounce are removed.cameraY + canvas.height), it is out of sight: game over.update stops while the game is over, and a see-through light layer with the message covers the picture.FLOOR line, and in update the floor block with its comment.highest, write state; make the state check the first line of update.update, write the fall check; at the end of draw, the game over screen.Skills: Game states
← Endless platforms Play again →