The data used by Pathfinders to "solve" a single pathfinding request. A new Instance gets created whenever you request pathfinder computations. Extend this class if your pathfinding needs require special iterative data.

Available since

5.0.0

.

Constructor

new(map:Tilemap, startIndex:Int, endIndex:Int)

Mainly a helper class for FlxTilemapPathPolicy. Used to store data while the paths are computed, but also useful for analyzing the data once it's done somputing.

Parameters:

mapSize

The total number of tiles in the map

startIndex

The start index of the path

endIndex

The end index of the path

Variables

read onlydistances:Array<Int>

The distance of every tile from the starting position

read onlyendIndex:Int

The end index of path

read onlyexcluded:Array<Int>

Every index has the tileIndex that reached it first while computing the path

read onlyfoundEnd:Bool

Whether a path from startIndex to endIndex was found

read onlymap:Tilemap

The end index of path

read onlymoves:Array<Int>

Every index has the tileIndex that reached it first while computing the path

read onlystartIndex:Int

The start index of path

Methods

inlinegetPathIndices():Null<Array<Int>>

If the desired start to end path was successful, this returns the tile indices used to get there the fastest. If unsuccessful, null is returned.

getPathIndicesTo(index:Int):Null<Array<Int>>

If possible, this returns the tile indices used to get there the fastest. If impossible, null is returned.