View Single Post
  #9  
Old 09-02-2007, 01:44 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
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/* (player.dir 1));
temp.speed 1.5;

player.+= cos(temp.angle)*temp.speed;
player.-= 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
__________________
Reply With Quote