pxt-calliope/docs/reference/game/score.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

550 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.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
    game.addScore(1);
    basic.pause(500);
    basic.showNumber(game.score());
	});

See Also

change score by, start countdown