set display mode 1024,768,32
hide mouse
backdrop on:color backdrop 0
sync on
make camera 1:make camera 2
position camera 1,0,150,0
position camera 2,0,100,0
make light 1
set spot light 1,90,160
set light range 1,500
position light 1,0,250,0
point light 1,0,300,0
make object plain 21,1000,1000
color object 21,rgb(255,128,64)
position object 21,0,350,0
set object cull 21,0
xrotate object 21,270.0
make object plain 22,1000,1000
color object 22,rgb(64,128,255)
position object 22,0,-350,0
xrotate object 22,270.0
set object cull 22,0
create bitmap 1,128,128
set current bitmap 1
ink rgb(0,0,64),0
box 0,0,127,127
ink rgb(255,255,255),0
set text size 10
text 20,60,"BASIC"
get image 2,0,0,127,127,1
set current bitmap 0
make object plain 2,32,32
position object 2,0,100,80
make object plain 3,32,32
position object 3,0,100,80
disable object zdepth 3
for x=4 to 7
  create bitmap x,64,64
  set current bitmap x
  ink rgb(128,0,0),0
  box 0,0,63,63
  ink rgb(255,255,255),0
  set text size 40
  set cursor 20,10
  print mid$("DARK",x-3)
  get image x,0,0,63,63,1
next x
set current bitmap 0
for x=4 to 7
  make object cube x,20
  position object x,x*40-220,300,0
  texture object x,x
  rotate object x,rnd(30),rnd(30),rnd(30)
next x
for x=8 to 20
  make object sphere x,20
  position object x,(rnd(10)-5)*10,rnd(10)*-10,(rnd(10)-5)*10
  rotate object x,90.0,0.0,rnd(180)
  texture object x,2
next x
point camera 1,0,200,0
set camera to image 1,3,1024,1024
texture object 3,3
point camera 2,0,0,0
set camera to image 2,8,1024,1024
texture object 2,8
position camera 0,100,65
point camera 0,100,80
set current camera 0
tv=3:move=0:quit=0:speed#=0.1
while quit=0
  for x=4 to 7
    rotate object x,object angle x(x)+1.0,object angle y(x)+1.0,object angle z(x)+1.0
  next x
  for x=8 to 20
    zrotate object x,object angle z(x)+3.0
  next x
  if entry$()<>""
    i$=entry$()
    clear entry buffer
    if asc(i$)>48 and asc(i$)<57 then move=val(i$)
  endif
  if move>0
    position object tv,object position x(tv),object position y(tv),object position z(tv)+speed#
    if move=2
      position object tv,object position x(tv)+speed#,object position y(tv),object position z(tv)
      zrotate object tv,object angle z(tv)-speed#
    endif
    if move=3
      position object tv,object position x(tv)-speed#,object position y(tv),object position z(tv)
      zrotate object tv,object angle z(tv)+speed#
    endif
    if move=4 then xrotate object tv,object angle x(tv)+speed#*2.0
    if move=5 then zrotate object tv,object angle z(tv)+speed#*2.0
    speed#=speed#*1.1
    if speed#>40.0
      move=0
      speed#=0.1
      enable object zdepth tv
      tv=5-tv
      position object 5-tv,object position x(tv),object position y(tv),object position z(tv)
      rotate object 5-tv,0,180,0
      disable object zdepth tv
    endif
  endif
  if i$=chr$(27) then quit=1
  sync
endwhile