Workshop › Flappy-style Bird › Step 25 of 30
We give "the game just ended" a name: endGame. Everything that should happen at that moment will live in this one
function; the next step adds the best score there.
```js
function endGame() {
state = 'over'
}
if (hitGround || hitSky || pipes.some(hitsPipe)) endGame()
```endGame sets the state to 'over' for now.update calls it instead of setting the state itself.hitsPipe, leave an empty line and write endGame.update, replace state = 'over' at the end of the last line with endGame().Skills: Functions
← Try again Remember the best score →