Skip to content
ClassCore & Lifecycle@public

FlxState ​

Base game state; initialize state-owned objects in create.

ts
export declare class FlxState extends FlxGroup

Properties ​

PropertyModifiersTypeDescription
destroySubStates-boolean-
persistentDraw-boolean-
persistentUpdate-boolean-
physicsWorldreadonlyFlxPhysicsWorld | nullOptional state-owned physics world, advanced after ordinary members.
subState-FlxSubState | null-
subStateClosedreadonlyFlxSignal<FlxSubState>Dispatched after the current substate has closed.
subStateOpenedreadonlyFlxSignal<FlxSubState>Dispatched after a requested substate has opened.

Methods ​

closeSubState() ​

ts
closeSubState(): void

Returns: void

create() ​

ts
create(): void

Returns: void

destroy() ​

ts
destroy(): void

Returns: void

draw() ​

ts
draw(): void

Returns: void

openSubState() ​

ts
openSubState(subState: FlxSubState): void

Parameters:

ParameterTypeDescription
subStateFlxSubState-

Returns: void

removePhysicsWorld() ​

ts
removePhysicsWorld(destroy?: boolean): FlxPhysicsWorld | null

Remove the current physics world and optionally release it.

Parameters:

ParameterTypeDescription
destroyboolean-

Returns: FlxPhysicsWorld | null

resetSubState() ​

ts
resetSubState(): void

Applies a deferred substate request. Normally called by the game loop.

Returns: void

setPhysicsWorld() ​

ts
setPhysicsWorld(world: FlxPhysicsWorld | null, destroyPrevious?: boolean): FlxPhysicsWorld | null

Install a physics world and optionally destroy the previous one. The same world may be installed repeatedly without resetting it.

Parameters:

ParameterTypeDescription
worldFlxPhysicsWorld | null-
destroyPreviousboolean-

Returns: FlxPhysicsWorld | null

Released under the MIT License.