sync on : sync rate 0 : hide mouse
set display mode 1024,768,32 : autocam off
 
randomize timer()
 
global Cam=1
make camera Cam
set current camera Cam
set camera range Cam,0.01,200
 
make object cube Cam,1
set object cull Cam,1
 
global Person=2
make camera Person
xrotate camera Person,270
set camera range Person,0.0001,200
 
cls
 
global Space=2
for i=0 to 5000
   Grey = rnd(180)
   ink rgb(Grey,Grey,Grey),0
   dot rnd(256),rnd(256)
next i
get image 1,0,0,256,256
make object cube Space,200
texture object Space,1
set object cull Space,0
set object ambient Space,0
set object light Space,0
 
global Moon=3
ink rgb(160,160,160),0
box 0,0,255,255
ink rgb(90,90,90),0
for i=0 to (rnd(10)+10)
   Radius = (rnd(10)+10)
   circle (rnd((255)-Radius*2)+Radius),(rnd((255)-Radius*2)+Radius),Radius
next i
for i=0 to 2000
   dot rnd(255),rnd(255)
next i
get image 2,0,0,255,255
make object sphere Moon,50,24,24
texture object Moon,2
set object collision to polygons Moon
 
global Player=4
make object box Player,5,1.5,5
make object sphere 6,5,4,6
scale object 6,100,70,100
make mesh from object 1,6
delete object 6
add limb Player,1,1
delete mesh 1
offset limb Player,1,0,1.5,0
make object cylinder 6,3
scale object 6,15,100,15
make mesh from object 1,6
delete object 6
add limb Player,2,1
add limb Player,3,1
add limb Player,4,1
add limb Player,5,1
delete mesh 1
offset limb Player,2,2.4,-1.5,2.4
offset limb Player,3,2.4,-1.5,-2.4
offset limb Player,4,-2.4,-1.5,2.4
offset limb Player,5,-2.4,-1.5,-2.4
make object cone 6,2
make mesh from object 1,6
delete object 6
add limb Player,6,1
delete mesh 1
offset limb Player,6,0,-1.5,0
color object Player,rgb(255,200,0)
scale object Player,40,60,40
xrotate object Player,270
fix object pivot Player
position object Player,0,0,-55
 
set ambient light 0
make light Cam
set light range Cam,600
 
global Plrdist# = 0.0
global PlrZ#=-30.0
global Touchdown=0
global Gravity#=0.0
 
position object Cam,0,0,-80
point object Cam,0,0,0
 
ink rgb(0,255,0),0
 
#constant RepositionSpace : point object Space,object position x(Cam),object position y(Cam),object position z(Cam)
#constant RepositionMoon : point object Moon,object position x(Cam),object position y(Cam),object position z(Cam)
 
do
   Plrdist# = intersect object(Moon,0,0,object position z(Player),0,0,0)
 
   if spacekey()=1 then Gravity# = curvevalue(-0.75,Gravity#,15) : Touchdown=0
   if spacekey()=0 and Plrdist# > abs(object size z(Player)/2) then Gravity# = curvevalue(0.75,Gravity#,20)
 
   if Plrdist# <= abs(object size z(Player)/2) then Gravity# = 0.0 : PlrZ#=-(25+abs(object size z(Player)/2)) : Touchdown=1
 
   if rightkey()=1 and Touchdown=0 then point object Cam,0,0,0 : move object left Cam,0.5
   if leftkey()=1 and Touchdown=0 then point object Cam,0,0,0 : move object right Cam,0.5
   if upkey()=1 and Touchdown=0 then point object Cam,0,0,0 : move object down Cam,0.5
   if downkey()=1 and Touchdown=0 then point object Cam,0,0,0 : move object up Cam,0.5
 
   if Touchdown=0 then inc PlrZ#,Gravity#
 
   position object Player,0,0,PlrZ#
   position camera Cam,object position x(Cam),object position y(Cam),object position z(Cam)
   set camera to object orientation Cam,Cam
   position light Cam,camera position x(Cam),camera position y(Cam),camera position z(Cam)
   point light Cam,0,0,0
 
   position camera Person,0,0,limb position z(Player,6)
   zrotate camera Person,camera angle z(Person)+0.5
   set camera view Person,512-97,0,512+97,120
   center text 512,5,"MODULE CAMERA"
 
   RepositionSpace : RepositionMoon
 
   sync
loop