Add game state boolean ref docs (#1694)
* Add game state boolean doc refs * Add check for _img validity * JS guru tricks
This commit is contained in:
28
docs/reference/game/is-running.md
Normal file
28
docs/reference/game/is-running.md
Normal file
@ -0,0 +1,28 @@
|
||||
# is Running
|
||||
|
||||
Find out if the game is currently running or not.
|
||||
|
||||
```sig
|
||||
game.isRunning()
|
||||
```
|
||||
|
||||
## Returns
|
||||
|
||||
* a [boolean](/types/boolean) value that is `true` if the game is running or `false` if not.
|
||||
|
||||
## Example
|
||||
|
||||
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()
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
## See also
|
||||
|
||||
[is paused](/reference/game/is-paused),
|
||||
[is game over](/reference/game/is-game-over)
|
Reference in New Issue
Block a user