Help circle walking need help!

I need help when i play then this happens:


here is my code:

#Mirror your partner's movement around the center X mark.
# Vectors can be thought of as an x, y position
# Vectors can also represent the distance and direction between two positions

# use Vector.subtract(vector1, vector2) to find the direction and distance from vector2 to vector1
# use Vector.add(vector1, vector2) to find the position you get when you start from vector1 and follow vector2
# A unit's position is actually a Vector!
partner = hero.findByType("peasant")[0]
Vector.subtract(partner.pos, hero.pos)
Vector.add(hero.pos, partner.pos)
# Create a new Vector at the center X point
center = Vector(40, 34)

while True:
    # First, you want to find the Vector (distance and direction) of the partner's position to the center X.
    vector = Vector.subtract(center,partner.pos)

    # Second, find the position your hero should moveTo starting from center, and following vector.
    moveToPos = Vector.add(vector, center - vector)

    # Third, move to the moveToPos position.
    hero.move(moveToPos)
    pass
    

1 Like

@AnSeDra i need help

1 Like

I think you have to delete:

Vector.subtract(partner.pos, hero.pos)
Vector.add(hero.pos, partner.pos)

And in MoveToPos you have to write “,” instead off “-”
Also you can use “Tab” to While true loop.
Hope it helps!
(if it isn’t working you have to equip Speed Ring or something like this that if you have it you have more speed)

1 Like

you don’t need the speed ring for this level

also the
Vector.subtract(partner.pos, hero.pos)
Vector.add(hero.pos, partner.pos)
is correct
he needs to change hero.move(moveToPos) to hero.moveXY(moveToPos.x, moveToPos.y)
and moveToPos = Vector.add(vector, center - vector) to moveToPos = Vector.subtract(center, vector)
then it should work