pxt-calliope/docs/reference/game/game-over.md

29 lines
610 B
Markdown
Raw Normal View History

2016-03-26 00:47:20 +01:00
# Game Over
End the game and show the score.
2016-07-18 23:23:05 +02:00
```sig
game.gameOver();
```
## Example
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.onButtonEvent(Button.A, ButtonEvent.Down, () => {
basic.showString("YOU WIN!");
});
input.onButtonEvent(Button.B, ButtonEvent.Down, () => {
game.gameOver();
});
2016-03-26 00:47:20 +01:00
```
## See Also
[score](/reference/game/score),
[add score](/reference/game/add-score), [start countdown](/reference/game/start-countdown)