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(enemy)
pass
# Between waves, move back to the center.
hero.moveXY(40, 32)
Welcome to the forum @Leonardo_White ! This is a friendly place where you can ask help on levels, report bugs, or just chat with other coders! Don’t forget to read the guidelines if you haven’t yet. Have a great time!
Please for the next time, make sure to format ALL your code, thanks
you should take care of this comment
Hint:
while enemy.health > 0:
i also recommend that you replace the above with this: if enemy and enemy.type != "sand-yak"