2016-03-25 16:47:20 -07:00
|
|
|
# Game Over
|
|
|
|
|
2016-06-15 15:58:35 -07:00
|
|
|
End the game and show the score.
|
|
|
|
|
2016-07-18 14:23:05 -07:00
|
|
|
```sig
|
|
|
|
game.gameOver();
|
|
|
|
```
|
|
|
|
|
2017-09-07 13:42:08 -07:00
|
|
|
## Example
|
2016-06-15 15:58:35 -07:00
|
|
|
|
|
|
|
This program asks you to pick a button.
|
|
|
|
If you press button `A`, the program says `YOU WIN!`.
|
|
|
|
If you press button `B`, it shows an animation and ends the game.
|
|
|
|
|
|
|
|
```blocks
|
|
|
|
basic.showString("PICK A BUTTON");
|
|
|
|
input.onButtonPressed(Button.A, () => {
|
|
|
|
basic.showString("YOU WIN!");
|
|
|
|
});
|
|
|
|
input.onButtonPressed(Button.B, () => {
|
|
|
|
game.gameOver();
|
|
|
|
});
|
2016-03-25 16:47:20 -07:00
|
|
|
```
|
|
|
|
|
2017-09-07 13:42:08 -07:00
|
|
|
## See Also
|
2016-06-15 15:58:35 -07:00
|
|
|
|
|
|
|
[score](/reference/game/score),
|
2017-08-10 17:52:43 -07:00
|
|
|
[add score](/reference/game/add-score), [start countdown](/reference/game/start-countdown)
|