0
votes

I am learning libgdx box2d and thus making something like doodle jump. However im having trouble with adding infinite new platforms for player to jump on. My question is is it better to make a new body for every new platform or just attach a new fixture to the same body and what is the best way to draw the same texture on every platform? And also how to dispose old bodies or fixtures so the game doesn't run out of memory? Thanks in advance.

1

1 Answers

0
votes

Definitely create new bodies. That is what the concept of a body is meant for. In order to destroy bodies, call:

world.destroyBody(myBody);

And it will do all the cleanup for you. For the texture rendering, I would create an atlas that contains all the sprites you want to use and create one big buffer object and send that to the GPU and batch all the textures at once.