java.lang.Object
de.gurkenlabs.litiengine.entities.behavior.AStarGrid
All Implemented Interfaces:
IRenderable

public class AStarGrid extends Object implements IRenderable
  • 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

      public AStarGrid(Dimension size, int nodeSize)
  • Method Details

    • isDiagonalMovementAllowed

      public boolean isDiagonalMovementAllowed()
    • isDiagonalCornerMovementAllowed

      public boolean isDiagonalCornerMovementAllowed()
    • getGrid

      public AStarNode[][] getGrid()
    • getIntersectedNodes

      public List<AStarNode> getIntersectedNodes(Rectangle2D rectangle)
    • getNeighbors

      public List<AStarNode> getNeighbors(AStarNode node)
    • getNode

      public AStarNode getNode(Point2D point)
    • getNode

      public AStarNode getNode(double x, double y)
    • getNodeSize

      public int getNodeSize()
    • getSize

      public Dimension getSize()
    • render

      public void render(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 interface IRenderable
      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

      public void updateWalkable(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

      protected void assignPenalty(AStarNode node)