After one player in my two-player-game has been defeated, the gameover-screen appears, but also the console opens and tells me that there must be an issue with my collider-method. Here it is:
Thanks in advance
public void playerCollider()
{
if(isTouching(Player.class)) {
playerContact = true;
Actor oPlayer = (Actor) getOneIntersectingObject(Player.class);
int oPlayerX = oPlayer.getX();
int oPlayerY = oPlayer.getY();
double k = 1.5 * currentForce;
int angle = getRotation();
if (oPlayerX > getX()) {
if(oPlayerY < getY()) {
xVel = (-1) * (k) * Math.cos(Math.toRadians(360-angle));
yVel = (1) * (k) * Math.sin(Math.toRadians(360-angle));
}
else {
xVel = (1) * (k) * Math.cos(Math.toRadians(angle-180));
yVel = (1) * (k) * Math.sin(Math.toRadians(angle-180));
}
}
else {
if(oPlayerY < getY()) {
xVel = (1) * (k) * Math.cos(Math.toRadians(180-angle));
yVel = (-1) * (k) * Math.sin(Math.toRadians(180-angle));
}
else {
xVel = (-1) * (k) * Math.cos(Math.toRadians(angle));
yVel = (-1) * (k) * Math.sin(Math.toRadians(angle));
}
}
}
else {
playerContact = false;
}
}
