(SOLVED)Help sarven sheperd

Help plz for sarven shepherd here is my code:

Use while loops to pick out the ogre

while True:
    enemies = hero.findEnemies()
    enemyIndex = 0

    # Wrap this logic in a while loop to attack all enemies.
    # Find the array's length with:  len(enemies)
while enemyIndex < len(enemies):
    
    enemy = enemies[enemyIndex]
    # "!=" means "not equal to."
    if enemy.type != "sand-yak":
        # While the enemy's health is greater than 0, attack it!
        while enemy.health < 0:
            hero.attack(enemy)
            pass

    # Between waves, move back to the center.
    hero.moveXY(40, 32)

You just do not increase ‘enemyIndex’ in the second while loop ( that should be correctly indented btw. but I think this is only a copy error), right?

if I do += 1, then every time I attack… never mind, I have temple guard, should be one hit kill.

its supposed to be while enemy health is bigger than zero not smaller

oh wait I did smaller?
Oh well I already used thornpick to beat the level

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.