# Help: Levels in Glacier

Okay. I’ll try this.

1 Like

I believe as @Eric_Tang said this is the correct answer. I haven’t done this level however in a while so I’m not exactly sure

1 Like

I already finished. 20

2 Likes

Congratulations(20 char)

1 Like

Now I need help with the yak level in the glacier right after circle thingy.

1 Like

start a new topic about it then

1 Like

post your code, and what you need help with.

I am very useful right

1 Like

this is getting anoying

``````# Move to the red X mark while avoiding the yaks.
# use Vector.normalize(vector1) to create a vector in the same direction as vector1, but with a distance of 1
# use Vector.multiply(vector1, X) to create a vector in the same direction as vector1, but with its distance multiplied by X

# The point you want to get to.
goalPoint = Vector(78, 34)

while True:
# This creates a vector that will move you 10 meters toward the goalPoint
# First, create a vector from your hero to the goal point.
goal = Vector.subtract(goalPoint, hero.pos)
# Then, normalize it into a 1m distance vector
goal = Vector.normalize(goal)
# Finally, multiply the 1m vector by 10, to get a 10m long vector.
goal = Vector.multiply(goal, 10)

# To avoid the yaks, if you get within 10 meters of a yak, you should vector away from it.
yak = hero.findNearest(hero.findEnemies())
distance = hero.distanceTo(yak)
if distance < 10:
# First, make a Vector from the yak to you
vector = Vector.subtract(yak, hero.pos)
# Now use Vector.normalize and Vector.multiply to make it 10m long
vecter = Vector.normalize(yak)
# Once you have the 10m vector away from the yak, use Vector.add to add it to your goal vector!
vector = Vector.add(goal, 10)
pass

# Finally, determine where to move by adding your goal vector to your current position.
moveToPos = Vector.add(hero.pos, goal)
hero.move(moveToPos)
``````

@milton.jinich sorry I was tweaking my code a little still doesn’t work. @abc, summon

1 Like

what is the name of the level

1 Like

Skating Away is the name.

Yep, that’s right.20

1 Like

you can’t subtract yak, so that should be yak.pos

vecter should be vector. and you shouldn’t be normalizing yak, it should be your previous variable which is vector.

vector should be goal. The goal in the Vector.add should be your variable, which is vector.

My code:

``````# Move to the red X mark while avoiding the yaks.
# use Vector.normalize(vector1) to create a vector in the same direction as vector1, but with a distance of 1
# use Vector.multiply(vector1, X) to create a vector in the same direction as vector1, but with its distance multiplied by X

# The point you want to get to.
goalPoint = Vector(78, 34)

while True:
# This creates a vector that will move you 10 meters toward the goalPoint
# First, create a vector from your hero to the goal point.
goal = Vector.subtract(goalPoint, hero.pos)
# Then, normalize it into a 1m distance vector
goal = Vector.normalize(goal)
# Finally, multiply the 1m vector by 10, to get a 10m long vector.
goal = Vector.multiply(goal, 10)

# To avoid the yaks, if you get within 10 meters of a yak, you should vector away from it.
yak = hero.findNearest(hero.findEnemies())
distance = hero.distanceTo(yak)
if distance < 10:
# First, make a Vector from the yak to you
vector = Vector.subtract(yak.pos, hero.pos)
# Now use Vector.normalize and Vector.multiply to make it 10m long
vecter = Vector.normalize(vector)
# Once you have the 10m vector away from the yak, use Vector.add to add it to your goal vector!
goal = Vector.add(vector, 10)
pass

# Finally, determine where to move by adding your goal vector to your current position.
moveToPos = Vector.add(hero.pos, goal)
hero.move(moveToPos)
``````

it says that moveToPos should be x, y coords.
@abc, or @milton.jinich, help?

That “vecter” should be vector, that is a spelling mistake.

Oh. Well, what a typo. And all this time I didn’t realize…

what do you have now