Quote:
Originally Posted by maximus_asinus
How does VECX and VECY work? The Wiki isn't informative at all.
|
vecx(dir) and vecy(dir) are the same as doing cos(pi * (dir + 1) % 4 / 2) and sin(pi * (dir + 1) % 4 / 2)
To put it simply, this is how I always remembered it: it will return the direction that something should be moving in relation to the direction that you input.
For example, vecx(3) will return 1, while vecx(1) will return -1:
If your direction is 1 you are facing left, obviously the object should travel -1 (x). If you are facing right, 3, the object could travel 1 (x).
Same relation is for vecy(dir).