pxt-calliope/docs/reference/game/change-score-by.md

28 lines
595 B
Markdown
Raw Normal View History

2016-03-26 00:47:20 +01:00
# Change Score By
Add the amount you say to the score for the game.
```sig
game.addScore(1)
```
2016-06-16 02:56:41 +02:00
### Parameters
* a [number](/reference/types/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.
2016-03-26 00:47:20 +01:00
2016-04-16 01:15:08 +02:00
```blocks
input.onButtonPressed(Button.A, () => {
2016-03-26 00:47:20 +01:00
game.addScore(1)
})
game.startCountdown(10000)
```
### See Also
2016-03-26 00:47:20 +01:00
[score](/reference/game/score), [start countdown](/reference/game/start-countdown)