[0] -> x position of startPoint [1]`-> y position of startPoint
private var startPoint: Array
[0] -> x position of endPoint [1]`-> y position of endPoint
private var endPoint: Array
A 2 dimensional map containing references to all tiles
private var map: Array
The standard cost of the tile.
public static var standardCost: Number
The diagonal cost of the tile.
public static var diagonalCost: Number
The height of the map
private var mapH: Number
The width of the map
private var mapW: Number
A binary heap containing the tiles
private var heap: BinaryHeap
private var mf: Function
The kind of clipping to be used.
private var clippingMode: String
Constructor
public function Astar()
Set the map for the engine
public function setMap( _map: Array ):Void
Build a new Map
public function newMap( w: Number, h: Number ):Void
Set the starting point (player position) for the engine
public function setStartPoint( x: Number, y: Number ):Void
Set the clipping mode.
public function setClipping( cl: String ):Void
Set the end point for the engine.
public function setEndPoint( x: Number, y: Number ):Void
find a path from the startPoint to the endPoint in the given map
public function findPath():Object
find the surrounding tiles of the given tile.
private function findSurroundingTiles( current: Tile ):Array
Check whether or not all the settings are correct
private function ready():Boolean
Define the cost of the given tile
public function setCost( x: Number, y: Number, c: Number ):Void
Toggle the tile to be walkable or not
public function setWalkable( x: Number, y: Number, b: Boolean ):Void
Toggle the tile to be walkable or not
public function toggleWalkable( x: Number, y: Number ):Void
Opens the map (resets all the tiles)
private function openMap()
Sets the standard cost for the map.
public function setStandardCost( c: Number ):Void
Sets the extra cost for going diagonal.
public function setDiagonalCost( c: Number ):Void