sync on
sync rate 60
 
for i=0 to 31
  ink rgb(i*8,i*8,i*8),0
  line 0,i,31,i
  ink rgb(sin(i*5.625)*255,sin(i*5.625)*80,0),0
  line i,32,i,63
next i
 
get image 3,0,32,31,63
 
autocam off
 
 
type coordXYZ
 
   X as Float
   Y as Float
   Z as Float
 
endtype
 
 
type sizes
 
   Height as Float
   Depth as Float
   Width as Float
 
endtype
 
 
type terrainobj
 
   Pos as coordXYZ
   Size as sizes
   Object as Integer
 
endtype
 
 
type playerobj
 
   Pos as coordXYZ
   Object as Integer
   Frame01 as Integer
   Frame02 as Integer
   Frame03 as Integer
   Frame04 as Integer
   Frame05 as Integer
   LaserLeft as Integer
   LaserRight as Integer
 
endtype
 
 
 
 
dim Cubes(40) as terrainobj
 
for i = 0 to array count(Cubes())
 
   Cubes(i).Size.Height = 80+rnd(30)
   Cubes(i).Size.Depth = 80+rnd(10)
   Cubes(i).Size.Width = 20+rnd(10)
   if i MOD 2 = 0
      Cubes(i).Pos.X = 65+rnd(30)
      Cubes(i).Pos.Y = 0
      Cubes(i).Pos.Z = (INT(i*0.5))*50
   else
      Cubes(i).Pos.X = -95+rnd(30)
      Cubes(i).Pos.Y = 0
      Cubes(i).Pos.Z = (INT(i*0.5))*50
   endif
 
   Cubes(i).Object = 100+i
 
   make object Box Cubes(i).Object, Cubes(i).Size.Width, Cubes(i).Size.Height, Cubes(i).Size.Depth
   position object Cubes(i).Object, Cubes(i).Pos.X, Cubes(i).Pos.Y, Cubes(i).Pos.Z
 
   set object collision on Cubes(i).Object
   set object collision to boxes Cubes(i).Object
 
next i
 
dim Frip(20) as terrainobj
 
for i = 0 to array count (Frip())
 
   Frip(i).Size.Height = 10+rnd(5)
   Frip(i).Size.Depth = 20+rnd(60)
   Frip(i).Size.Width = Frip(i).Size.Depth
   if i MOD 2 = 0
      Frip(i).Pos.X = 95+rnd(900)
      Frip(i).Pos.Y = 20
      Frip(i).Pos.Z = (INT(i*0.5))*50
   else
      Frip(i).Pos.X = -95-rnd(900)
      Frip(i).Pos.Y = 20
      Frip(i).Pos.Z = (INT(i*0.5))*50
   endif
 
   Frip(i).Object = 200+i
 
   make object Box Frip(i).Object, Frip(i).Size.Width, Frip(i).Size.Height, Frip(i).Size.Depth
   position object Frip(i).Object, Frip(i).Pos.X, Frip(i).Pos.Y, Frip(i).Pos.Z
 
 
next i
 
 
Player as playerobj
 
Player.Object = 999
make object cube Player.Object,1
set object collision on Player.Object
set object collision to boxes Player.Object
 
Player.Pos.X = 0
Player.Pos.Y = 0
Player.Pos.Z = 0
 
Player.Frame01 = 1000
make object box Player.Frame01,0.1,0.1,10
glue object to limb  Player.Frame01, Player.Object, 0
Position Object Player.Frame01, Player.Pos.X+1.5, Player.Pos.Y+0.75, Player.Pos.Z+1
rotate object Player.Frame01,15,-5,0
 
Player.Frame02 = 1001
make object box Player.Frame02,0.1,0.1,10
glue object to limb  Player.Frame02, Player.Object, 0
Position Object Player.Frame02, Player.Pos.X-1.5, Player.Pos.Y+0.75, Player.Pos.Z+1
rotate object Player.Frame02,15,5,0
 
Player.Frame03 = 1002
make object box Player.Frame03,0.1,3,10
glue object to limb  Player.Frame03, Player.Object, 0
Position Object Player.Frame03, Player.Pos.X-1.5, Player.Pos.Y-2.1  , Player.Pos.Z+1
rotate object Player.Frame03,0,5,0
 
Player.Frame04 = 1003
make object box Player.Frame04,0.1,3,10
glue object to limb  Player.Frame04, Player.Object, 0
Position Object Player.Frame04, Player.Pos.X+1.5, Player.Pos.Y-2.1  , Player.Pos.Z+1
rotate object Player.Frame04,0,-5,0
 
Player.Frame05 = 1004
make object box Player.Frame05,2,0.2,10
glue object to limb  Player.Frame05, Player.Object, 0
Position Object Player.Frame05, Player.Pos.X, Player.Pos.Y-2  , Player.Pos.Z+1
rotate object Player.Frame05,-16,0,0
 
