My code in the level Sarven Shepherd looks correct, but it says “Code never finished. It’s either really slow or has a infinite loop.”. Here is my code:
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:
# Between waves, move back to the center.
Please help me. Thanks