Code Combat Posters and Curriculum (Standards, Assessments, and Lesson Plans)

Page 14:
The value Vector(x,y) describes a vector starting from the origin (0,0) and ending at the point (x,y).
Because of this, when working with vectors you:
1 Transform your (x0,y0)->(x1,y1) vectors into origin vector (0,0) → (x1-x0,y1-y0) vectors

#The starting point of the vectors is shifted from this.pos to origin (0,0)
metoyak= Vector.subtract(yak.pos,this.pos);
metocoin=Vector.subtract(coin.pos,this.pos);

2 Manipulate these vectors

#well, computing yaktome directly is faster,
#but for the purpose of instruction this is much clearer

#we get the vector going into the opposite direction:
yaktome=metoyak.multiply(-1);
#normalize
yaktome=yaktome.normalize();
metocoin=metocoin.normalize();
#vector addition
direction=Vector.add(yaktome,metocoin);

3 Transform them back from origin vectors (0,0)->(x2,y2) into (x0,y0)->(x2+x0,y2+y0)

direction = Vector.add(direction,this.pos);

Check this drawing also:

========================================================================

Check my array methods analysis at:
Not sure if it is beginner stuff.