Class AStarGrid
java.lang.Object
de.gurkenlabs.litiengine.entities.behavior.AStarGrid
- All Implemented Interfaces:
IRenderable
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final doublestatic final double -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidassignPenalty(AStarNode node) AStarNode[][]getGrid()getIntersectedNodes(Rectangle2D rectangle) getNeighbors(AStarNode node) getNode(double x, double y) intgetSize()booleanbooleanvoidrender(Graphics2D g) Renders the visual contents of this instance onto the provided graphics context.voidsetAllowCuttingCorners(boolean allowCuttingCorners) voidsetAllowDiagonalMovement(boolean allowDiagonalMovement) voidupdateWalkable(Rectangle2D rectangle) Updates the walkable attribute of nodes intersected by the specified rectangle.
-
Field Details
-
PENALTY_STATIC_PROP
public static final double PENALTY_STATIC_PROP- See Also:
-
PENALTY_NOT_WALKABLE_NEIGHBOR
public static final double PENALTY_NOT_WALKABLE_NEIGHBOR- See Also:
-
-
Constructor Details
-
AStarGrid
public AStarGrid(int width, int height, int nodeSize) -
AStarGrid
-
-
Method Details
-
isDiagonalMovementAllowed
public boolean isDiagonalMovementAllowed() -
isDiagonalCornerMovementAllowed
public boolean isDiagonalCornerMovementAllowed() -
getGrid
-
getIntersectedNodes
-
getNeighbors
-
getNode
-
getNode
-
getNodeSize
public int getNodeSize() -
getSize
-
render
Description copied from interface:IRenderableRenders the visual contents of this instance onto the provided graphics context.If an
Entityimplements this interface, this method will be called right after the entity was rendered from the environment. Allowing for a custom rendering mechanism.This interface can be implemented in general by anything that should be rendered to the game's screen.
- Specified by:
renderin interfaceIRenderable- Parameters:
g- The current graphics object onto which this instance will render its visual contents.- See Also:
-
setAllowDiagonalMovement
public void setAllowDiagonalMovement(boolean allowDiagonalMovement) -
setAllowCuttingCorners
public void setAllowCuttingCorners(boolean allowCuttingCorners) -
updateWalkable
Updates the walkable attribute of nodes intersected by the specified rectangle.- Parameters:
rectangle- The rectangle within which the nodes should be updated.
-
assignPenalty
-