There are a couple of ways to do this:
The NewXvalue() and NewZvalue() way:
sync on : sync rate 60
randomize timer()
autocam off
make matrix 1,1000,1000,20,20
position camera 500,250,0 : point camera 500,10,500
` sun object
make object sphere 1,50,12,24 : position object 1,500,25,500
` planet object
make object sphere 2,30,12,24
dist# = 300
ang# = rnd(360)
do
` set planet position relative to sun
px# = newxvalue(object position x(1),ang#,dist#)
pz# = newzvalue(object position z(1),ang#,dist#)
` position planet
position object 2,px#,15.0,pz#
` update orbit
ang# = wrapvalue(ang# + 0.5)
sync
loop
...or the sin() and cos() way:
sync on : sync rate 60
randomize timer()
autocam off
make matrix 1,1000,1000,20,20
position camera 500,250,0 : point camera 500,10,500
` sun object
make object sphere 1,50,12,24 : position object 1,500,25,500
` planet object
make object sphere 2,30,12,24
dist# = 300
ang# = rnd(360)
do
` set planet position relative to sun
px# = (sin(ang#) * dist#) + object position x(1)
pz# = (cos(ang#) * dist#) + object position z(1)
` position planet
position object 2,px#,15.0,pz#
` update orbit
ang# = wrapvalue(ang# + 0.5)
sync
loop
Hope this helps
Programming anything is an art, and you can't rush art.
Unless your name is Bob Ross, then you can do it in thirty minutes.