Workshop › Flappy-style Bird › Step 24 of 30
A game you cannot restart without reloading the page is a game people stop playing. After game over, a flap calls
reset and goes back to 'ready'. The Game Over screen says so.
```js
function flap() {
if (state === 'over') {
reset()
return
}
ctx.font = '18px sans-serif'
ctx.fillText('Press Space to try again', canvas.width / 2, canvas.height / 2 + 34)
```return stops this flap from launching the bird at once. The next flap
starts the game.draw's 'over' block write the hint under Game Over.flap, change if (state === 'over') return into the block with reset() and return.draw, inside the 'over' block, under the Game Over line, add the two new lines.Skills: Game states, Keyboard and mouse input
← A function for a fresh start One place where the game ends →