New Level- Direction and Magnitude

Please check out this new level here and feedback is appreciated:

Basically, what you need to do is use vector to move your hero around and kill the shamans while you are at it. Then, you need to retreat to the house.

A findEnemy check and attack action will not work, because the yaks count as an enemy.

Enjoy this level and thanks for any feedback/guidance. :slight_smile:

Dear @Endercore79,
what about self.findByType("shaman")?

Aha! Good catch!

I’ll ask Nick to resrict all glasses with findByType on them. That should fix the problem.


Solution without vectors
def findShamans():
    return [e for e in self.findEnemies() if e.type=="shaman"]
for e in shamans:

self.moveXY(68, 32)

This do not give me the victory, however, even if the actions are the expected ones: i kill only ogres, i do not anger yaks and i reach the red cross, but the goals are “incomplete”.
Maybe the configuration of the goals is not correct, since even when i use the vectors i obtain “Incomplete” goals (only the first one, “Knock out the shamans” is completed).

Which is basically every but the most simple glass. I think it would be simpler to use some obstacles (can also be Ice-Yaks, semi-random distributed over the map) which you have to avoid (if magnitude < 10 move directly away)

Code could look like this:
var homePos = new Vector(65, 30); //Just some guessed values where the red x is likely
    var yaks = this.findByType("ice-yak");
    var nearYak = this.findNearest(yaks);
    if(this.distanceTo(nearYak < 10)){
        var dir = Vector.subtract(this.pos, nearYak.pos);
        dir = Vector.normalize(dir);
        dir = Vector.multiply(dir, 10);
        dir = Vector.add(this.pos, dir);
        var shamans = this.findByType("shaman");
        if(shamans.length == 0) break;
        var nearShaman = this.findNearest(shamans);
        if(this.distanceTo(nearShaman) > this.attackRange){
this.moveXY(homePos.x, homePos.y);

Off topic-ish, but I get a permission error when trying to load the level (I tried this level a while back ago while looking through the levels list):

While that was signed in, attempting to play using other browsers, logged out, other accounts, direct, etc. doesn’t seem to work either.

I tried the level but I’m not sure why vectors are needed.

Even if findByType was restricted, there are ways to get around that. (differences in enemy health, position, etc.)

Seems like vectors could be more useful if the yaks and shamans were wandering randomly around, such that it becomes necessary to add “force” vectors to steer away from the yaks and to steer towards the shamans.

Hey everyone,

I fixed the bug with the retreat to home base goal and also scattered the yaks and shamans. Now that this is done you should be able to play the level without all the issues mentioned above. Once again, any feedback would be appreciated and thanks for playing! :slight_smile:


This means that you cannot use higher end glasses at all just disable the command findByType();

Lurkers is also pretty much the same thing

I based Direction and Magnitude off Lurkers and Skating Away. As for the glasses, I don’t know what Nick can do, but I’ll ask him.

Thanks for your feedback :smile:!


@Endercore79 I’m checking out what needs to be done now, but I think it will be easier if you private message me the code you think would solve the level using Vectors. Currently it seems like they wouldn’t be needed, which would make the level a little easy for the Glacier campaign. Also, I’ll have to make it so that the yaks attack if you get close enough.