I’m am pretty sure my code is right but it is not working. Any help?
hile(true) {
var enemy = hero.findNearestEnemy();
if(enemy) {
// Find the distance to the enemy with distanceTo.
var distance = hero.distanceTo(enemy);
// If the distance is less than 5 meters...
if (distance < 5) {
}
// ... if "cleave" is ready, cleave!
if (hero.isReady('cleave')) {
hero.cleave(enemy);
}
// ... else, just attack.
else {
hero.attack(enemy);
}
}
}