View Single Post
  #26  
Old 02-20-2009, 11:00 PM
Tigairius Tigairius is offline
The Cat
Tigairius's Avatar
Join Date: Jan 2007
Location: Missouri, USA
Posts: 4,240
Tigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant future
Quote:
Originally Posted by maximus_asinus View Post
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).
__________________


“Shoot for the moon. Even if you miss, you'll land among the stars.”
Reply With Quote