Class AStarGrid
java.lang.Object
de.gurkenlabs.litiengine.entities.behavior.AStarGrid
- All Implemented Interfaces:
IRenderable
public class AStarGrid
extends java.lang.Object
implements IRenderableField Summary
Fields Modifier and Type Field Description static doublePENALTY_NOT_WALKABLE_NEIGHBORstatic doublePENALTY_STATIC_PROPConstructor Summary
Method Summary
Modifier and Type Method Description protected voidassignPenalty(AStarNode node)AStarNode[][]getGrid()java.util.List<AStarNode>getIntersectedNodes(java.awt.geom.Rectangle2D rectangle)java.util.List<AStarNode>getNeighbors(AStarNode node)AStarNodegetNode(double x, double y)AStarNodegetNode(java.awt.geom.Point2D point)intgetNodeSize()java.awt.DimensiongetSize()booleanisDiagonalCornerMovementAllowed()booleanisDiagonalMovementAllowed()voidrender(java.awt.Graphics2D g)Renders the visual contents of this instance onto the provided graphics context.voidsetAllowCuttingCorners(boolean allowCuttingCorners)voidsetAllowDiagonalMovement(boolean allowDiagonalMovement)voidupdateWalkable(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: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:
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
