0

I would like to check if gameEngine is paused in if statement, but it seems there is no such method.

if (isGameEnginePaused) {
   //Do something
}
Davoud
  • 2,576
  • 1
  • 32
  • 53

1 Answers1

1

If you are within a FlameGame instance you can simply check the paused flag.

class YourGame extends FlameGame {
  ...
  if(paused) {
    // whatever you want to do
  }
}

Do note that the update-loop won't be running when the game is paused, so you can't do the check within an update method.

To check from outside of the game you can just use:

if(game.paused) {
  // whatever you want to do
}
spydon
  • 9,372
  • 6
  • 33
  • 63