Agrippa defense

I need help in agrippa defense (Javascript)

this is mi code and I don’t no detected the problem!
loop {
var enemy = this.findNearestEnemy();
if(enemy) {
var distance = this.distanceTo(enemy);
if (distance < 5 ) {
this.isReady(“cleave”);
this.cleave(this.findNearestEnemy());
}
else {
this.attack(enemy);
}
}
}

Hello, Luisa, and welcome to the forums. Please read the FAQ on how to properly format your code.

Help us help you, what happens when you run the code? You tell us there is an error, but what is it?

1 Like

Correctly formatted code is especially helpful on this one, but even with out it I do see an error.

you have “this.isReady(“cleave”);” as if it were a command, instead it needs to be part of an “if”:
if (this.isReady(“cleave”)) {

So that you don’t try to cleave when cleave is not ready. Fix this then if you still have trouble read the FAQ and then post your new code using the correct ```.

1 Like

thank you so much! :smile:

1 Like