class FlxBasic
package flixel
implements IFlxDestroyable
extended by FlxNapeSpace, FlxControl, FlxScreenGrab, FlxTaskManager, FlxMouseControl, FlxScrollingText, FlxTileSpecial, FlxAsyncLoop, FlxTypedGroup, FlxMouseEventManager, FlxSound, FlxTweenManager, FlxTimerManager, FlxCamera, FlxObject
This is a useful "generic" Flixel object. Both FlxObject
and
FlxGroup
extend this class. Has no size, position or graphical data.
Constructor
Variables
ID:Int = idEnumerator++
A unique ID starting from 0 and increasing by 1 for each subsequent FlxBasic
that is created.
alive:Bool = true
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).
cameras:Array<FlxCamera>
This determines on which FlxCamera
s 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
.
read onlycontainer:Null<FlxContainer>
The parent containing this basic, typically if you check this recursively you should reach the state
5.7.0
.Methods
destroy():Void
WARNING: A destroyed FlxBasic
can't be used anymore.
It may even cause crashes if it is still part of a group or state.
You may want to use kill()
instead if you want to disable the object temporarily only and revive()
it later.
This function is usually not called manually (Flixel calls it automatically during state switches for all add()
ed objects).
Override this function to null
out variables manually or call destroy()
on class members if necessary.
Don't forget to call super.destroy()
!
draw():Void
Override this function to control how the object is drawn. Doing so is rarely necessary, but can be very useful.
getCameras():Array<FlxCamera>
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.
5.7.0
.kill():Void
Handy function for "killing" game objects. Use reset()
to revive them.
Default behavior is to flag them as nonexistent AND dead.
However, if you want the "corpse" to remain in the game, like to animate an effect or whatever,
you should override
this, setting only alive
to false
, and leaving exists
true
.