My code is doing fine except for one archer who dies and i don’t know how to save him
while True:
friends = hero.findFriends()
# Use for-loop and for each friend:
for friend in friends:
# If they see an enemy then command to attack.
enemy = friend.findNearestEnemy()
if enemy:
hero.command(friend, "attack", enemy)
# Command to move east by small steps.
elif friend.health < 30:
hero.command(friend, "move", {'x': friend.pos.x - 5, 'y': friend.pos.y})
else:
hero.command(friend, "move", {'x': friend.pos.x + 1, 'y': friend.pos.y})