Play Home Contribute GitHub Join Us Discourse Staff Members GitHub Contribution Guides Team

Having trouble on Agrippa Refactored (JavaScript)


#1

please help this is my code
function cleaveOrAttack(enemy) {
// If “cleave” is ready, cleave; otherwise, attack.
if (hero.isReady(“cleave”)) {
hero.cleave(enemy);
} else {
hero.attack(enemy);
}
}
while (true) {
var enemy = hero.findNearestEnemy();
if (enemy) {
var distance = hero.distanceTo(enemy);
if (distance < 5) {
// Call the “cleaveOrAttack” function, defined above.
cleaveOrAttack(enemy);
}
}
}

can someone please tell me what i’m doing wrong


#2

Please format your code according to the FAQ. Also send a screenshot with more info about your problem