Hello ,
i can’t solve this level, as the peasant is always walking away to the left. In the end my hero can’t protect him as he is walking to the position 40,37 while the peasent is far away and gets killed by the ogres.
Instead of walking back to the fixed position, i think my hero should walk to the peasent. But how can i get his position?
Here is my Code:
while (true) {
var enemy = hero.findNearestEnemy();
var distance = hero.distanceTo(enemy);
if (distance < 10) {
if (hero.isReady("cleave")) {
hero.cleave(enemy);
} else {
hero.attack(enemy);
}
} else {
hero.moveXY(40, 37);
}
}
Any help would be apreciated.