All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.mathiewz.slick.util.pathfinding.TileBasedMap Maven / Gradle / Ivy

Go to download

The main purpose of this libraryis to modernize and maintain the slick2D library.

The newest version!
package com.github.mathiewz.slick.util.pathfinding;

/**
 * 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
 */
public interface TileBasedMap {
    /**
     * Get the width of the tile map. The slightly odd name is used
     * to distiguish this method from commonly used names in game maps.
     *
     * @return The number of tiles across the map
     */
    public int getWidthInTiles();

    /**
     * Get the height of the tile map. The slightly odd name is used
     * to distiguish this method from commonly used names in game maps.
     *
     * @return The number of tiles down the map
     */
    public int getHeightInTiles();

    /**
     * Notification that the path finder visited a given tile. This is
     * used for debugging new heuristics.
     *
     * @param x
     *            The x coordinate of the tile that was visited
     * @param y
     *            The y coordinate of the tile that was visited
     */
    public void pathFinderVisited(int x, int y);

    /**
     * Check if the given location is blocked, i.e. blocks movement of
     * the supplied mover.
     *
     * @param context
     *            The context describing the pathfinding at the time of this request
     * @param tx
     *            The x coordinate of the tile we're moving to
     * @param ty
     *            The y coordinate of the tile we're moving to
     * @return True if the location is blocked
     */
    public boolean blocked(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.
     *
     * @param context
     *            The context describing the pathfinding at the time of this request
     * @param tx
     *            The x coordinate of the tile we're moving to
     * @param ty
     *            The y coordinate of the tile we're moving to
     * @return The relative cost of moving across the given tile
     */
    public float getCost(PathFindingContext context, int tx, int ty);
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy