Hello Everyone,
I have a problem with my enemy movement. Basically when the player is to the right and/or below the enemy, the enemy doesn’t move towards the player. but if it is above and/or to the left of the enemy it moves towards the player. I cant seem to figure out whats wrong. Could you help. Thanks
if(isMoving && shouldAttack){
if(player.getX() < getX()){
dx -= moveSpeed;
}
if(player.getY() < getY()){
dy -= moveSpeed;
}
if(player.getX() > getX()){
dx += moveSpeed;
}
if(player.getY() > getY()){
dy += moveSpeed;
}
}
-GlennBrann