Packageorg.flixel
Classpublic class FlxState
InheritanceFlxState Inheritance flash.display.Sprite

This is the basic game "state" object - e.g. in a simple game you might have a menu state and a play state. It acts as a kind of container for all your game objects. You can also access the game's background color and screen buffer through this object. FlxState is kind of a funny class from the technical side, it is just a regular Flash Sprite display object, with one member variable: a flixel FlxGroup. This means you can load it up with regular Flash stuff or with flixel elements, whatever works!



Public Properties
 PropertyDefined by
  bgColor : uint
[static] This static variable indicates the "clear color" or default background color of the game.
FlxState
  defaultGroup : FlxGroup
Internal group used to organize and display objects you add to this state.
FlxState
  screen : FlxSprite
[static] This static variable holds the screen buffer, so you can draw to it directly if you want.
FlxState
Public Methods
 MethodDefined by
  
Creates a new FlxState object, instantiating screen if necessary.
FlxState
  
Adds a new FlxCore subclass (FlxSprite, FlxBlock, etc) to the game loop.
FlxState
  
collide():void
This function collides defaultGroup against defaultGroup (basically everything you added to this state).
FlxState
  
create():void
Override this function to set up your game state.
FlxState
  
destroy():void
Override this function to handle any deleting or "shutdown" type operations you might need (such as removing traditional Flash children like Sprite objects).
FlxState
  
postProcess():void
Override this function to do special pre-processing FX like light bloom.
FlxState
  
preProcess():void
Override this function to do special pre-processing FX like motion blur.
FlxState
  
render():void
Automatically goes through and calls render on everything you added to the game loop, override this loop to manually control the rendering process.
FlxState
  
update():void
Automatically goes through and calls update on everything you added to the game loop, override this function to handle custom input and perform collisions/
FlxState
Property detail
bgColorproperty
public static var bgColor:uint

This static variable indicates the "clear color" or default background color of the game. Change it at ANY time using FlxState.bgColor.

defaultGroupproperty 
public var defaultGroup:FlxGroup

Internal group used to organize and display objects you add to this state.

screenproperty 
public static var screen:FlxSprite

This static variable holds the screen buffer, so you can draw to it directly if you want.

Constructor detail
FlxState()constructor
public function FlxState()

Creates a new FlxState object, instantiating screen if necessary.

Method detail
add()method
public function add(Core:FlxObject):FlxObject

Adds a new FlxCore subclass (FlxSprite, FlxBlock, etc) to the game loop. FlxState is adding this object to its built-in FlxGroup to automate updating and rendering.

Parameters
Core:FlxObject — The object you want to add to the game loop.

Returns
FlxObject
collide()method 
public function collide():void

This function collides defaultGroup against defaultGroup (basically everything you added to this state).

create()method 
public function create():void

Override this function to set up your game state. This is where you create your groups and game objects and all that good stuff.

destroy()method 
public function destroy():void

Override this function to handle any deleting or "shutdown" type operations you might need (such as removing traditional Flash children like Sprite objects).

postProcess()method 
public function postProcess():void

Override this function to do special pre-processing FX like light bloom. You can use scaling or blending modes or whatever you want against FlxState.screen to achieve all sorts of cool FX.

preProcess()method 
public function preProcess():void

Override this function to do special pre-processing FX like motion blur. You can use scaling or blending modes or whatever you want against FlxState.screen to achieve all sorts of cool FX.

render()method 
public function render():void

Automatically goes through and calls render on everything you added to the game loop, override this loop to manually control the rendering process.

update()method 
public function update():void

Automatically goes through and calls update on everything you added to the game loop, override this function to handle custom input and perform collisions/