Packageorg.flixel
Classpublic class FlxState
InheritanceFlxState Inheritance FlxGroup Inheritance FlxBasic Inheritance Object

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 glorified FlxGroup.



Public Properties
 PropertyDefined By
 Inheritedactive : Boolean
Controls whether update() is automatically called by FlxState/FlxGroup.
FlxBasic
 Inherited_ACTIVECOUNT : uint
[static]
FlxBasic
 Inheritedalive : Boolean
Useful state for many game objects - "dead" (!alive) vs alive.
FlxBasic
 Inheritedexists : Boolean
Controls whether update() and draw() are automatically called by FlxState/FlxGroup.
FlxBasic
 InheritedID : int
IDs seem like they could be pretty useful, huh?
FlxBasic
 Inheritedlength : Number
FlxGroup
 InheritedmaxSize : uint
FlxGroup
 Inheritedmembers : Array
Array of all the FlxBasics that exist in this layer.
FlxGroup
 Inheritedvisible : Boolean
Controls whether draw() is automatically called by FlxState/FlxGroup.
FlxBasic
 Inherited_VISIBLECOUNT : uint
[static]
FlxBasic
Protected Properties
 PropertyDefined By
 Inherited_marker : uint
FlxGroup
 Inherited_maxSize : uint
FlxGroup
 Inherited_sortIndex : String
Helpers for sorting members.
FlxGroup
 Inherited_sortOrder : int
FlxGroup
Public Methods
 MethodDefined By
 Inherited
Adds a new FlxBasic subclass (FlxBasic, FlxSprite, MyEnemy, etc) to the group.
FlxGroup
 Inherited
clear():void
Remove all instances of FlxBasic subclass (FlxSprite, FlxBlock, etc) from the list.
FlxGroup
  
collide(ObjectOrGroup1:FlxBasic = null, ObjectOrGroup2:FlxBasic = null, NotifyCallback:Function = null):Boolean
Call this function to see if one FlxObject collides with another.
FlxState
 Inherited
countDead():int
Call this function to find out how many members of the group are dead.
FlxGroup
 Inherited
Call this function to find out how many members of the group are not dead.
FlxGroup
  
create():void
This function is called after the game engine successfully switches states.
FlxState
 Inherited
destroy():void
[override] Override this function to handle any deleting or "shutdown" type operations you might need, such as removing traditional Flash children like Sprite objects.
FlxGroup
 Inherited
draw():void
[override] Automatically goes through and calls render on everything you added, override this loop to control render order manually.
FlxGroup
 Inherited
Call this function to retrieve the first object with dead == false in the group.
FlxGroup
 Inherited
getFirstAvail(ObjectClass:Class = null):FlxBasic
Call this function to retrieve the first object with exists == false in the group.
FlxGroup
 Inherited
Call this function to retrieve the first object with dead == true in the group.
FlxGroup
 Inherited
Call this function to retrieve the first object with exists == true in the group.
FlxGroup
 Inherited
Call this function to retrieve the first index set to 'null'.
FlxGroup
 Inherited
Returns a member at random from the group.
FlxGroup
 Inherited
kill():void
[override] Calls kill on the group and all its members.
FlxGroup
 Inherited
onScreen(Camera:FlxCamera = null):Boolean
FlxBasic
  
overlap(ObjectOrGroup1:FlxBasic = null, ObjectOrGroup2:FlxBasic = null, NotifyCallback:Function = null, ProcessCallback:Function = null):Boolean
Call this function to see if one FlxObject overlaps another.
FlxState
 Inherited
postUpdate():void
FlxBasic
 Inherited
preUpdate():void
[override]
FlxGroup
 Inherited
recycle(ObjectClass:Class = null):FlxBasic
Recycling is designed to help you reuse game objects without always re-allocating or "newing" them.
FlxGroup
 Inherited
remove(Object:FlxBasic, Splice:Boolean = false):FlxBasic
Removes an object from the group.
FlxGroup
 Inherited
replace(OldObject:FlxBasic, NewObject:FlxBasic):FlxBasic
Replaces an existing FlxBasic with a new one.
FlxGroup
 Inherited
revive():void
FlxBasic
 Inherited
setAll(VariableName:String, Value:Object, Recurse:Boolean = true):void
FlxGroup
 Inherited
sort(Index:String = y, Order:int):void
Call this function to sort the group according to a particular value and order.
FlxGroup
 Inherited
toString():String
Convert object to readable string name.
FlxBasic
 Inherited
update():void
[override] Automatically goes through and calls update on everything you added, override this function to handle custom input and perform collisions.
FlxGroup
Protected Methods
 MethodDefined By
 Inherited
sortHandler(Obj1:FlxBasic, Obj2:FlxBasic):int
Helper function for the sort process.
FlxGroup
Public Constants
 ConstantDefined By
 InheritedASCENDING : int = -1
[static]
FlxGroup
 InheritedDESCENDING : int = 1
[static]
FlxGroup
 InheritedGROW : uint = 1
[static]
FlxGroup
 InheritedSTRICT : uint = 0
[static]
FlxGroup
Method Detail
collide()method
public function collide(ObjectOrGroup1:FlxBasic = null, ObjectOrGroup2:FlxBasic = null, NotifyCallback:Function = null):Boolean

Call this function to see if one FlxObject collides with another. Can be called with one object and one group, or two groups, or two objects, whatever floats your boat! It will put everything into a quad tree and then check for collisions. For maximum performance try bundling a lot of objects together using a FlxGroup (even bundling groups together!) NOTE: does NOT take objects' scrollfactor into account.

Parameters

ObjectOrGroup1:FlxBasic (default = null) — The first object or group you want to check.
 
ObjectOrGroup2:FlxBasic (default = null) — The second object or group you want to check. If it is the same as the first, flixel knows to just do a comparison within that group.
 
NotifyCallback:Function (default = null) — A function with two FlxObject parameters - e.g. myOverlapFunction(Object1:FlxObject,Object2:FlxObject) - that is called if those two objects overlap.

Returns
Boolean
create()method 
public function create():void

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

overlap()method 
public function overlap(ObjectOrGroup1:FlxBasic = null, ObjectOrGroup2:FlxBasic = null, NotifyCallback:Function = null, ProcessCallback:Function = null):Boolean

Call this function to see if one FlxObject overlaps another. Can be called with one object and one group, or two groups, or two objects, whatever floats your boat! It will put everything into a quad tree and then check for overlaps. For maximum performance try bundling a lot of objects together using a FlxGroup (even bundling groups together!) NOTE: does NOT take objects' scrollfactor into account.

Parameters

ObjectOrGroup1:FlxBasic (default = null) — The first object or group you want to check.
 
ObjectOrGroup2:FlxBasic (default = null) — The second object or group you want to check. If it is the same as the first, flixel knows to just do a comparison within that group.
 
NotifyCallback:Function (default = null) — A function with two FlxObject parameters - e.g. myOverlapFunction(Object1:FlxObject,Object2:FlxObject) - that is called if those two objects overlap.
 
ProcessCallback:Function (default = null) — A function with two FlxObject parameters - e.g. myOverlapFunction(Object1:FlxObject,Object2:FlxObject) - that is called if those two objects overlap. If a ProcessCallback is provided, then NotifyCallback will only be called if ProcessCallback returns true for those objects!

Returns
Boolean