Hunting Party --- Why won't my soldiers attack?

I’m not getting any error, my soldiers just won’t attack

Code
# You can use findNearestEnemy() on your soldiers to get their nearest enemy instead of yours.
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 = hero.findNearestEnemy()
        if enemy and friend.distanceTo(enemy) < 15:
            hero.command(friend, "attack", enemy)
        x = friend.pos.x + 5
        y = friend.pos.y
        # Command to move east by small steps.
        hero.command(friend, "move", {'x':x,'y':y})
        

My guess is that they will just keep walking.
Because

is not in a else statement so they just keep walking…

I didn’t even notice that I needed an else statement.
thx!

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.