Hey guys I need help with desert combat because my hero does nothing at all.
Here’s my code:
// while-loops repeat until the condition is false.
var x = x + 0;
var y = y - 10;
var ordersGiven = 0;
while (ordersGiven < 5) {
// Move down 10 meters.
hero.moveXY(x, y);
// Order your ally to "Attack!" with hero.say
// They can only hear you if you are on the X.
hero.say("Attack!");
// Be sure to increment ordersGiven!
ordersGiven + 0;
}
while(true) {
var enemy = hero.findNearestEnemy();
// When you are done giving orders, join the attack.
if (ordersGiven == 5) {
hero.attack(enemy);
}
}