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");
|
2020-02-20 04:01:37 +01:00
|
|
|
input.input.onButtonEvent(Button.A, DAL.MICROBIT_BUTTON_EVT_CLICK, () => {
|
2016-06-16 00:58:35 +02:00
|
|
|
basic.showString("YOU WIN!");
|
|
|
|
});
|
2020-02-20 04:01:37 +01:00
|
|
|
input.input.onButtonEvent(Button.B, DAL.MICROBIT_BUTTON_EVT_CLICK, () => {
|
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)
|