I assume you are using Box2D Physics extension in AndEngine.
- Design your level as you wish, paint tiles in the Map layer.
- Create an object layer and set a "wall" or "ground" property to it. Use rectangles to draw ground.
In your code, iterate through the these rectangles and create physics invisible objects that will serve as ground. Something like this:
for (TMXObjectGroup tog : tmxMap.getTMXObjectGroups()) {
if (tog.getTMXObjectGroupProperties().containsTMXProperty(
"type", "wall")) {
for (TMXObject to : tog.getTMXObjects()) {
final Rectangle wall = createWall(to);
scene.attachChild(wall);
}
}
}
I use exactly this and the following method to create the walls (not just ground).
private Rectangle createWall(TMXObject to) {
final Rectangle wall = createPhysicsRectangle(to);
wall.setVisible(false);
PhysicsFactory.createBoxBody(physics, wall, BodyType.StaticBody, Constants.WALL_FIXTURE);
return wall;
}
In my case Constants.WALL_FIXTURE
is a non-elastic, high-friction, no mass fixture.