[Solved] Hunting party

while True:
    friends = hero.findFriends()
    
    for friend in friends:
        enemy = friend.findNearest(friend.findEnemies())
    if enemy:
        hero.command(friend, "attack", enemy)
    else:
        hero.command(friend, "move", {'x': friend.pos.x + 24, 'y': friend.pos.y})

1 Like

This is my code. :smiley:

Structural problem. Your if enemy and subsequent else conditional statements are not inside your for loop. Also, your guys are moving WAY too fast - put a decimal point in front of that 24 so that they stay together.

Thanks! :yum::yum::yum:

Thanks @Chaboi_3000 for fixing that :smiley:

1 Like