Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 [tutorial] spaceship movement: asteroids style
Index -> Programming, Turing -> Turing Tutorials
Goto page Previous  1, 2
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
zylum




PostPosted: Tue Jan 25, 2005 7:54 pm   Post subject: (No subject)

i didnt know about cosd and sind when i wrote this so instead of using

code:
AccX := cos (angle * (Math.PI / 180))*speed
AccY := sin (angle * (Math.PI / 180))*speed


you can use

code:
AccX := cosd (angle)*speed
AccY := sind (angle)*speed


which is normal trig with angles instead of radians.

also the -90 is there to correct the angle of the spaceship. since the picture is oriented with the ship facing up and the 0th degree points right, you need to draw the pic with -90 degrees to correct this... or i suppose you can make the default angle 90. yeah i should have thought of that before but meh this was a long time ago Wink
Sponsor
Sponsor
Sponsor
sponsor
Display posts from previous:   
   Index -> Programming, Turing -> Turing Tutorials
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 2 of 2  [ 16 Posts ]
Goto page Previous  1, 2
Jump to:   


Style:  
Search: