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.
I am not that familiar with doing something like this in libgdx. Although i'm sure it is not that complicated.
Is there anyway i can do this in LibGDX?
EDIT:
Here is what i have so far.
QueryCallback callback = new QueryCallback() {
@Override
public boolean reportFixture(Fixture fixture) {
// if the hit fixture's body is the ground body
// we ignore it
// if the hit point is inside the fixture of the body
// we report it
hitBody = fixture.getBody();
return true;
}
};
@Override
public boolean touchUp(int screenX, int screenY, int pointer, int button) {
// TODO Auto-generated method stub
hitBody = null;
return false;
}
Now i am just not sure how i remove the body that was clicked..