Player.LaserLeft = 1005
make object plain Player.LaserLeft,2,600
set object Player.LaserLeft,1,0,0,2,0
ghost object on Player.LaserLeft
set alpha mapping on Player.LaserLeft,100
texture object Player.LaserLeft,3
glue object to limb Player.LaserLeft, Player.Object, 0
rotate object Player.LaserLeft,-90,0,0
position object Player.LaserLeft,Player.Pos.X-3,Player.Pos.Y-0.5, Player.Pos.Z+300
 
 
Player.LaserRight = 1006
make object plain Player.LaserRight,2,600
set object Player.LaserRight,1,0,0,2,0
ghost object on Player.LaserRight
set alpha mapping on Player.LaserRight,100
texture object Player.LaserRight,3
glue object to limb Player.LaserRight, Player.Object, 0
rotate object Player.LaserRight,-90,0,0
position object Player.LaserRight,Player.Pos.X+3,Player.Pos.Y-0.5, Player.Pos.Z+300
 
hide object Player.LaserRight
hide object Player.LaserLeft
 
 
 
make object plain 2,200,1000
rotate object 2,-90,0,0
position object 2,0,-20,400
 
make object plain 3,1000,1000
rotate object 3,-90,0,0
position object 3,-600,20,400
 
make object plain 4,1000,1000
rotate object 4,-90,0,0
position object 4,600,20,400
 
color backdrop 0
fog on
fog distance 900
 
do
 
 
 
move_graphix()
character_movement()
detect_collision()
 
lasers()
sync
loop
 
 
 
 
function move_graphix()
 
 
for i = 0 to array count(Cubes())
   Cubes(i).Pos.X = Cubes(i).Pos.X
   Cubes(i).Pos.Y = Cubes(i).Pos.Y
   Cubes(i).Pos.Z = Cubes(i).Pos.Z - 5
 
   if  Cubes(i).Pos.Z < -15
       Cubes(i).Pos.Z = 800
      if i MOD 2 = 0
         Cubes(i).Pos.X = 65+rnd(30)
      else
         Cubes(i).Pos.X = -95+rnd(30)
      endif
   endif
 
   position object Cubes(i).Object, Cubes(i).Pos.X, Cubes(i).Pos.Y, Cubes(i).Pos.Z
 
next i
 
 
 
for i = 0 to array count(Frip())
   Frip(i).Pos.X = Frip(i).Pos.X
   Frip(i).Pos.Y = Frip(i).Pos.Y
   Frip(i).Pos.Z = Frip(i).Pos.Z - 5
 
   if  Frip(i).Pos.Z < -15
       Frip(i).Pos.Z = 800
      if i MOD 2 = 0
         Frip(i).Pos.X = 95+rnd(900)
      else
         Frip(i).Pos.X = -95-rnd(900)
      endif
   endif
 
   position object Frip(i).Object, Frip(i).Pos.X, Frip(i).Pos.Y, Frip(i).Pos.Z
 
 
next i
 
 
 
 
endfunction
 
 
 
 
function character_movement()
 
 
if rightkey() = 1
   Player.Pos.X = Player.Pos.X + 1
   rotateamount# = object angle z(Player.Object) + (-15 - object angle z(Player.Object))/7
   zrotate object Player.Object,rotateamount#
else
   if leftkey() = 1
      Player.Pos.X = Player.Pos.X - 1
      rotateamount# = object angle z(Player.Object) + (15 - object angle z(Player.Object))/7
      zrotate object Player.Object,rotateamount#
   else
      rotateamount# = object angle z(Player.Object) + (0 - object angle z(Player.Object))/7
      zrotate object Player.Object,rotateamount#
   endif
endif
 
 
if upkey() = 1
   Player.Pos.Y = Player.Pos.Y + 0.75
   rotateamountx# = object angle x(Player.Object) + (-5 - object angle x(Player.Object))/10
   xrotate object Player.Object,rotateamountx#
else
   if downkey() = 1
      Player.Pos.Y = Player.Pos.Y - 0.75
      rotateamountx# = object angle x(Player.Object) + (5 - object angle x(Player.Object))/10
      xrotate object Player.Object,rotateamountx#
   else
      rotateamountx# = object angle x(Player.Object) + (0 - object angle x(Player.Object))/10
      xrotate object Player.Object,rotateamountx#
   endif
endif
 
Position Camera Player.Pos.X, Player.Pos.Y, Player.Pos.Z
 
Position Object Player.Object, Player.Pos.X, Player.Pos.Y, Player.Pos.Z
rotate camera Object Angle x(Player.Object),0,Object Angle z(Player.Object)
 
 
endfunction
 
 
 
 
function detect_collision()
 
 
if object collision(Player.Object,0) > 0
   set cursor 0,0
   print "OUCH OUCH OUCH OUCH!!!"
endif
 
if object position y(Player.Object) < -18
   set cursor 0,20
   print "FLOOR CRASH!!"
endif
 
endfunction
 
 
 
function lasers()
 
if spacekey() = 1
   show object Player.LaserLeft
   show object Player.LaserRight
else
   hide object Player.LaserLeft
   hide object Player.LaserRight
endif
 
endfunction