Here’s my code:
function cleaveWhenClose(target) {
if (hero.distanceTo(target) < 5) {
if (hero.isReady("cleave")) {
hero.cleave(target);
}
} else {
hero.attack(target);
}
}
while (true) {
var enemy = hero.findNearestEnemy();
if (enemy) {
cleaveWhenClose(enemy);
}
}
This is an easy level and I have done it before but I forgot-
@Hydrobolic? or someone??
My items:
It looks like the function’s if and else statements has mistakes.
Looks closer.
It doesn’t matter with your items. Look:
The if and else statements do not match!
Well, match the if and else statements!
move the else down off the bracket im no expert at javascript but i think this is your error
@Vanessa, just indent the “else” by one tab space and youll be good. let me know if you need anything else and if that was the only problem, could you delete the code? otherwise other ppl would easily be able to copy it