I finished changing Starships this evening, and it works perfectly. I changed a couple things in my code, mainly just to make it easier for reference (like I made some variables global). If you wanted to see, here's the final version (although the earlier post also works.. I think): 'FIND ANGLE local dim length#,sine#,cosine#,radians#,degrees# local fn CalcAngle# (dx#,dy#,AngleInfo as pointer to Geometric) 'given x and y lengths in pixels, calculate vector angle in degrees length# = sqr(dx*dx+dy*dy) sine# = dy/length# cosine# = dx/length# radians# = asin(sine#) degrees# = radians#/gAngletoradians#'-90 to +90° if dx<0 then degrees# = 180-degrees# if degrees# < 0 then degrees# = 360 + degrees# AngleInfo.sine# = sine# AngleInfo.cosine# = cosine# AngleInfo.length# = length# end fn = degrees# 'CHANGE COURSE local fn CourseChange(moveAngle, moveSpeed#, newAngle, newSpeed#)', @finalAngle, @finalSpeed) dim x# dim y# dim VelocityX# dim VelocityY# dim AngleStuff as pointer to Geometric long if moveAngle = newAngle gFinalSpeed = moveSpeed# + newSpeed# gFinalAngle = newAngle xelse x = newSpeed# * cos(newAngle * gAngleToRadians#) y = newSpeed# * sin(newAngle * gAngleToRadians#) VelocityX = (moveSpeed# * cos(moveAngle * gAngleToRadians#)) + x VelocityY = (moveSpeed# * sin(moveAngle * gAngleToRadians#)) + y gFinalAngle = fn CalcAngle#(VelocityX#,VelocityY#, AngleStuff) gFinalSpeed = AngleStuff.length end if end fn //YOU ACCELERATE clear local fn SpeedUp(unit) fn CourseChange(units.moveAngle(unit), units.speedU(unit), units.fireAngle(unit), units.accel#(unit))', @units.speedU(unit), @units.moveAngle(unit)) units.moveAngle(unit) = gFinalAngle units.speedU(unit) = gFinalSpeed if units.speedU(unit) > units.maxspeedU(unit) then units.speedU(unit) = units.maxspeedU(unit) end fn Once again, thanks for all your help! (I'm not saying this is perfect.. if you see an error please tell me!) -Peter Dempse y >From: "Peter Dempsey" <theviron@...> >Reply-To: futurebasic@... >To: futurebasic@... >Subject: RE: [FB] Physics... >Date: Thu, 23 Nov 2000 10:57:04 -0600 > >Ok, thanks everybody. I think this will work. I haven't tried it in my >game yet because I have a lot of changing to do.. and right now I just sort >of messed it up. Besides, I'm a turkey eating american ;P. > >'simply returns the angle and some other stuff like length >'(forgot who suggested this..) >local >dim length#,sine#,cosine#,radians#,degrees# >local fn CalcAngle# (dx,dy,AngleInfo as pointer to Geometric) > 'given x and y lengths in pixels, calculate vector angle in degrees > length# = sqr(dx*dx+dy*dy) > sine# = dy/length# > cosine# = dx/length# > radians# = asin(sine#) > degrees# = radians#/gAngletoradians#'-90 to +90° > if dx<0 then degrees# = 180-degrees# > AngleInfo.sine# = sine# > AngleInfo.cosine# = cosine# > AngleInfo.length# = length# >end fn = degrees# > >'here's the meat of it.. hope it works.. >local fn CourseChange(moveAngle, moveSpeed, newAngle, newSpeed, >@finalAngle, >@finalSpeed) >dim x >dim y >dim VelocityX >dim VelocityY >dim AngleStuff as pointer to Geometric > >x = newSpeed * cos(newAngle) >y = newSpeed * sin(newAngle) > >VelocityX = (moveSpeed * cos(moveAngle)) + x >VelocityY = (moveSpeed * sin(moveAngle)) + y > >finalAngle = fn CalcAngle#(VelocityX,VelocityY, @AngleStuff) >finalSpeed = AngleStuff.length >end fn > > > >Look over it and tell me my mistakes... (yes I tried to switch it to angle >system.. it'll cut down my work a ton) > >Thanks! > >-Peter Dempsey >_____________________________________________________________________________________ >Get more from the Web. FREE MSN Explorer download : >http://explorer.msn.com > > >-- >To unsubscribe, send ANY message to <futurebasic-unsubscribe@...> > _____________________________________________________________________________________ Get more from the Web. FREE MSN Explorer download : http://explorer.msn.com