No. I finished all the levels that are currently in the game (and a few ones created by Chaboi).
help my middle group survives but the side ones donāt. Please help.
while True:
friends = hero.findFriends()
enemy = self.findNearestEnemy()
# Use for-loop and for each friend:
for friend in friends:
# If they see an enemy then command to attack
if enemy:
hero.command(friend, "attack", enemy)
# Command to move east by small steps.
else:
hero.command(friend, "move", {"x": friend.pos.x + 0.4, "y": friend.pos.y})
Here try to move with less steps (somewhere from 0.25 will do just fine).
Andrei
still not working the side wonāt even attack
maybe it is a bug. can you try it youself?
Itās not a bug in the gameā¦you just need to tune your logic a bit finer.
Iād recommend distinguishing between the archers and soldiers, having the soldiers attack directly and keeping the archers at a safe distance while firing away.
But the soldiers on the flanks donāt even attack while my code works fine on the ones in the middle.
Well, no one has mentioned it yet, but using āselfā is showing that you acquired this code from elsewhere. āselfā was replaced back around/before 2017.
Anyway, you are only identifying enemies that the hero can seeā¦not ones that your friends can.
Thanks you helped me a lot I changed self to friend and it worked.