Class AStarGrid
java.lang.Object
de.gurkenlabs.litiengine.entities.behavior.AStarGrid
- All Implemented Interfaces:
IRenderable
public class AStarGrid
extends java.lang.Object
implements IRenderable
Field Summary
Fields Modifier and Type Field Description static double
PENALTY_NOT_WALKABLE_NEIGHBOR
static double
PENALTY_STATIC_PROP
Constructor Summary
Method Summary
Modifier and Type Method Description protected void
assignPenalty(AStarNode node)
AStarNode[][]
getGrid()
java.util.List<AStarNode>
getIntersectedNodes(java.awt.geom.Rectangle2D rectangle)
java.util.List<AStarNode>
getNeighbors(AStarNode node)
AStarNode
getNode(double x, double y)
AStarNode
getNode(java.awt.geom.Point2D point)
int
getNodeSize()
java.awt.Dimension
getSize()
boolean
isDiagonalCornerMovementAllowed()
boolean
isDiagonalMovementAllowed()
void
render(java.awt.Graphics2D g)
Renders the visual contents of this instance onto the provided graphics context.void
setAllowCuttingCorners(boolean allowCuttingCorners)
void
setAllowDiagonalMovement(boolean allowDiagonalMovement)
void
updateWalkable(java.awt.geom.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:
- Constant Field Values
PENALTY_NOT_WALKABLE_NEIGHBOR
public static final double PENALTY_NOT_WALKABLE_NEIGHBOR- See Also:
- Constant Field Values
Constructor Details
Method Details
isDiagonalMovementAllowed
public boolean isDiagonalMovementAllowed()isDiagonalCornerMovementAllowed
public boolean isDiagonalCornerMovementAllowed()getGrid
getIntersectedNodes
getNeighbors
getNode
getNode
getNodeSize
public int getNodeSize()getSize
public java.awt.Dimension getSize()render
public void render(java.awt.Graphics2D g)Description copied from interface:IRenderable
Renders the visual contents of this instance onto the provided graphics context.If an
Entity
implements 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:
render
in interfaceIRenderable
- Parameters:
g
- The current graphics object onto which this instance will render its visual contents.- See Also:
RenderEngine.renderEntity(Graphics2D, de.gurkenlabs.litiengine.entities.IEntity)
setAllowDiagonalMovement
public void setAllowDiagonalMovement(boolean allowDiagonalMovement)setAllowCuttingCorners
public void setAllowCuttingCorners(boolean allowCuttingCorners)updateWalkable
public void updateWalkable(java.awt.geom.Rectangle2D rectangle)Updates the walkable attribute of nodes intersected by the specified rectangle.- Parameters:
rectangle
- The rectangle within which the nodes should be updated.
assignPenalty