2016-03-26 00:47:20 +01:00
|
|
|
# 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.
|
|
|
|
|
2016-04-16 01:15:08 +02:00
|
|
|
```blocks
|
2016-03-30 06:17:57 +02:00
|
|
|
input.onButtonPressed(Button.A, () => {
|
2016-03-26 00:47:20 +01:00
|
|
|
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
|
|
|
|
```
|