This is my code:
enemy = hero.findNearestEnemy()
while True:
if enemy:
hero.attack(enemy)
else:
hero.moveXY(47, 71)
But all my hero will do is kill the first enemy and then do nothing. Please help me figure this out.
This is my code:
enemy = hero.findNearestEnemy()
while True:
if enemy:
hero.attack(enemy)
else:
hero.moveXY(47, 71)
But all my hero will do is kill the first enemy and then do nothing. Please help me figure this out.
You have to find the enemy in the while loop. you are just finding one enemy before @Garv_Jain
Thank you! It works now.
no problem @Garv_Jain