Search in sources :

Example 1 with Tile

use of org.apollo.cache.map.Tile in project apollo by apollo-rsps.

the class WorldMapDecoder method markTiles.

/**
 * Mark any tiles in the given {@link MapPlane} as blocked or bridged in the {@link CollisionManager}.
 *
 * @param mapX The X coordinate of the map file.
 * @param mapY The Y coordinate of the map file.
 * @param plane The {@link MapPlane} to load tiles from.
 */
private void markTiles(int mapX, int mapY, MapPlane plane) {
    for (int x = 0; x < MapConstants.MAP_WIDTH; x++) {
        for (int y = 0; y < MapConstants.MAP_WIDTH; y++) {
            Tile tile = plane.getTile(x, y);
            Position position = new Position(mapX + x, mapY + y, plane.getLevel());
            if ((tile.getAttributes() & BLOCKED_TILE) == BLOCKED_TILE) {
                collisionManager.block(position);
            }
            if ((tile.getAttributes() & BRIDGE_TILE) == BRIDGE_TILE) {
                collisionManager.markBridged(position);
            }
        }
    }
}
Also used : Position(org.apollo.game.model.Position) Tile(org.apollo.cache.map.Tile)

Aggregations

Tile (org.apollo.cache.map.Tile)1 Position (org.apollo.game.model.Position)1