pxt-calliope/docs/reference/game/set-score.md
Peli de Halleux 0e0275e496 doc fixes
2016-08-10 13:10:40 -07:00

31 lines
590 B
Markdown

# Set Score
Sets the current score.
```sig
game.setScore(1)
```
### Parameters
* a [number](/reference/types/number) that represents the new score.
### Examples
This program is a simple game.
Press button ``A`` as much as possible to increase the score.
Press ``B`` to display the score and reset the score.
```blocks
input.onButtonPressed(Button.B, () => {
basic.showNumber(game.score())
game.setScore(0)
})
input.onButtonPressed(Button.A, () => {
game.addScore(1)
})
```
### See Also
[score](/reference/game/score), [start countdown](/reference/game/start-countdown)