| Package | be.dauntless.astar.basic2d |
| Class | public class Map |
| Inheritance | Map Object |
| Implements | IMap |
| Property | Defined By | ||
|---|---|---|---|
| heuristic : String
Returns the heuristic that is currently being used
| Map | ||
| Method | Defined By | ||
|---|---|---|---|
Map(width:int, length:int, defaultCost:int = 1)
Creates a new Map object with the specified width en height
| Map | ||
Returns the distance between two tiles. | Map | ||
Returns the heuristic for the given start tile to the end. | Map | ||
Returns a list with the neighbours of the given tile. | Map | ||
getTileAt(position:Point):IPositionTile
Returns the IPositionTile at the given location
| Map | ||
Checks if the given points are diagonal to eachother. | Map | ||
setTile(tile:IPositionTile):void
Sets the given tile at the given location
| Map | ||
| Constant | Defined By | ||
|---|---|---|---|
| DIAGONAL_HEURISTIC : String = diagonalHeuristic [static]
Diagonal heuristic. | Map | ||
| MANHATTAN_HEURISTIC : String = manhattanHeuristic [static]
Horizontal heuristic. | Map | ||
| NO_HEURISTIC : String = noHeuristic [static]
No heuristic. | Map | ||
| heuristic | property |
heuristic:StringReturns the heuristic that is currently being used
public function get heuristic():String public function set heuristic(value:String):void| Map | () | Constructor |
public function Map(width:int, length:int, defaultCost:int = 1)Creates a new Map object with the specified width en height
Parameterswidth:int — The width of the map
| |
length:int — The height of the map
| |
defaultCost:int (default = 1) |
| getDistance | () | method |
public function getDistance(fromTile:IAstarTile, toTile:IAstarTile):NumberReturns the distance between two tiles. This distance is multiplied with the cost of the target tile to get its final G cost.
Parameters
fromTile:IAstarTile | |
toTile:IAstarTile |
Number |
| getHeuristic | () | method |
public function getHeuristic(tile:IAstarTile, req:PathRequest):NumberReturns the heuristic for the given start tile to the end.
Parameters
tile:IAstarTile | |
req:PathRequest |
Number |
| getNeighbours | () | method |
public function getNeighbours(tile:IAstarTile):Vector.<IAstarTile>Returns a list with the neighbours of the given tile.
Parameters
tile:IAstarTile — The position of the tile to get the neighbours of
|
Vector.<IAstarTile> — A Vector containing all the neighbouring tiles
|
| getTileAt | () | method |
public function getTileAt(position:Point):IPositionTileReturns the IPositionTile at the given location
Parameters
position:Point — The point specifing the location for the tile
|
IPositionTile — IPositionTile at the given location
|
| isDiagonal | () | method |
public function isDiagonal(from:IAstarTile, to:IAstarTile):BooleanChecks if the given points are diagonal to eachother.
Parameters
from:IAstarTile — The first point
| |
to:IAstarTile — The second point
|
Boolean — A boolean indicating if the given tiles are diagonal to eachother
|
| setTile | () | method |
public function setTile(tile:IPositionTile):voidSets the given tile at the given location
Parameters
tile:IPositionTile — The tile to place in the map
|
| DIAGONAL_HEURISTIC | Constant |
public static const DIAGONAL_HEURISTIC:String = diagonalHeuristicDiagonal heuristic. The following formula is used: H = Math.max(Math.abs(end.x - start.x), Math.abs(end.y - start.y));
| MANHATTAN_HEURISTIC | Constant |
public static const MANHATTAN_HEURISTIC:String = manhattanHeuristicHorizontal heuristic. This is the manhattan heuristic. The following formula is used: H = (end.x - start.x) + (end.y - start.y)
| NO_HEURISTIC | Constant |
public static const NO_HEURISTIC:String = noHeuristicNo heuristic. When no heuristic is used, Awill behave like a breadth-first search algorithm