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

622 B

Change Score By

Add the amount you say to the score for the game.

game.addScore(1)

Parameters

  • a number that means how much to add to the score. A negative number means to subtract from the score.

Examples

This program is a simple game. Press button A as much as possible. At the end of 10 seconds, the program will show your score.

input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
    game.addScore(1)
})
game.startCountdown(10000)

See Also

score, start countdown