Skating on ice (klevintaph crusader)


#1

what is wrong with the following code for the slippery ice patch?

        friends = hero.findFriends()
        goalPoint= Vector (78, 40)
        for friend in friends:
            if friend.pos.x < 50:
                hero.command(friend, "move", {'x':50, 'y':58})
                continue
            if friend.pos.y > 39:
                hero.command(friend, "move", {'x':50, 'y':38})
                continue
            if friend.pos.x < 78:
                goal = Vector.subtract(goalPoint, friend.pos)
                goal = Vector.normalize(goal)
                goal = Vector.multiply(goal, 10)
        
                # make a vector from the trap to you
                trapPos = {'x':72, 'y':56}
                danger = Vector.subtract(friend.pos, trapPos)
                danger = Vector.normalize(danger)
                danger = Vector.multiply (danger, 10)
        
                goal = Vector.add(goal, danger)
                moveToPos = Vector.add(friend.pos, goal)
                hero.command(friend, "move", moveToPos)