pxt-microbit/docs/reference/game/score.md

26 строки
510 B
Markdown
Исходник Постоянная ссылка Обычный вид История

2016-03-26 02:47:20 +03:00
# Score
Find the number of points scored in your game.
2016-03-26 02:47:20 +03:00
```sig
game.score()
2016-03-26 02:47:20 +03:00
```
## Example
2016-03-26 02:47:20 +03: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 02:47:20 +03:00
```blocks
input.onButtonPressed(Button.A, () => {
game.addScore(1);
basic.pause(500);
basic.showNumber(game.score());
});
2016-03-26 02:47:20 +03:00
```
## See Also
2016-03-26 02:47:20 +03:00
[change score by](/reference/game/score), [start countdown](/reference/game/start-countdown)