Sin/Cos Example: Circular Orbit by anomer21st Mar 2005 22:40
|
---|
Summary Just a simple example of circular orbits with sin() and cos(). Description creates a sphere and then orbits it around the origin given y(altitude) and speed#. Code ` This code was downloaded from The Game Creators ` It is reproduced here with full permission ` http://www.thegamecreators.com sync on:sync rate 0:set display mode 1024,768,32 radius#=1000 altitude#=20 speed#=0.1 make object sphere 1,100,32,32 position object 1,0,altitude#,radius# do text 0,0,str$(screen fps()) gosub c_orbit fastsync loop c_orbit: `find new x & z ox#=radius#*cos(oangle#) oy#=altitude# oz#=radius#*sin(oangle#) `restrict angle to 360 then add speed to it oangle#=wrapvalue(oangle#) oangle#=oangle#+speed# `position it duh :P position object 1,ox#,oy#,oz# return |