I'm trying to do a simple collision with a rectangle. When two objects collide, game resets. With this code, my game resets if an object is hit by another object with a left angle. I'm trying to do if-else statement but I'm not succeeding.
public boolean hitByObstacles(ObstaclesCars obstaclesCars) {
boolean isHit = false;
for (Car car : obstaclesCars.ObstaclesCarsList) {
if (car.position.dst(position) < Constants.HUMANPLAYER_RADIUS) {
isHit = true;
}
}
return isHit;
}
Aucun commentaire:
Enregistrer un commentaire