while True:
enemies = hero.findEnemies()
enemy = hero.findNearest(enemies)
friends = hero.findFriends()
# Send the first soldier of the friends array towards the enemy.
hero.command(friends[0], "move", {'x': 60, 'y': 34})
# i in range(1, n) starts the index at the second element!
for i in range(1, len(friends)):
friend = friends[i]
# Command the remaining soldiers to run away!
hero.command(friends[i], "move", {"x": 29, "y": 34})
So I’m trying to send the friend[0] first towards the bombs, but they all start running away. How can I fix this?
I also get an error message saying
Hello and welcome to the forum! This is a cosy forum where you can do all sorts of things from share memes to get help with levels. We hope you enjoy your time here in this wonderful place!