pxt-calliope/docs/reference/game/game-over.md
2020-03-19 16:26:40 +01:00

612 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, ButtonEvent.Click, () => {
    basic.showString("YOU WIN!");
});
input.onButtonEvent(Button.B, ButtonEvent.Click, () => {
    game.gameOver();
});

See Also

score, add score, start countdown