check this code and watch the pic
rem generic template
rem Scorpyo
set display mode 1024,768,32
SYNC ON
SYNC RATE 60
backdrop on
color backdrop rgb(10,100,100)
autocam off
set global collision off
x#=0.0:z#=-300.0:a#=0.0:s#=0.0:h#=120.0
gosub makespheres
do
gosub printdata
gosub cameracontrol
gosub orbit
SYNC
loop
orbit:
rem 1 moon
angle1#=wrapvalue(angle1#+0.1)
orbit1x#=origin1x#+sin(angle1#)*radius1
orbit1z#=origin1z#+cos(angle1#)*radius1
position object 102,orbit1x#,origin1y#,orbit1z#
rem 2 moons
angle2#=wrapvalue(angle2#+0.2)
orbit2x#=origin2x#+sin(angle2#)*radius2
orbit2z#=origin2z#+cos(angle2#)*radius2
position object 103,orbit2x#,origin2y#,orbit2z#
angle3#=wrapvalue(angle3#+0.3)
orbit3x#=origin2x#+sin(angle3#)*radius3
orbit3z#=origin2z#+cos(angle3#)*radius3
position object 104,orbit3x#,origin2y#,orbit3z#
return
cameracontrol:
x#=newxvalue(x#,a#,s#)
z#=newzvalue(z#,a#,s#)
if upkey()=1 and s#<1.2 then s#=s#+0.02
if downkey()=1 and s#>-1.2 then s#=s#-0.02
if leftkey()=1 then a#=wrapvalue(a#-1)
if rightkey()=1 then a#=wrapvalue(a#+1)
position camera x#,h#,z#
yrotate camera a#
xrotate camera 30
if inkey$()="ù" then s#=0.0
return
printdata:
set cursor 0,0
print "polys= ",statistic(1)
print "frame rate= ",screen fps()
return
makespheres:
rem planets
origin1x#=-130:origin1z#=50:origin1y#=0:radius1=140
make object sphere 100,40
position object 100,origin1x#,origin1y#,origin1z#
color object 100,rgb(200,0,0)
origin2x#=100:origin2z#=0:origin2y#=-50:radius2=100
make object sphere 101,30
position object 101,origin2x#,origin2y#,origin2z#
color object 101,rgb(200,0,0)
rem moons
make object sphere 102,20
color object 102,rgb(0,0,200)
make object sphere 103,10
color object 103,rgb(0,0,200)
radius3=50
make object sphere 104,10
color object 104,rgb(0,0,200)
return