0
\$\begingroup\$

I am using LibGDX to create a new project.

What i am trying to do is, i load bodies from a tmx file into levels which works fine. The bodies also has a sprite with them.

The problem is, is i would like to allow the user to touch certain bodies on the scene. When they touch the body they will be able to delete or remove it from the scene.

Is there anyway i can do this in LibGDX?

\$\endgroup\$
  • \$\begingroup\$ This is just a combination of detecting touches and removing bodies. Break the problem down and search for the component tasks, you'll find your answers pretty quick. \$\endgroup\$ – MichaelHouse Sep 30 '13 at 13:23
  • 1
    \$\begingroup\$ I would like to point here: gamedev.stackexchange.com/questions/27113/… \$\endgroup\$ – jgallant Sep 30 '13 at 14:13
1
\$\begingroup\$

You need to remove the object from Box2D and from libGDX's render. The first task could be done with "destroyBody" method of World class. The second depends on what kind of rendering objects your are using. If you are using "Actors" just call "removeActor" on the parent of oyr render object.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.