我正在使用 TMX 地图中的平铺地图在 andEngine 中开发游戏我有河流对象,我希望玩家在落入河流后会死
但我不知道如何实现这个
我只能使用以下代码创建墙对象:
private void createUnwalkableObjects(TMXTiledMap map)
{
// Loop through the object groups
for(final TMXObjectGroup group: this.mTMXTiledMap.getTMXObjectGroups())
{
if(group.getTMXObjectGroupProperties().containsTMXProperty("wall", "true"))
{
// This is our "wall" layer. Create the boxes from it
for(final TMXObject object : group.getTMXObjects())
{
final Rectangle rect = new Rectangle(object.getX(), object.getY(),object.getWidth(), object.getHeight());
final FixtureDef boxFixtureDef = PhysicsFactory.createFixtureDef(0, 0, 1f);
PhysicsFactory.createBoxBody(mPhysicsWorld, rect, BodyType.StaticBody, boxFixtureDef);
rect.setVisible(false);
mScene.attachChild(rect);
}
}
}
}
提前致谢