Quote:
Originally Posted by Angel_Light
One problem tho. I'm still Algebra 1. -_- I havent learn sin cos or tan...
|
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.