class FlxTypedBasePath<TTarget>
package flixel.path
extends FlxBasic
implements IFlxDestroyable
import flixel.path.FlxBasePath
extended by FlxPath
Typed version of FlxBasePath
for flexibility in derived classes
5.9.0
.See also:
flixel.path.FlxBasePath
Constructor
new(?nodes:Array<FlxPoint>, ?target:TTarget, direction:FlxPathDirection = FORWARD)
Creates a new path. If valid nodes and a target are given it will start immediately.
Parameters:
nodes | An Optional array of nodes. Unlike |
---|---|
target | The target traversing our path |
Variables
read onlycurrentIndex:Int = -1
The index of the last node the target has reached, -1
means "no current node"
read onlydirection:FlxPathDirection = FlxPathDirection.FORWARD
The direction the list of nodes is being traversed. FORWARD
leads to the last node
ignoreDrawDebug:Bool = false
Setting this to true will prevent the object from appearing when FlxG.debugger.drawDebug is true.
read onlynextIndex:Int = -1
The index of the node the target is currently moving toward, -1
means the path is finished
read onlyonEndReached:FlxTypedSignal<FlxTypedBasePath<TTarget> ‑> Void> = new FlxTypedSignal<(FlxTypedBasePath<TTarget>)>()
Called whenenever the end is reached, for YOYO
this means both ends
read onlyonFinish:FlxTypedSignal<FlxTypedBasePath<TTarget> ‑> Void> = new FlxTypedSignal<(FlxTypedBasePath<TTarget>)>()
Called when the end is reached and loopType1 is
ONCE`
read onlyonNodeReached:FlxTypedSignal<FlxTypedBasePath<TTarget> ‑> Void> = new FlxTypedSignal<(FlxTypedBasePath<TTarget>)>()
Called whenenever any node reached
Methods
drawDebugOnCamera(camera:FlxCamera):Void
Based on this path data, it draws a simple lines-and-boxes representation of the path
if the drawDebug
mode was toggled in the debugger overlay.
You can use debugColor
to control the path's appearance.
Parameters:
camera | The camera object the path will draw to. |
---|
getCameras():Array<FlxCamera>
Determines to which camera this will draw (or debug draw). The priority is from high to low:
- Whatever value you've manually given the cameras
or camera
field
- Any cameras drawing path's container
, if one exists
- Any cameras drawing path's target
, if one exists
- The default cameras
restart():FlxTypedBasePath<TTarget>
Sets the current node to the beginning, or the end if direction
is BACKWARD
startAt(index:Int):FlxTypedBasePath<TTarget>
Change the path node this object is currently at.
Parameters:
index | The index of the new node out of path.nodes. |
---|---|
direction | Whether to head towards the head or the tail, if |