View Single Post
  #15  
Old 05-02-2006, 06:27 AM
pacMASTA pacMASTA is offline
British Guy
pacMASTA's Avatar
Join Date: Aug 2003
Location: California
Posts: 377
pacMASTA has a little shameless behaviour in the past
Send a message via AIM to pacMASTA Send a message via MSN to pacMASTA
Quote:
Originally Posted by Yen
Aw, that's so cute.
I see no reason for tan in a movement system.

x,y -> cos(angle), single(angle)
cos is for the x-axis, sin is for the y-axis.
Graal uses angles in radians (0 to pi*2), instead of degrees (0 to 360)
However, if you don't understand radians, you can use the 'degtorad(angle)' function to convert degrees to radian.

player.x += cos(angle) will move the player's x at that angle.
player.y -= sin(angle) will move the player's y at that angle.

The the angle 0 is facing right, then cos(0), -sin(0) will be -1, 0
The angle pi*.25 (.785), or 45 degrees if you prefer that, is between the directions right and up. So, if you use cos(.785), -sin(.785), the player will move to the upper-right.

You could use getangle(gotox - player.x, gotoy - player.y) to find the angle from one point to another.

Oyah, this stuff is trigonometry, not algebra.
Yen you surpise me. Anyway Graal math is screwed up I've never asked graal but i think its a Hybrid version of Trignonometry; Theirs tons of things for starters wtf is up with the X and Y plane?
Reply With Quote