Ok, some basic things I learned from playing with sin and cos in graal:
They are from the math term 'trigonometry' where radians is used instead of degrees.
Radians goes from 0 to PI*2.
For example, if you want your player to move in the direction that the player is facing, do this:
PHP Code:
temp.angle = (pi/2 * (player.dir + 1));
temp.speed = 1.5;
player.x += cos(temp.angle)*temp.speed;
player.y -= sin(temp.angle)*temp.speed;
However that will only move the player once, so it should probably be in a loop or when it is provoked by a key for example.
Cos belongs to the x-axis
Sin belongs to the y-axis
This is some simple basic stuff I first learned about cos and sin when I played around with it..
so I don't know if all above is fully correct, so if I'm not, someone else can correct me ;o