HELP ME PLEASE…I’ve been trying to figure out how to do this…I’ve tried many different codes from many different people but the only thing that happens is either the hero dies after fighting for the longest time or he doesn’t even move…I am a student and cant seem to figure out the problem…I just want someone who can explain this to me
Heres My Code:
Use while loops to pick out the ogre
while True:
enemies = hero.findEnemies()
enemyIndex = 0
for enemy in enemies:
hero.attack(enemy)
# Wrap this logic in a while loop to attack all enemies.
# Find the array's length with: 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!
pass
# Between waves, move back to the center.