Hey I need help. I did everything correctly, but it won’t let me pass. My hero keeps on moving y-10 so he keeps attempting to go down and saying “I can’t get there” and “Attack” when he already did that before and all the soldiers already moved in for attack. Here is my code, please tell me what mistakes I need to fix:
// while-loops repeat until the condition is false.
var ordersGiven = 0;
while (ordersGiven<5) {
// Move down 10 meters.
hero.moveXY(10, hero.pos.y-10);
// Order your ally to "Attack!" with hero.say
// They can only hear you if you are on the X.
hero.say("Attack!");
ordersGiven;
}
hero.moveXY(55, 31);
while(true) {
var enemy = hero.findNearestEnemy();
// When you’re done giving orders, join the attack.
if (enemy) {
if (hero.isReady(“cleave”)) {
hero.cleave(enemy);
}
else {
hero.attack(enemy);
}
}
}
Thank you. Please help me I don’t know how others may do it easily while I can’t. I already tried to find the mistake but I can’t.