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\$
2
  • \$\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\$
    – House
    Commented Sep 30, 2013 at 13:23
  • 1
    \$\begingroup\$ I would like to point here: gamedev.stackexchange.com/questions/27113/… \$\endgroup\$
    – jgallant
    Commented Sep 30, 2013 at 14:13

1 Answer 1

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\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .