pxt-microbit
Version:
micro:bit target for Microsoft MakeCode (PXT)
28 lines (19 loc) • 504 B
Markdown
Find out if the game is currently running or not.
```sig
game.isRunning()
```
* a [boolean](/types/boolean) value that is `true` if the game is running or `false` if not.
If the game is currently running, end the game if button **B** is pressed.
```blocks
input.onButtonPressed(Button.B, function () {
if (game.isRunning()) {
game.gameOver()
}
})
```
[](/reference/game/is-paused),
[](/reference/game/is-game-over)