# TileBasedMap (Slick - The 2D Library)
Date: 2013-06-03

## org.newdawn.slick.util.pathfinding
Interface TileBasedMap

    public interface TileBasedMap

The description for the data we're pathfinding over. This provides the contract between the data being searched (i.e. the in game map) and the path finding generic tools

Author:
  Kevin Glass

Method Summary
`boolean` `blocked(PathFindingContext context, int tx, int ty)` Check if the given location is blocked, i.e.
`float` `getCost(PathFindingContext context, int tx, int ty)` Get the cost of moving through the given tile.
`int` `getHeightInTiles()` Get the height of the tile map.
`int` `getWidthInTiles()` Get the width of the tile map.
`void` `pathFinderVisited(int x, int y)` Notification that the path finder visited a given tile.

Method Detail

### getWidthInTiles

    int getWidthInTiles()

  Get the width of the tile map. The slightly odd name is used to distiguish this method from commonly used names in game maps.

  Returns:
    The number of tiles across the map

### getHeightInTiles

    int getHeightInTiles()

  Get the height of the tile map. The slightly odd name is used to distiguish this method from commonly used names in game maps.

  Returns:
    The number of tiles down the map

### pathFinderVisited

    void pathFinderVisited(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

### blocked

    boolean blocked(PathFindingContext context,
                    int tx,
                    int ty)

  Check if the given location is blocked, i.e. blocks movement of the supplied mover.

  Parameters:
    `context` - The context describing the pathfinding at the time of this request
    `tx` - The x coordinate of the tile we're moving to
    `ty` - The y coordinate of the tile we're moving to
  Returns:
    True if the location is blocked

### getCost

    float getCost(PathFindingContext context,
                  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:
    `context` - The context describing the pathfinding at the time of this request
    `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

Copyright © 2006 New Dawn Software. All Rights Reserved.