How do best to handle flixel android application switching?

98 views Asked by At

I have a pretty extensive adventure game running on Android using flixel-gdx, and I would like to save the current game state when android switches to another application.

I know you can override the onFocus() and onFocusLost() methods on the FlxGame object, but I can't see a way of accessing the current game state from those methods. The only way I can see is to create a static object that holds a reference to the game state values, and refactor my entire game to reference the static object when it needs to manipulate those values.

Can anyone think of an alternative?

1

There are 1 answers

0
Wing Eraser On
FlxG.getState();

returns you the current state that is running.