[SOLVED] Preferential treatment


#1

i tried to complete this level for the past 4 days , and i still cant fix it!
this is what my code looks like:

# First, loop through all enemies...
enemies = self.findEnemies()
enemyIndex = 0
# ... but only attack 'thrower' type enemies.
# And don't forget to use your special abilities!
while enemyIndex < len(enemies):
    enemy = enemies[enemyIndex]
    if enemy.type == 'trower':
        while enemy.self.health >0:
            if self.isReady("cleave"):
                self.cleave(enemy)
            else:
                self.attack(enemy)
    enemyIndex += 1            
# Then loop through all the enemies again...
enemies = self.findEnemies()
enemyIndex = 0
# ... and take out everyone who's still standing.
while  enemyIndex < len(enemies):
    enemy = enemies[enemyIndex]
    while enemy.health > 0:
        self.attack(enemy) 
    enemyIndex += 1    

i have tried the help video and tried to copy it . but now that i did it, his one works fine and the mine wont so can somebody help me !!! i want to get to the next world :frowning:


#2

I see two problems:

  1. enemy.type == 'thrower', not 'trower'
  2. while enemy.health > 0, not while enemy.self.health >0: