Rem DBC Programming Challenges
Rem a.i. Challenge
Rem By:Ton3e
 
Gosub Setup
 
Do
 gosub movement
 
 Sync
 Loop
End
 
 
Setup:
  Sync On
  CLS 0
 
  `make 3 big cubes and texture them
  Ink RGB(0,0,255),0: Box 2,2,254,254
  Ink RGB(125,125,125),0
  box 0,0,20,254
  box 20,0,254,20
  box 234,20,254,254
  box 20,234,234,254
  ink 0,0
  line 0,0,20,20
  line 0,254,20,234
  line 234,20,254,0
  line 234,234,254,254
  circle 10,127,7
  circle 10,63,7
  circle 10,190,7
  circle 63,10,7
  circle 127,10,7
  circle 190,10,7
  circle 63,244,7
  circle 127,244,7
  circle 190,244,7
  circle 244,63,7
  circle 244,127,7
  circle 244,190,7
  Get Image 1,0,0,256,256
 
   make object sphere 1,3
   texture object 1,1
 
  `make one small cube and texture it
  Ink 0,0: Box 2,2,254,254
  Ink RGB(255,255,255),0
  box 0,0,20,254
  box 20,0,254,20
  box 234,20,254,254
  box 20,234,234,254
  ink 0,0
  line 0,0,20,20
  line 0,254,20,234
  line 234,20,254,0
  line 234,234,254,254
  circle 10,127,7
  circle 10,63,7
  circle 10,190,7
  circle 63,10,7
  circle 127,10,7
  circle 190,10,7
  circle 63,244,7
  circle 127,244,7
  circle 190,244,7
  circle 244,63,7
  circle 244,127,7
  circle 244,190,7
  Get Image 2,0,0,256,256
  make object SPHERE 4,3
  texture object 4,2
 
  `make platform
  ink rgb(255,255,255),0
  box 0,0,32,32
  ink 0,0
  line 16,0,16,32
  line 0,16,32,16
  line 8,0,8,32
  line 0,8,32,8
  line 0,24,32,24
  line 24,0,24,32
  get image 3,0,0,32,32
  make object box 5,25,1,25
  texture object 5,3
Return
 
 
movement:
   `player movement with arrow keys
   KEY=0
   if upkey()=1 and key=0
      zpos#=zpos#+.5
      XRotate Object 4,WrapValue(Object Angle X(4)+45)
      key=1
   endif
   if downkey()=1 and key=0
      zpos#=zpos#-.5
      XRotate Object 4,WrapValue(Object Angle X(4)-45)
      key=1
   endif
   If rightkey()=1 and key=0
      xpos#=xpos#+.5
      zRotate Object 4,WrapValue(Object Angle Z(4)+45)
      key=1
   endif
   if leftkey()=1 and key=0
      xpos#=xpos#-.5
      zRotate Object 4,WrapValue(Object Angle Z(4)-45)
      key=1
   `make a 25x25 boundary
   if xpos#>12.5 then xpos#=12.5
   if xpos#<-12.5 then xpos#=-12.5
   if zpos#<-12.5 then zpos#=-12.5
   if zpos#>12.5 then zpos#=12.5
 
   `position object
   position object 4,xpos#,0,zpos#
   position object 5,0,-1,0
 
   `camera
   position camera 0,20,-20
   point camera 0,0,0
return