I have used this piece of code in another level and everything worked just fine, but now in Hunting Party level I am using this and my soldiers walk but when they reach their destination they just stand still, what’s happening?
for friend in self.findFriends():
if friend:
enemy = friend.findNearestEnemy()
if enemy:
self.command(friend, “attack”, enemy)
else:
self.command(friend, “move”, {“x”:friend.pos.x+20,“y”:friend.pos.y})
For someone who has been a member of this community for over a month, one would think you would have learned to format your code by now. Please learn how to. We can’t be here for you every single minute.
Is this code in a while True:
loop or in a regular loop? If it isn’t it would only run once, which could explain your problem.
1 Like
Please tell me where that formatting information is so I can see
1 Like
If you go to thd list icon at the top right pf the website and click it, there’s a link that says FAQ. Read it.
2 Likes