本文整理汇总了Java中org.newdawn.slick.util.pathfinding.TileBasedMap.getHeightInTiles方法的典型用法代码示例。如果您正苦于以下问题:Java TileBasedMap.getHeightInTiles方法的具体用法?Java TileBasedMap.getHeightInTiles怎么用?Java TileBasedMap.getHeightInTiles使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.newdawn.slick.util.pathfinding.TileBasedMap
的用法示例。
在下文中一共展示了TileBasedMap.getHeightInTiles方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: build
import org.newdawn.slick.util.pathfinding.TileBasedMap; //导入方法依赖的package包/类
/**
* Build a navigation mesh based on a tile map
*
* @param map The map to build the navigation mesh from
* @param tileBased True if we'll use the tiles for the mesh initially
* rather than quad spacing
* @return The newly created navigation mesh
*/
public NavMesh build(TileBasedMap map, boolean tileBased) {
this.tileBased = tileBased;
ArrayList spaces = new ArrayList();
if (tileBased) {
for (int x=0;x<map.getWidthInTiles();x++) {
for (int y=0;y<map.getHeightInTiles();y++) {
if (!map.blocked(this, x, y)) {
spaces.add(new Space(x,y,1,1));
}
}
}
} else {
Space space = new Space(0,0,map.getWidthInTiles(),map.getHeightInTiles());
subsection(map, space, spaces);
}
while (mergeSpaces(spaces)) {}
linkSpaces(spaces);
return new NavMesh(spaces);
}