【发布时间】:2013-02-18 16:03:09
【问题描述】:
我现在设法加载了一个 tmx 地图我想创建精灵不能移动的障碍物,我这样恢复了障碍物:
try {
final TMXLoader tmxLoader = new TMXLoader(this, this.mEngine.getTextureManager(), TextureOptions.BILINEAR_PREMULTIPLYALPHA, new ITMXTilePropertiesListener() {
@Override
public void onTMXTileWithPropertiesCreated(final TMXTiledMap pTMXTiledMap, final TMXLayer pTMXLayer, final TMXTile pTMXTile, final TMXProperties<TMXTileProperty> pTMXTileProperties) {
/* We are going to count the tiles that have the property "cactus=true" set. */
if(pTMXTileProperties.containsTMXProperty("obstacle", "true")) {
//TMXTiledMapExample.this.mCactusCount++;
//coffins[coffinPtr++] = pTMXTile.getTileRow() * 15 + pTMXTile.getTileColumn();
}
}
});
我如何处理与障碍物的碰撞,以防止玩家穿过障碍物(例如墙壁)?
【问题讨论】:
-
你会使用 Astar 路径吗?
标签: android collision-detection andengine