Hello, I have had great difficulties completing the level “Munckin Swarm” using JavaScript. Here is my code:
while(true) {
(4 spaces) var enemy = hero.findNearestEnemy();
(4 spaces) if (enemy) {
(8 spaces) var distance = hero.findNearestEnemy();
(8 spaces) if (distance < 10) {
(12 spaces) hero.cleave(enemy);
}
(8 spaces) else {
(12 spaces) hero.attack(“Chest”);
}
}
(4 spaces) else {
(8 spaces) hero.attack(“Chest”);
}
}
If you could help me find the problem, it would me much appreciated. Thanks!
-This issue has been solved. Line 6 must be changed to
(8 spaces) var distance = hero.distanceTo(enemy);