com.b3dgs.lionengine.game.pathfinding
Class ClosestSquaredHeuristic
java.lang.Object
com.b3dgs.lionengine.game.pathfinding.ClosestSquaredHeuristic
- All Implemented Interfaces:
- AStarHeuristic
public class ClosestSquaredHeuristic
- extends java.lang.Object
- implements AStarHeuristic
A heuristic that uses the tile that is closest to the target as the next best tile.
In this case the sqrt is removed and the distance squared is used instead
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ClosestSquaredHeuristic
public ClosestSquaredHeuristic()
getCost
public float getCost(PathBasedMap<? extends AbstractPathTile> map,
Pathfindable mover,
int x,
int y,
int tx,
int ty)
- Description copied from interface:
AStarHeuristic
- This controls the order in which tiles are searched while attempting to find a path to the target location.
The lower the cost the more likely the tile will be searched.
- Specified by:
getCost
in interface AStarHeuristic
- Parameters:
map
- map on which the path is being found.mover
- entity that is moving along the path.x
- x coordinate of the tile being evaluated.y
- y coordinate of the tile being evaluated.tx
- x coordinate of the target location.ty
- y coordinate of the target location.
- Returns:
- cost associated with the given tile.