/**
* Test if a player bullet hit an ennemy
*/
if(contact.getFixtureA().getFilterData().categoryBits == Category.PLAYER_BULLET.getValue() && contact.getFixtureB().getFilterData().categoryBits == Category.ENNEMY.getValue()){
AbstractShip ship = (AbstractShip) contact.getFixtureB().getBody().getUserData();
Bullet bullet = (Bullet) contact.getFixtureA().getBody().getUserData();
ship.isHit(bullet);
bullet.hit();
}
if(contact.getFixtureB().getFilterData().categoryBits == Category.PLAYER_BULLET.getValue() && contact.getFixtureA().getFilterData().categoryBits == Category.ENNEMY.getValue()){
AbstractShip ship = (AbstractShip) contact.getFixtureA().getBody().getUserData();
Bullet bullet = (Bullet) contact.getFixtureB().getBody().getUserData();
ship.isHit(bullet);
bullet.hit();
}
/**
* Test if ennemy bullet hit the player
*/
if(contact.getFixtureB().getFilterData().categoryBits == Category.ENNEMY_BULLET.getValue() && contact.getFixtureA().getFilterData().categoryBits == Category.PLAYER.getValue()){
AbstractShip ship = (AbstractShip) contact.getFixtureA().getBody().getUserData();
Bullet bullet = (Bullet) contact.getFixtureB().getBody().getUserData();
ship.isHit(bullet);
bullet.hit();
}
if(contact.getFixtureB().getFilterData().categoryBits == Category.ENNEMY_BULLET.getValue() && contact.getFixtureA().getFilterData().categoryBits == Category.PLAYER.getValue()){
AbstractShip ship = (AbstractShip) contact.getFixtureA().getBody().getUserData();
Bullet bullet = (Bullet) contact.getFixtureB().getBody().getUserData();
ship.isHit(bullet);
bullet.hit();
}
/**
* Test if bullet hit a boss
*/
if(contact.getFixtureB().getFilterData().categoryBits == Category.PLAYER_BULLET.getValue() && contact.getFixtureA().getFilterData().categoryBits == Category.BOSS.getValue()){
AbstractShip ship = (AbstractShip) contact.getFixtureA().getBody().getUserData();
Bullet bullet = (Bullet) contact.getFixtureB().getBody().getUserData();
ship.isHit(bullet);
bullet.hit();
}
if(contact.getFixtureB().getFilterData().categoryBits == Category.PLAYER_BULLET.getValue() && contact.getFixtureA().getFilterData().categoryBits == Category.BOSS.getValue()){
AbstractShip ship = (AbstractShip) contact.getFixtureA().getBody().getUserData();
Bullet bullet = (Bullet) contact.getFixtureB().getBody().getUserData();
ship.isHit(bullet);
bullet.hit();
}
/**
* Test if ennemy hit the player
*/