Thread: Space Game
View Single Post
  #21  
Old 05-04-2002, 09:47 AM
adam adam is offline
http://wiki.graal.us/
adam's Avatar
Join Date: Nov 2001
Posts: 2,247
adam has a spectacular aura aboutadam has a spectacular aura about
Send a message via AIM to adam
Quote:
Originally posted by Kaimetsu


Okiedokie.

Maintain an (dx,dy) for your current velocity. Add to it when you use the thruster in a given direction (dx+accel*cos(ang),dy+accel*sin(ang)) and limit the total speed with a unit vector. Ie:

mag=(dx^2+dy^2)^0.5;
if(mag>maxspeed){
dx=maxspeed*dx/mag;
dy=maxspeed*dy/mag;
}
I learned about vectors and unit vectors in school last week

But I like your explanation kai this is very useful.
__________________
Rogue Shadow (TCN)(NAT)(Global Development Team)

For development help, contact the patrons of the #graaldt irc channel below, I am usually there.
Click Here to Join IRC Chat Now! -- irc.freenode.net Channel: #graaldt
Quote:
<Dustyshouri> no, RogueShadow is always talking about scripts lol
<Dustyshouri> in fact, he pretty much brought Graal back as a topic single-handedly
Reply With Quote