Play Home Contribute Github Join Us! Discourse Staff Members Github Contribution Guides Team

Help: Levels in Glacier

same error. oof. 20c

show us your code Please

# 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
        vector = 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)

what happened now @Dragonlouis

1 Like

Same problem. 20characters

You missed the last part of these instructions, you need to add this underneath these lines:

goal = Vector.add(variable,goal)

Replace variable with your variable.

1 Like
# 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
        vector = 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(vector, goal)
    hero.move(moveToPos)

is what I got, @abc. Did you scroll? and I don’t think it considers moveToPos as a pos, maybe I should try moveToPos.pos…

You’re combining two steps here. First you need to do what you did above:

but with the vector variable. Then you need to subtract (not add) the vector variable, from the goal variable. This means you will go away from the yak, rather than towards it.

Here you should be adding goal to hero.pos. Not to vector.

1 Like
# 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
        vector = 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.subtract(vector, 10)
        pass

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

speak english? please? (I mean explain). @Deadpool198, summon.

1 Like

Okay, I decided to redo it and this is what I got:

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.add(vector, 10)
        pass

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

@abc or @milton.jinich or @Deadpool198 or @Eric_Tang please help

1 Like

Read this and do it.

vector = Vector.add(vector, 10)

That part should be Vector.multiply(), and you should be multiplying “goal” by 10.
Next, you should use Vector.add() to add “vector” and “goal”.

Uh, @Falcons118 @milton.jinich @Monsty (are you in glacier yet monsty) help, my code is

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)
        vector = Vector.add(vector, goal)
        pass

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

In here you should be adding goal and hero.pos, as that is what the instructions tell you, but you are adding vector and hero.pos

No. I’m still in mountain.

2 Likes

delete pass also @Dragonlouis

1 Like
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)
        vector = Vector.add(vector, goal)
        pass

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

Delete the pass after this line

1 Like

did that, I’m ignoring the yaks and moving to the goal point. @Eric_Tang?

Define this line as goal

1 Like

@abc is right that is all you need to do then you should be good to go

1 Like