I have this method which should move the enemy to the hero when is attacked but it moves all the enemies and not the only one attacked.What should I do?
void checkForEnemyTrigger()
{
int dx = getDistanceX(this.getX(), hero.getX());
int dy = getDistanceY(this.getY(), hero.getY());
if((hero.getAttacked()) && (dx > attackRange || dy > attackRange || dx < -attackRange || dy < -attackRange))
{
turnTowards(hero.getX(), hero.getY());
move(speed);
}
}

