| Package | org.flixel |
| Class | public class FlxPath |
| Inheritance | FlxPath Object |
FlxObject can follow. Also has code for drawing debug visuals.
FlxTilemap.findPath() returns a path object, but you can
also just make your own, using the add() functions below
or by creating your own array of points.
| Property | Defined By | ||
|---|---|---|---|
| debugColor : uint
Specify a debug display color for the path. | FlxPath | ||
| debugScrollFactor : FlxPoint
Specify a debug display scroll factor for the path. | FlxPath | ||
| ignoreDrawDebug : Boolean
Setting this to true will prevent the object from appearing
when the visual debug mode in the debugger overlay is toggled on. | FlxPath | ||
| manager : DebugPathDisplay [static] [read-only] | FlxPath | ||
| nodes : Array
The list of FlxPoints that make up the path data. | FlxPath | ||
| Property | Defined By | ||
|---|---|---|---|
| _point : FlxPoint
Internal helper for keeping new variable instantiations under control. | FlxPath | ||
| Method | Defined By | ||
|---|---|---|---|
FlxPath(Nodes:Array = null)
Instantiate a new path object. | FlxPath | ||
add(X:Number, Y:Number):void
Add a new node to the end of the path at the specified location. | FlxPath | ||
addAt(X:Number, Y:Number, Index:uint):void
Add a new node to the path at the specified location and index within the path. | FlxPath | ||
Sometimes its easier or faster to just pass a point object instead of separate X and Y coordinates. | FlxPath | ||
addPointAt(Node:FlxPoint, Index:uint, AsReference:Boolean = false):void
Sometimes its easier or faster to just pass a point object instead of separate X and Y coordinates. | FlxPath | ||
destroy():void
Clean up memory. | FlxPath | ||
While this doesn't override FlxBasic.drawDebug(), the behavior is very similar. | FlxPath | ||
Get the first node in the list. | FlxPath | ||
Remove a node from the path. | FlxPath | ||
Remove a node from the path using the specified position in the list of path nodes. | FlxPath | ||
Get the last node in the list. | FlxPath | ||
| _point | property |
protected var _point:FlxPointInternal helper for keeping new variable instantiations under control.
| debugColor | property |
public var debugColor:uintSpecify a debug display color for the path. Default is white.
| debugScrollFactor | property |
public var debugScrollFactor:FlxPointSpecify a debug display scroll factor for the path. Default is (1,1). NOTE: does not affect world movement! Object scroll factors take care of that.
| ignoreDrawDebug | property |
public var ignoreDrawDebug:BooleanSetting this to true will prevent the object from appearing when the visual debug mode in the debugger overlay is toggled on.
The default value is false.
| manager | property |
manager:DebugPathDisplay [read-only] public static function get manager():DebugPathDisplay| nodes | property |
public var nodes:Array
The list of FlxPoints that make up the path data.
| FlxPath | () | Constructor |
public function FlxPath(Nodes:Array = null)Instantiate a new path object.
ParametersNodes:Array (default = null) — Optional, can specify all the points for the path up front if you want.
|
| add | () | method |
public function add(X:Number, Y:Number):voidAdd a new node to the end of the path at the specified location.
Parameters
X:Number — X position of the new path point in world coordinates.
| |
Y:Number — Y position of the new path point in world coordinates.
|
| addAt | () | method |
public function addAt(X:Number, Y:Number, Index:uint):voidAdd a new node to the path at the specified location and index within the path.
Parameters
X:Number — X position of the new path point in world coordinates.
| |
Y:Number — Y position of the new path point in world coordinates.
| |
Index:uint — Where within the list of path nodes to insert this new point.
|
| addPoint | () | method |
public function addPoint(Node:FlxPoint, AsReference:Boolean = false):void
Sometimes its easier or faster to just pass a point object instead of separate X and Y coordinates.
This also gives you the option of not creating a new node but actually adding that specific
FlxPoint object to the path. This allows you to do neat things, like dynamic paths.
Parameters
Node:FlxPoint — The point in world coordinates you want to add to the path.
| |
AsReference:Boolean (default = false) — Whether to add the point as a reference, or to create a new point with the specified values.
|
| addPointAt | () | method |
public function addPointAt(Node:FlxPoint, Index:uint, AsReference:Boolean = false):void
Sometimes its easier or faster to just pass a point object instead of separate X and Y coordinates.
This also gives you the option of not creating a new node but actually adding that specific
FlxPoint object to the path. This allows you to do neat things, like dynamic paths.
Parameters
Node:FlxPoint — The point in world coordinates you want to add to the path.
| |
Index:uint — Where within the list of path nodes to insert this new point.
| |
AsReference:Boolean (default = false) — Whether to add the point as a reference, or to create a new point with the specified values.
|
| destroy | () | method |
public function destroy():voidClean up memory.
| drawDebug | () | method |
public function drawDebug(Camera:FlxCamera = null):void
While this doesn't override FlxBasic.drawDebug(), the behavior is very similar.
Based on this path data, it draws a simple lines-and-boxes representation of the path
if the visual debug mode was toggled in the debugger overlay. You can use debugColor
and debugScrollFactor to control the path's appearance.
Parameters
Camera:FlxCamera (default = null) — The camera object the path will draw to.
|
| head | () | method |
public function head():FlxPointGet the first node in the list.
ReturnsFlxPoint — The first node in the path.
|
| remove | () | method |
public function remove(Node:FlxPoint):FlxPoint
Remove a node from the path.
NOTE: only works with points added by reference or with references from nodes itself!
Parameters
Node:FlxPoint — The point object you want to remove from the path.
|
FlxPoint — The node that was excised. Returns null if the node was not found.
|
| removeAt | () | method |
public function removeAt(Index:uint):FlxPointRemove a node from the path using the specified position in the list of path nodes.
Parameters
Index:uint — Where within the list of path nodes you want to remove a node.
|
FlxPoint — The node that was excised. Returns null if there were no nodes in the path.
|
| tail | () | method |
public function tail():FlxPointGet the last node in the list.
ReturnsFlxPoint — The last node in the path.
|