Hello I am new to coding and am trying to learn some basic code through CodeCombat and I got stuck on Munchkin Swarm, I cant quite figure out how to get past it
enemy = self.findNearestEnemy()
loop:
if self.isReady("cleave"):
self.cleave(enemy)
else:
self.attack("Chest")
Here is my code, if anyone could point out any problems with it or if I forgot something that would be fantastic.
no cleave is in there, and also I forgot to mention but my character goes out and cleaves a munchkin then comes back beats on the chest for a few seconds then goes back to the dead body and cleaves again, and right after that they swarm and I cant cleave. So yeah that might be a big problem.
jwrobbs is correct, you need to be looking for new enemies every time through the loop, not just once at the beginning. In your code enemy always refers to the first enemy you see regardless of whether he is alive or not.
how am i supposed to win if I dont have enough armor and now i have too less gems to buy more? even when i cleave, they kill me to fast. I have less health so i can never win it.
How much health do you have? We designed this one so you wouldn’t have to buy extra armor, so let me know how much health and what gear you have, because I might need to tune it a bit more.
What equipment do you have on? those come with different glasses and wristbands. You should have earned them as you progressed to the level. Did they become unequipped?