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

617 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.input.onButtonEvent(Button.A, DAL.MICROBIT_BUTTON_EVT_CLICK, () => {
    game.addScore(1)
})
game.startCountdown(10000)

See Also

score, start countdown