public class Conntact implements ContactListener {
@Override
public void beginContact(Contact contact) {
Fixture fa = contact.getFixtureA();
Fixture fb = contact.getFixtureB();
if (fa.getFilterData().categoryBits==16){
((Gamescreen)fa.getUserData()).starttouch(fa,fb);
}
@Override
public void endContact(Contact contact) {
Fixture fa = contact.getFixtureA();
Fixture fb = contact.getFixtureB();
if (fa.getFilterData().categoryBits==16)
{
((Gamescreen)fa.getUserData()).endtouch();
}
this code works fine when there is just one object to touch but some time i need to make like tow object beside of each others.
like when the player walk on 2 objects (without jumping) beside each others the second method (endcontact
) called but the first method (begincontact
) does not get call again.