Heres a nifty program I used a while back. I was having so much trouble comming to terms and really understanding how to use sin and cos for things like orbiting cameras, orbits,cameras that follow with a radius, and how to make something travel in a wave. Ths is Simple code that has planets orbiting a small sun.
It helped me a long hope it can help someone else. Can be used for enemies in 2d games also just look at the rem line at the bottom for different patterns.
color backdrop 0,RGB(0,0,0)
backdrop on
autocam off
Sun=1
Planet=2
planet2=3
planet3=4
Radius#=40.0
Radius2#=20
Radius3#=25
angle#=0.0
angle2#=0.0
angle3#=0.0
make object sphere Sun,6,50,50
color object Sun,RGB(200,200,20)
make object sphere Planet,2,32,32
color object Planet,RGB(20,50,200)
make object sphere planet2,3,42,42
color object planet2,rgb(255,11,11)
make object sphere planet3,4,35,35
color object planet3,rgb(100,255,0)
position object planet3,35,0,0
position object planet2,25,0,0
position object Sun,0,0,0
position object Planet,10,0,0
position camera 0,0,20,-120
point camera 0,0,0,0
sync on
do
position object Planet,object position x(Sun)+Radius#*cos(angle#),0,object position z(Sun)+Radius#*sin(Angle#)
position object planet2,object position x(Sun)+Radius2#*cos(angle2#),object position z(Sun)+Radius2#*cos(angle2#),object position z(Sun)+Radius2#*sin(angle2#)
position object planet3,object position x(Sun)+Radius3#*cos(angle3#),0,object position z(Sun)+Radius3#*sin(angle3#)
angle#=angle#+0.4
angle2#=angle2#+0.5
angle3#=angle3#+1
if angle#>359 then angle#=0.0
if angle2#>359 then angle2#=0.0
if angle3#>359 then angle3#=0.0
control camera using arrowkeys 0,0.1,0.1
sync
loop
rem position object planet2,object position x(Sun)+Radius2#*sin(angle2#),object position z(Sun)+Radius2#*sin(angle2#),object position z(Sun)+Radius2#*sin(angle2#)
rem this causes back and fourth wiggle
If something similar was posted sorry I didnt search the forum Im on a very slow connection. I got this code from some where here and altered it cant remember where it was though.
http://badtempergames.tripod.com