private void loadNavigationLayer(TiledMap map, Element element, String layerName){ int width = element.getIntAttribute("width", 0); int height = element.getIntAttribute("height", 0); int[] ids = getTileIds(element, width, height); TiledMapTileSets tilesets = map.getTileSets(); GridCell[][] nodes = new GridCell[width][height]; for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { int id = ids[y * width + x]; TiledMapTile tile = tilesets.getTile(id & ~MASK_CLEAR); GridCell cell = new GridCell(x, height - 1 - y, false); if (tile != null) { MapProperties tileProp = tile.getProperties(); String walkableProp = tileProp.get(navigationProperty, navigationClosedValue, String.class); cell.setWalkable( !walkableProp.equals(navigationClosedValue) ); } nodes[cell.getX()][cell.getY()] = cell; } } NavigationTiledMapLayer layer = new NavigationTiledMapLayer(nodes); layer.setName(layerName); layer.setVisible(false); Element properties = element.getChildByName("properties"); if (properties != null) { loadProperties(layer.getProperties(), properties); } map.getLayers().add(layer); }