See if this helps:
# Use while loops to pick out the ogre while True: # This is your outer (parent) loop enemies = hero.findEnemies() enemyIndex = 0 if enemyIndex < len(enemies): # Change this to a while loop; it is an inner loop, or child loop enemy = enemies[enemyIndex] # "!=" means "not equal to." if enemy.type != "sand-yak": # Need to indent these, as they are members of the 1st child loop # While the enemy's health is greater than 0, attack it! while enemy.health > 0: # This is another inner loop, or a step-child, as it is a member of the 1st child loop hero.attack(enemy) pass enemyIndex += 1 # Between waves, move back to the center. hero.moveXY(40, 32)
I made the alterations suggested above and your code works!