pxt-calliope/docs/reference/game/change-score-by.md
2016-04-15 16:15:08 -07:00

32 lines
609 B
Markdown

# Change Score By
The code below shows a simple game where the user gets to press the button ``A`` as much times as possible and the score will display on the screen.
```blocks
input.onButtonPressed(Button.A, () => {
game.addScore(1)
})
game.startCountdown(10000)
```
### Score
When a player achieves a goal, you can increase the game score
* add score points to the current score
```
export function addScore(points: number)
```
* get the current score value
```
export function score() : number
```
### Lessons
[game of chance](/lessons/game-of-chance), [game counter](/lessons/game-counter)