class flixel.FlxState extends FlxGroup

Available on all platforms

This is the basic game "state" object - e.g. in a simple game you might have a menu state and a play state. * It is for all intents and purpose a fancy FlxGroup. And really, it's not even that fancy.

Instance Fields

var destroySubStates:Bool

If substates get destroyed when they are closed, setting this to false might reduce state creation time, at greater memory cost.

var persistentDraw:Bool

Determines whether or not this state is updated even when it is not the active state. For example, if you have your game state first, and then you push a menu state on top of it, if this is set to true, the game state would continue to be drawn behind the pause state. * By default this is true, so background states will continue to be drawn behind the current state. If background states are not visible when you have a different state on top, you should set this to false for improved performance.

var persistentUpdate:Bool

Determines whether or not this state is updated even when it is not the active state. For example, if you have your game state first, and then you push a menu state on top of it, * if this is set to true, the game state would continue to update in the background. By default this is false, so background states will be "paused" when they are not active.

var subState:FlxSubState

Current substate. Substates also can be nested.

function new(?MaxSize:Int):Void

function closeSubState():Void

Closes the substate of this state, if one exists.

function create():Void

This function is called after the game engine successfully switches states. Override this function, NOT the constructor, to initialize or set up your game state. * We do NOT recommend overriding the constructor, unless you want some crazy unpredictable things to happen!

function destroy():Void

function draw():Void

function onFocus():Void

This method is called after application gets focus. * Can be useful if you using third part libraries, such as tweening engines.

function onFocusLost():Void

This method is called after application losts its focus. * Can be useful if you using third part libraries, such as tweening engines.

function onResize(Width:Int, Height:Int):Void

This function is called whenever the window size has been changed. * *

Width

The new window width *

Height

The new window Height

function openSubState(SubState:FlxSubState):Void

function resetSubState():Void

Load substate for this state