Help: Levels in Glacier

Yes i fininshed the game why?

i didnt come to this forum until i only had two levels left

but anyways back on topic does it work?

I think he is loosing faith in you @Archipelago-Gold

@Dragonlouis, the vector here should be goal. If you want you could replace every variable vector with another variable. Otherwise, keep you code as it is.

You know what to many have their own opinions because a program can be written many different ways so here just take a look at this topic maybe it can help you because Chaboi_3000 explains some things in here maybe this can help instead of confusing you.

Its Windows key + shift + s
Lydia

image
that’s what’s happening and it didn’t work.


is my code(thanks a lot for the screenshot tip)

I said you need to yak_vector or yakvector to replace your vector =

Turn everything that you define as vector turn it into yak_vector

not working, my code is. But, really, all I did was change what the variable was called, right?

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

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

look close what do you see that doesn’t belong here

 goal = Vector.add(yak_vector, goal)

try doing hero.pos instead of yak_vector here

That actually had the same effect

no wait everyone just wait im testing his code to see whats wrong

yak_vector = Vector.subtract(yak.pos, hero.pos)

you have yak.pos and heros.pos backwards

1 Like

I tried it out with Ritic and Illia didn’t work it is the order of when he does everything

1 Like

That didn’t do the trick(I test out the updated code so I can give the heads up weather it is good or bad code)

1 Like

and since they are swapped it causes the hero’s last code to produce ans error.

hero.move(moveToPos)
1 Like