Munchkin Swarm -

enemy1 = self.findNearestenemy
loop:  
    if self.isReady("cleave"):
        self.cleave(enemy1)
    else:
        self.attack("Chest")

I did this but then i keep dying because whenever i am cooling down, they already kill me… I dont have enough gems to buy a better armor.


All of my friends are stuck in this level only! Please help me so I can help them too! They have been trying to solve it for so long but we can’t solve it…

You need to put the enemy1 = self.findNearestEnemy() variable assignment inside the loop, so that the value is always fresh.

You have:
self.findNearestenemy
It should be:
self.findNearestEnemy()

The other thing you are supposed to do in this level is to only cleave when they get less than 10m away, not only cleave whenever cleave is ready. Just check the distance like you did in the previous level.

What kind of sword do you have? I saved up all my gems and bought a claymore.

# If the ogres rush at you, cleave them!
# If they stay 10 meters away, attack the "Chest".
 self.distanceTo(enemy) 

U need to use the above action and don’t forget to attack the ‘chest’ since they are 10 m away, it’s really easy just check the previous lvl as “nick” said

This happens when I put () in self.findnearestenemy

this is what happens if i dont put comma but still i dont survive

  1. findNearestEnemy, the Enemy has a capital E
  2. You need to unindent everything by four spaces so that the loop is flush with the left side.
  3. Do you have the glasses equipped which give you findNearestEnemy?
  4. self.isReady("cleave") returns True or False, but you are comparing it with the number 10. You want to change if self.isReady("cleave")>10 : to if self.distanceTo(enemy1) < 10:

wait I did this
do I have to put anything else because it isnt working

loop:
    enemy1 = self.findNearestEnemy()
    self.distanceTo(enemy1)>10 :
        self.cleave(enemy1)
    else
        self.attack("Chest")

You have:

self.distanceTo(enemy1)>10 :

Should be:

if self.distanceTo(enemy1) < 10:

You need to put an if.

FINALLY! THE SOLUTION TO THIS LEVEL!!! :smiley: