[SOLVED] I cant get the level Sarven Shepherd

i cant even get my guy to move let alone attack munchins
here is my code I just reset it and I put in the while true loop

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 True:this is the loop I added

enemy = enemies[enemyIndex]
# "!=" means "not equal to."
if enemy.type != "sand-yak":
    # While the enemy's health is greater than 0, attack it!
    
    pass

# Between waves, move back to the center.

also this is my eqipment

Please format your code properly

1 Like

i did format it correctly man

1 Like

Some of your code is outside but i guess its ok

1 Like

like i have tried to have him attack with the attack code i have have tred using if’s and everything it just wont work

1 Like

you should change your 2nd while true loop to
enemyIndex < enemy length
then you should do

if enemy.type does not equal sand yak
while enemy.health>0
   hero.attack(enemy)


1 Like

i have to go i will be back later but see ya for now

1 Like

That should be:

while enemyIndex < len(enemies):

Then, while the enemy’s health is greater than zero, attack it. Then increment enemyIdex (enemyIndex +=1).

1 Like

If you are using arrays you have to do this at the end enemyIndex += 1

2 Likes

my hero just isn’t doing anything honestly I thing this has a bug or somthing

Show us your new code now

# 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!
        hero.attack(enemies)
        enemyIndex +=1
        pass

hero.moveXY(40, 32)

you need to indent properly
everything should be in the first while true loop

1 Like
# 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!
            hero.attack(enemies)
            enemyIndex +=1
            pass
        
    hero.moveXY(40, 32)
    

my guy is still not moving at all

siriusly it thing this has a bug

no it doesnt. you arent doing something right

but what am i not doing right? i have tryed everything i have followed your directions and stuff aswell

and also i accesedantally pressed solution but i un selected it