Munchkin Swarm : Help!

after the second cleave, when it cools down, it stops doing anyything except waiting for the cleave. then i die because i have too less health.

nvm all i did was click submit and it worked. dumb gameeeeeee

@ReFinig

His code worked…

loop:
enemy = self.findNearestEnemy()
self.distanceTo(enemy.pos)
if self.distanceTo(enemy) > 10 :
self.attack(“Chest”)
else:
self.cleave(enemy)
self.attack(enemy)
self.attack(enemy)

Helo, i have a problem with Munchkin Swarm.
this is my code:
Error is "Unchreachable ‘while’ after return.
I’dont know where i can write ‘return’ on this code.
pls help, im stuck :wink:

loop; {
var enemy = this.findNearestEnemy();
var distance = this.distanceTo(enemy);
if (distance < 10 && this.isReady(“cleave”)) {
return this.cleave();
}
else;
{
return this.attack(“Chest”);
}
}

@Sebastian_Gladys remove the return statements from your code. You also have a semicolon after else which shouldn’t be there.

If you die before you can open the chest, you may want to add this.attack(enemy) if cleave isn’t ready.

[redacted, we don’t post correct code]
this should work out fine

Try my code Guys it really works
[redacted, we don’t post correct code]

@Benladin_Aguila-suma Thanks for contributing, but please avoid posting correct solutions as that takes away the whole point of the game.