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