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");
}
}
What language are you using because thats not javascript or python.
If it’s javascript, one of your problems is you have a semi-colon after loop and else. semi colon is not used like this. There should be nothing after those except the curly braces. if it’s python you need that semi-colon to be a regular colon : and you need to get rid of the curly braces and properly indent your lines.
All you need is the distance < 10, because on this level, the enemies won’t attack you unless cleave is ready (it’s just the way the level is ) . If you don’t want to do this, it should still work, but do what sotonin said.
yes, but rishiloyola98245 might be using Python, in which case, I’m pretty you need a colon, like this : <-------.
In other words, code should look like this:
else: …
Yeah… i don’t remember it being particularly difficult. Beat it on the first try. But everybody has different skill / experience levels, so it’s probably not unusual for some people to struggle with it. As long as you learn from it and improve, it’s working.