pxt-calliope/docs/reference/game/is-running.md
2020-02-20 04:01:37 +01:00

527 B

is Running

Find out if the game is currently running or not.

game.isRunning()

Returns

  • a 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.

input.input.onButtonEvent(Button.B, ButtonEvent.Click, function () {
	if (game.isRunning()) {
        game.gameOver()
    }
})

See also

is paused, is game over