Precision Kicking

I don’t understand why the peasant only moves to the flag once, then stops moving when I put another flag. Could someone help?

indent preformatted text by 4 spacesdef commandPeasant():
flag = self.findFlag()
friends = self.findFriends()
for i,friend in enumerate(friends):
    if friend.type == "skeleton":
        continue
    
    if flag:
        self.command(friend, "move", flag.pos)
        self.pickUpFlag(flag)

loop:
commandPeasant()

I see your attempt to format your code properly hasn’t exactly worked out. For future reference, just put it in between three backticks on new lines. I’ll do it for you this time, but do so yourself in the future.

self.pickUpFlag(flag) requires you to move to the flag before it disappears. Use self.removeFlag(flag) instead.

I’m sorry to be reviving this topic, but I need help on the level. Is there any sort of way I can complete the level if I use this this as my starting code?

Here:

# Push the ball to knock over all the blue skeletons without hitting any red ones.
# The blue skeletons can be found as enemies.
def radiansToDegrees(radians):
    return radians * 360 / 2 * Math.PI
loop:
    enemy = hero.findNearestEnemy()
    Vector = {"x": enemy.pos.x, "y": enemy.pos.y}
    rotation = Vector.heading
    radiansToDegrees(rotation)