Help: Levels in Glacier

No I was actually wrong, I was looking at the wrong line.

You were correct, the vector variable here should be goal.

Okay @Dragonlouis did you do it

1 Like

Yes, did you complete the level?

I think he did, were good

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
        vector = Vector.normalize(vector)
        # Once you have the 10m vector away from the yak, use Vector.add to add it to your goal vector!
        vector = Vector.multiply(goal, 10)
        goal = Vector.add(vector, goal)

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

Um, really sorry but uh I donā€™t notice the yaks.

Did it work @Dragonlouis

No, I just run into a yak.

show me a screen shot please using command shift 5

I use a windows desktop.

Or use control shift 3

itā€™s ctrl + shft + s but it doesnā€™t work in the codecombat.com/play area.

but Iā€™ll just say that I basically used move to move to the goalPoint.

did it work that is a yes or no question :frowning_face:

The goal here, should be vector. You should be multiplying vector and 10.

heā€™s right and that is all you need

Iā€™m going towards the yak now. I tried changing to subtract but even then it doesnā€™t work. HELP!

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
        vector = Vector.normalize(vector)
        # Once you have the 10m vector away from the yak, use Vector.add to add it to your goal vector!
        vector = Vector.multiply(vector, 10)
        goal = Vector.add(vector, goal)

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

try to say goal instead of vector here

didnā€™t work. I found out that I wasnā€™t going towards the yak, I was going in that direction.

Okay I donā€™t know what to tell you now I gave you all I know