pxt-calliope/docs/reference/game/game-over.md
Juri Wolf 77ed2ccfb1
V4 updates (#210)
* update pxt.json files

* Fix button event enums

fixes https://github.com/microsoft/pxt-calliope/issues/206

* Fix Safari CSS Rule for iOS app

fixes https://github.com/microsoft/pxt-calliope/issues/205

* aprove preffered repos

should fix https://github.com/microsoft/pxt-calliope/issues/167
2023-01-11 09:51:27 -08:00

658 B

Game Over

End the game and show the score.

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.

basic.showString("PICK A BUTTON");
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
    basic.showString("YOU WIN!");
});
input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Down), () => {
    game.gameOver();
});

See Also

score, add score, start countdown