Interface TileMap

  • All Known Implementing Classes:
    CollisionMap

    public interface TileMap
    Created with IntelliJ IDEA.
    Since:
    : 3/28/2015 Time : 2:03 PM
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      int getBaseX()
      Returns the base X coordinate for this collision map.
      int getBaseY()
      Returns the base Y coordinate for this collision map.
      float getCost​(int sx, int sy, int tx, int ty)
      Get the cost of moving through the given tile.
      int getDirection​(int x, int y)
      Retrieves the direction of the given x-y coordinates as a CollisionMap Flag.
      int getFlag​(int gridX, int gridY)
      Gets collision flag for the given grid location.
      int getHeight()
      Get the height of the tile map.
      int getWidth()
      Get the width of the tile map.
      boolean isSolid​(int x, int y)
      Check if the given location is blocked, i.values.
      boolean isSolid​(int x, int y, int flag)
      Check if the given location is blocked, i.values.
      boolean isWalkable​(int x1, int y1, int x2, int y2)
      Check if the given location is walkable, i.values.
      boolean isWalkable​(int x1, int y1, int x2, int y2, int flag)
      Check if the given location is walkable, i.values.
      void visit​(int x, int y)
      Notification that the path finder visited a given tile.
    • Method Detail

      • getWidth

        int getWidth()
        Get the width of the tile map. The slightly odd name is used to distinguish this method from commonly used names in game maps.
        Returns:
        The number of tiles across the map
      • getHeight

        int getHeight()
        Get the height of the tile map. The slightly odd name is used to distinguish this method from commonly used names in game maps.
        Returns:
        The number of tiles down the map
      • isSolid

        boolean isSolid​(int x,
                        int y)
        Check if the given location is blocked, i.values. blocks movement of the supplied mover.
        Parameters:
        x - The x coordinate of the tile to check
        y - The y coordinate of the tile to check
        Returns:
        True if the location is blocked
      • isSolid

        boolean isSolid​(int x,
                        int y,
                        int flag)
        Check if the given location is blocked, i.values. blocks movement of the supplied mover.
        Parameters:
        x - The x coordinate of the tile to check
        y - The y coordinate of the tile to check
        flag - The flag of the tile to check
        Returns:
        True if the location is blocked
      • isWalkable

        boolean isWalkable​(int x1,
                           int y1,
                           int x2,
                           int y2)
        Check if the given location is walkable, i.values. no blocked movement.
        Parameters:
        x1 - The x coordinate of the start tile to check
        y1 - The y coordinate of the start tile to check
        x2 - The x coordinate of the destination tile to check
        y2 - The y coordinate of the destination tile to check
        Returns:
        true, if the destination is walkable.
      • isWalkable

        boolean isWalkable​(int x1,
                           int y1,
                           int x2,
                           int y2,
                           int flag)
        Check if the given location is walkable, i.values. no blocked movement.
        Parameters:
        x1 - The x coordinate of the start tile to check
        y1 - The y coordinate of the start tile to check
        x2 - The x coordinate of the destination tile to check
        y2 - The y coordinate of the destination tile to check
        flag - The flag of the destination tile to check
        Returns:
        true, if the destination is walkable.
      • getCost

        float getCost​(int sx,
                      int sy,
                      int tx,
                      int ty)
        Get the cost of moving through the given tile. This can be used to make certain areas more desirable. A simple and valid implementation of this method would be to return 1 in all cases.
        Parameters:
        sx - The x coordinate of the tile we're moving from
        sy - The y coordinate of the tile we're moving from
        tx - The x coordinate of the tile we're moving to
        ty - The y coordinate of the tile we're moving to
        Returns:
        The relative cost of moving across the given tile
      • visit

        void visit​(int x,
                   int y)
        Notification that the path finder visited a given tile. This is used for debugging new heuristics.
        Parameters:
        x - The x coordinate of the tile that was visited
        y - The y coordinate of the tile that was visited
      • getDirection

        int getDirection​(int x,
                         int y)
        Retrieves the direction of the given x-y coordinates as a CollisionMap Flag.
        Parameters:
        x - The x coordinate
        y - The y coordinate
      • getFlag

        int getFlag​(int gridX,
                    int gridY)
        Gets collision flag for the given grid location.
        Parameters:
        gridX - the x coordinate on the grid.
        gridY - the y coordinate on the grid.
        Returns:
        the collision flag for the given tile.
      • getBaseX

        int getBaseX()
        Returns the base X coordinate for this collision map.
        Returns:
        the base X coordinate for this collision map if valid, otherwise -1;
      • getBaseY

        int getBaseY()
        Returns the base Y coordinate for this collision map.
        Returns:
        the base Y coordinate for this collision map if valid, otherwise -1;