Determines whether the current state is drawn, even when it is not the active state.
For example, if you have your game state open first, and then you push a pause state on top of it,
if this is set to true, the game state would still continue to be drawn behind that pause state.
By default, this is set to true, so the background states will continue to be "drawn" behind the current state.
If you do not want background states to be visible when you have a different state on top,
then you should set this to false for improved performance.
Determines whether the current state is updated, even when it is not the active state.
For example, if you have your game state open first, and then you push a pause state on top of it,
if this is set to true, the game state would still continue to be updated in the background.
By default, this is set to false, so the background states will continue to be "paused" when they are not active.
The number of entries in the members array. For performance and safety you should check this
variable instead of members.length unless you really know what you're doing!
Useful state for many game objects - "dead" (!alive) vs alive. kill() and
revive() both flip this switch (along with exists, but you can override that).
This determines on which FlxCameras this object will be drawn. If it is null / has not been
set, it uses the list of default draw targets, which is controlled via FlxG.camera.setDefaultDrawTarget
as well as the DefaultDrawTarget argument of FlxG.camera.add.
Adds a new FlxBasic subclass (FlxBasic, FlxSprite, Enemy, etc) to the group.
FlxGroup will try to replace a null member of the array first.
Failing that, FlxGroup will add it to the end of the member array.
WARNING: If the group has a maxSize that has already been met,
the object will NOT be added to the group!
Call this function to retrieve the first object with dead == false in the group.
This is handy for checking if everything's wiped out, or choosing a squad leader, etc.
Call this function to retrieve the first object with dead == true in the group.
This is handy for checking if everything's wiped out, or choosing a squad leader, etc.
Call this function to retrieve the first object with exists == true in the group.
This is handy for checking if everything's wiped out, or choosing a squad leader, etc.
Inserts a new FlxBasic subclass (FlxBasic, FlxSprite, Enemy, etc)
into the group at the specified position.
FlxGroup will try to replace a null member at the specified position of the array first.
Failing that, FlxGroup will insert it at the position of the member array.
WARNING: If the group has a maxSize that has already been met,
the object will NOT be inserted to the group!
Parameters:
position
The position in the group where you want to insert the object.
Recycling is designed to help you reuse game objects without always re-allocating or "newing" them.
It behaves differently depending on whether maxSize equals 0 or is bigger than 0.
maxSize > 0 / "rotating-recycling" (used by FlxEmitter):
- at capacity: returns the next object in line, no matter its properties like alive, exists etc.
- otherwise: returns a new object.
maxSize == 0 / "grow-style-recycling"
- tries to find the first object with exists == false
- otherwise: adds a new object to the members array
WARNING: If this function needs to create a new object, and no object class was provided,
it will return null instead of a valid object!
Parameters:
objectClass
The class type you want to recycle (e.g. FlxSprite, EvilRobot, etc).
objectFactory
Optional factory function to create a new object
if there aren't any dead members to recycle.
If null, Type.createInstance() is used,
which requires the class to have no constructor parameters.
force
Force the object to be an ObjectClass and not a super class of ObjectClass.
revive
Whether recycled members should automatically be revived
(by calling revive() on them).
Call this function to sort the group according to a particular value and order.
For example, to sort game objects for Zelda-style overlaps you might call
group.sort(FlxSort.byY, FlxSort.ASCENDING) at the bottom of your FlxState#update() override.
Parameters:
func
The sorting function to use - you can use one of the premade ones in
FlxSort or write your own using FlxSort.byValues() as a "backend".
The cameras that will draw this. Use this.cameras to set specific cameras for this object,
otherwise the container's cameras are used, or the container's container and so on. If there
is no container, say, if this is inside FlxGroups rather than a FlxContainer then the
default draw cameras are returned.
The main camera that will draw this. Use this.cameras to set specific cameras for this
object, otherwise the container's camera is used, or the container's container and so on.
If there is no container, say, if this is inside FlxGroups rather than a FlxContainer
then FlxG.camera is returned.