Thread: Space Game
View Single Post
  #22  
Old 05-06-2002, 02:59 AM
Er1c Er1c is offline
Registered User
Er1c's Avatar
Join Date: Mar 2001
Location: Chicago, IL
Posts: 791
Er1c is on a distinguished road
Quote:
Originally posted by Kaimetsu
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;
}
Isn't there a way I could do this without saving a dx/dy and just saving the angle you're traveling in and the speed?
__________________
Eric Kraft
Reply With Quote