Help: Levels in Glacier

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 vector
What do I put here
# Create a new Vector at the center X point
center = Vector(40, 34)

# A unit's position is actually a Vector!
partner = hero.findByType("peasant")[0]

while True:
    vector = Vector.subtract(vector1, vector2)

    # Second, find the position your hero should moveTo starting from center, and following vector.
    moveToPos = Vector.add(vector1, vector2)
    
    # Third, move to the moveToPos position.
    hero.move(moveToPos.pos)
    pass
1 Like

@Deadpool198 @Falcons118 @Chaboi_3000 help? @abc too.

1 Like

If I am not mistaken this level is circle walking, am I correct @Dragonlouis?

1 Like

You don’t need that. moveToPos is already is a position.

You need to find the distance (and direction) from your partner’s position, and the center point. You would do this by using Vector.subtract(). Don’t use vector1 or vector2, these are not defined.

@Deadpool198, help, I used your advice and the error is:
Line 14: TypeError: Cannot read property of ‘copy’ undefined

show us were that is in your code

1 Like
# 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
# Create a new Vector at the center X point
center = Vector(40, 34)

# A unit's position is actually a Vector!
partner = hero.findByType("peasant")[0]

while True:
    vector = Vector.subtract() <-- HERE!!!!!!

    # Second, find the position your hero should moveTo starting from center, and following vector.
    moveToPos = Vector.add(vector1, vector2)
    
    # Third, move to the moveToPos position.
    hero.move(moveToPos.pos)
    pass

@milton.jinich? Hello? ps: I like your new avatar

1 Like

Yeah just checking my code to help me

you need a whole lot more code if you are going to complete this level @Dragonlouis

What are you subtratcting you need to sobtract hero.pos with peasant.

here do moveToPos = Vector.add(center, vector)

Ok. i’ll try all of this.

you also haven’t did what Danny said.

1 Like

Oh, it just didn’t save.

1 Like

and @Eric_Tang, I’m circling, just not around the x.

1 Like

Post your code.
2-202020902

1 Like

I have seen this you are just going around the circle since you need to type in what if there is a gap you go in it.

1 Like
# 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
# Create a new Vector at the center X point
center = Vector(40, 34)

# A unit's position is actually a Vector!
partner = hero.findByType("peasant")[0]

while True:
    vector = Vector.subtract(hero.pos, partner.pos)

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

my bad actually subtract center and partner.pos

1 Like