I have tried to beat this level for many days now and just canāt seem to do it. It says my line of code regarding āvar distance = hero.distanceTo(target);ā is wrong. Any ideas on how to do it?
(i do not know how to format my code so sorry about that I will try to learn in the future.)
while(true) {
var enemy = hero.findNearestEnemy();
if(enemy) {
// Find the distance to the enemy with distanceTo.
var distance = hero.distanceTo(target);
// If the distance is less than 5 meters...
if (distance<5) {
}
// ... if "cleave" is ready, cleave!
if (enemy) {
var ready = hero.isReady("cleave");
hero.cleave(enemy);
}
// ... else, just attack.
else {
hero.attack(enemy);
}
}
}