I'm developing a game by andengine. I want my player can jump only one time. So I used contact listner.but it doesn't always work.mostly works but not always. Check the codes and tell me the my error please.
I have player object.and ten box2d static object.I didn't understand how can this contact listener detect collision between player and these box. Because I have other boxes too.for example: player, square and circle. why this contact listener detect between player and square? why not between circle and square?
private ContactListener contactListener()
{
ContactListener contactListener = new ContactListener()
{
@Override
public void beginContact(Contact contact)
{
player.setJumping(false);
}
@Override
public void endContact(Contact contact)
{
player.setJumping(true);
}
};
return contactListener;
}