Hello together,
at the moment i load a tiledmap(.tmx), create a world(com.badlogic.gdx.physics.box2d.World). Inside the world i render the shapes, like polygon or circle shape. After changing the map(.tmx), map will dispose and i want to recreate a new world.
- Is it needed to instantiate a complete new world?
- What is the correct dispose-order?
My dispose-order make some trouble with my player, he is the only one he wont dispose after changing map(.tmx).
- In my render method i will update at first world.step
mapMgr.getBox2dWorld().getWorld().step(1 / 60f, 6, 2);
- All bodies will dispose except the players body
for (int i = 0; i < bodies.size; i++) {
mapMgr.getBox2dWorld().getWorld().destroyBody(bodies.get(i));
Body body = bodies.get(i);
body = null;
}
map.dispose();
world = new World(new Vector2(0, 0), true);
But after this the new map is loaded correctly , shapes are rendered in the right way but my player isnt able to move and his circle shape is missing.
Thx for review this and your help.