pxt-calliope/docs/reference/game/score.md
2020-02-20 04:01:37 +01:00

545 B

Score

Find the number of points scored in your game.

game.score()

Example

This program adds one point to your score every time you press button A, and shows an animation. Then it waits 500 milliseconds (half a second) and shows your score.

input.input.onButtonEvent(Button.A, DAL.MICROBIT_BUTTON_EVT_CLICK, () => {
    game.addScore(1);
    basic.pause(500);
    basic.showNumber(game.score());
	});

See Also

change score by, start countdown