2016-03-26 00:47:20 +01:00
|
|
|
# Score
|
|
|
|
|
2016-06-15 23:56:58 +02:00
|
|
|
Find the number of points scored in your game.
|
2016-03-26 00:47:20 +01:00
|
|
|
|
2016-06-15 23:56:58 +02:00
|
|
|
```sig
|
|
|
|
game.score()
|
2016-03-26 00:47:20 +01:00
|
|
|
```
|
|
|
|
|
2019-12-02 05:58:26 +01:00
|
|
|
## Example
|
2016-03-26 00:47:20 +01:00
|
|
|
|
2016-06-15 23:56:58 +02:00
|
|
|
This program adds one point to your score every time you press button
|
|
|
|
`A`, and shows an animation. Then it waits 500 milliseconds (half a
|
|
|
|
second) and shows your score.
|
2016-03-26 00:47:20 +01:00
|
|
|
|
2016-06-15 23:56:58 +02:00
|
|
|
```blocks
|
2020-02-20 17:00:11 +01:00
|
|
|
input.input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
|
2016-06-15 23:56:58 +02:00
|
|
|
game.addScore(1);
|
|
|
|
basic.pause(500);
|
|
|
|
basic.showNumber(game.score());
|
|
|
|
});
|
2016-03-26 00:47:20 +01:00
|
|
|
```
|
|
|
|
|
2019-12-02 05:58:26 +01:00
|
|
|
## See Also
|
2016-03-26 00:47:20 +01:00
|
|
|
|
2016-06-15 23:56:58 +02:00
|
|
|
[change score by](/reference/game/score), [start countdown](/reference/game/start-countdown)
|