TGC Codebase Backup



Sphere Hopper (Level 1) by Daygamer

6th Mar 2009 13:57
Summary

Jump gaps, ride moving platform and dodge enemies. No Media!



Description

Welcome to Sphere Hopper. This is the Internet version my best game so far. The real version had sound, and a skybox, and you had to do the levels in order, but this is just about as good. I'm working on Sphere Hopper 2, and it is much improved in every way. I hope to make a webpage to put them on someday, but you can go ahead and give this version a try right now if you want. I had to split the game up into three program to fit it on Dark Basic's wonderful website. The goal of my game is to get to the endgate which is a blue sphere. Ride moving platforms and watch out for Sphere's enemies. Also, for fun, you can collect the jewel scatter across the level. See if you can grab all six on every level. The first level is fun but difficult. Good Luck, and please try level two when you're done!!!



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    hide mouse
ink rgb(85,0,85),0

Menu:
cls
do
set text size 30 : center text 320,50,"PRESS SPACE TO PLAY OR"
set text size 30 : center text 320,90,"PRESS ENTER TO SEE CONTROLS"
if spacekey()=1
gosub L1
endif
if returnkey()=1
gosub HTP
endif
loop

HTP:
cls
wait 200
set text size 25 : center text 200,30,"UP = MOVE FORWARD"
set text size 25 : center text 200,70,"DOWN = MOVE BACKWARD"
set text size 25 : center text 200,110,"RIGHT = TURN RIGHT"
set text size 25 : center text 500,30,"LEFT = TURN LEFT"
set text size 25 : center text 500,70,"SPACE = JUMP"
set text size 25 : center text 500,110,"P = PAUSE"
set text size 20 : center text 320,170,"PRESS ENTER TO RETURN TO MENU"
do
if returnkey()=1
gosub Menu
endif
loop

rem level 1 ================================================================
L1:
cls
set text size 80 : center text 320,170,"SPHERE HOPPER"
wait 1000
set text size 70 : center text 320,250,"LEVEL 1"
wait 3000
cls
autocam off : hide mouse
sync on : sync rate 30
ink rgb(1000,1000,1000),0

rem controled object
make object sphere 1,1.5
color object 1,rgb(30,30,225)
position object 1,0,5,0
make object collision box 1,-0.5,-0.5,-0.5,0.5,0.5,0.5,0

rem end gate
make object sphere 99,8
color object 99,rgb(30,30,225)
position object 99,160,13.75,-37
ghost object on 99

make object box 98,5,0,5
position object 98,160,13.75,-37
hide object 98

rem sky
color backdrop 0

rem ground boxes
make object box 3,20,2,20
color object 3,rgb(85,0,85)
make static object 3
objx#=object position x(3)
objy#=object position y(3)
objz#=object position z(3)
objsx#=object size x(3)/2.0
objsy#=object size y(3)/2.0
objsz#=object size z(3)/2.0
make static collision box objx#-objsx#,objy#-objsy#,objz#-objsz#,objx#+objsx#,objy#+objsy#,objz#+objsz#

make object box 4,7.5,2,10
color object 4,rgb(85,0,85)
position object 4,0,0,15
make static object 4
objx#=object position x(4)
objy#=object position y(4)
objz#=object position z(4)
objsx#=object size x(4)/2.0
objsy#=object size y(4)/2.0
objsz#=object size z(4)/2.0
make static collision box objx#-objsx#,objy#-objsy#,objz#-objsz#,objx#+objsx#,objy#+objsy#,objz#+objsz#

make object box 5,20,2,10
color object 5,rgb(85,0,85)
position object 5,0,0,25
make static object 5
objx#=object position x(5)
objy#=object position y(5)
objz#=object position z(5)
objsx#=object size x(5)/2.0
objsy#=object size y(5)/2.0
objsz#=object size z(5)/2.0
make static collision box objx#-objsx#,objy#-objsy#,objz#-objsz#,objx#+objsx#,objy#+objsy#,objz#+objsz#

make object box 6,7.5,2,10
color object 6,rgb(85,0,85)
position object 6,6.25,0,35
make static object 6
objx#=object position x(6)
objy#=object position y(6)
objz#=object position z(6)
objsx#=object size x(6)/2.0
objsy#=object size y(6)/2.0
objsz#=object size z(6)/2.0
make static collision box objx#-objsx#,objy#-objsy#,objz#-objsz#,objx#+objsx#,objy#+objsy#,objz#+objsz#

make object box 7,20,2,10
color object 7,rgb(85,0,85)
position object 7,0,0,50
make static object 7
objx#=object position x(7)
objy#=object position y(7)
objz#=object position z(7)
objsx#=object size x(7)/2.0
objsy#=object size y(7)/2.0
objsz#=object size z(7)/2.0
make static collision box objx#-objsx#,objy#-objsy#,objz#-objsz#,objx#+objsx#,objy#+objsy#,objz#+objsz#

make object box 9,20,2,10
color object 9,rgb(85,0,85)
position object 9,0,0,100
make static object 9
objx#=object position x(9)
objy#=object position y(9)
objz#=object position z(9)
objsx#=object size x(9)/2.0
objsy#=object size y(9)/2.0
objsz#=object size z(9)/2.0
make static collision box objx#-objsx#,objy#-objsy#,objz#-objsz#,objx#+objsx#,objy#+objsy#,objz#+objsz#

make object box 8,20,2,10
color object 8,rgb(85,0,85)
position object 8,70,0,100
make static object 8
objx#=object position x(8)
objy#=object position y(8)
objz#=object position z(8)
objsx#=object size x(8)/2.0
objsy#=object size y(8)/2.0
objsz#=object size z(8)/2.0
make static collision box objx#-objsx#,objy#-objsy#,objz#-objsz#,objx#+objsx#,objy#+objsy#,objz#+objsz#

make object box 10,40,2,20
color object 10,rgb(85,0,85)
position object 10,70,0,50
make static object 10
objx#=object position x(10)
objy#=object position y(10)
objz#=object position z(10)
objsx#=object size x(10)/2.0
objsy#=object size y(10)/2.0
objsz#=object size z(10)/2.0
make static collision box objx#-objsx#,objy#-objsy#,objz#-objsz#,objx#+objsx#,objy#+objsy#,objz#+objsz#

make object box 11,8,2,8
color object 11,rgb(85,0,85)
position object 11,-25,0,100
make static object 11
objx#=object position x(11)
objy#=object position y(11)
objz#=object position z(11)
objsx#=object size x(11)/2.0
objsy#=object size y(11)/2.0
objsz#=object size z(11)/2.0
make static collision box objx#-objsx#,objy#-objsy#,objz#-objsz#,objx#+objsx#,objy#+objsy#,objz#+objsz#

make object box 12,8,2,8
color object 12,rgb(85,0,85)
position object 12,115,12,15
make static object 12
objx#=object position x(12)
objy#=object position y(12)
objz#=object position z(12)
objsx#=object size x(12)/2.0
objsy#=object size y(12)/2.0
objsz#=object size z(12)/2.0
make static collision box objx#-objsx#,objy#-objsy#,objz#-objsz#,objx#+objsx#,objy#+objsy#,objz#+objsz#

make object box 13,8,2,8
color object 13,rgb(85,0,85)
position object 13,115,9,30
make static object 13
objx#=object position x(13)
objy#=object position y(13)
objz#=object position z(13)
objsx#=object size x(13)/2.0
objsy#=object size y(13)/2.0
objsz#=object size z(13)/2.0
make static collision box objx#-objsx#,objy#-objsy#,objz#-objsz#,objx#+objsx#,objy#+objsy#,objz#+objsz#

make object box 14,8,2,8
color object 14,rgb(85,0,85)
position object 14,100,6,30
make static object 14
objx#=object position x(14)
objy#=object position y(14)
objz#=object position z(14)
objsx#=object size x(14)/2.0
objsy#=object size y(14)/2.0
objsz#=object size z(14)/2.0
make static collision box objx#-objsx#,objy#-objsy#,objz#-objsz#,objx#+objsx#,objy#+objsy#,objz#+objsz#

make object box 15,8,2,8
color object 15,rgb(85,0,85)
position object 15,100,3,45
make static object 15
objx#=object position x(15)
objy#=object position y(15)
objz#=object position z(15)
objsx#=object size x(15)/2.0
objsy#=object size y(15)/2.0
objsz#=object size z(15)/2.0
make static collision box objx#-objsx#,objy#-objsy#,objz#-objsz#,objx#+objsx#,objy#+objsy#,objz#+objsz#

make object box 16,8,2,8
color object 16,rgb(85,0,85)
position object 16,44,3,56
make static object 16
objx#=object position x(16)
objy#=object position y(16)
objz#=object position z(16)
objsx#=object size x(16)/2.0
objsy#=object size y(16)/2.0
objsz#=object size z(16)/2.0
make static collision box objx#-objsx#,objy#-objsy#,objz#-objsz#,objx#+objsx#,objy#+objsy#,objz#+objsz#

make object box 17,8,2,8
color object 17,rgb(85,0,85)
position object 17,44,6,66
make static object 17
objx#=object position x(17)
objy#=object position y(17)
objz#=object position z(17)
objsx#=object size x(17)/2.0
objsy#=object size y(17)/2.0
objsz#=object size z(17)/2.0
make static collision box objx#-objsx#,objy#-objsy#,objz#-objsz#,objx#+objsx#,objy#+objsy#,objz#+objsz#

make object box 18,8,2,8
color object 18,rgb(85,0,85)
position object 18,44,9,76
make static object 18
objx#=object position x(18)
objy#=object position y(18)
objz#=object position z(18)
objsx#=object size x(18)/2.0
objsy#=object size y(18)/2.0
objsz#=object size z(18)/2.0
make static collision box objx#-objsx#,objy#-objsy#,objz#-objsz#,objx#+objsx#,objy#+objsy#,objz#+objsz#

make object box 19,8,2,8
color object 19,rgb(85,0,85)
position object 19,34,9,76
make static object 19
objx#=object position x(19)
objy#=object position y(19)
objz#=object position z(19)
objsx#=object size x(19)/2.0
objsy#=object size y(19)/2.0
objsz#=object size z(19)/2.0
make static collision box objx#-objsx#,objy#-objsy#,objz#-objsz#,objx#+objsx#,objy#+objsy#,objz#+objsz#

make object box 20,30,2,30
color object 20,rgb(85,0,85)
position object 20,30,12,97
make static object 20
objx#=object position x(20)
objy#=object position y(20)
objz#=object position z(20)
objsx#=object size x(20)/2.0
objsy#=object size y(20)/2.0
objsz#=object size z(20)/2.0
make static collision box objx#-objsx#,objy#-objsy#,objz#-objsz#,objx#+objsx#,objy#+objsy#,objz#+objsz#

make object box 21,30,2,10
color object 21,rgb(85,0,85)
position object 21,30,12,127
make static object 21
objx#=object position x(21)
objy#=object position y(21)
objz#=object position z(21)
objsx#=object size x(21)/2.0
objsy#=object size y(21)/2.0
objsz#=object size z(21)/2.0
make static collision box objx#-objsx#,objy#-objsy#,objz#-objsz#,objx#+objsx#,objy#+objsy#,objz#+objsz#

make object box 22,30,2,6
color object 22,rgb(85,0,85)
position object 22,73,12,125
make static object 22
objx#=object position x(22)
objy#=object position y(22)
objz#=object position z(22)
objsx#=object size x(22)/2.0
objsy#=object size y(22)/2.0
objsz#=object size z(22)/2.0
make static collision box objx#-objsx#,objy#-objsy#,objz#-objsz#,objx#+objsx#,objy#+objsy#,objz#+objsz#

make object box 23,8,2,8
color object 23,rgb(85,0,85)
position object 23,30,14,220
make static object 23
objx#=object position x(23)
objy#=object position y(23)
objz#=object position z(23)
objsx#=object size x(23)/2.0
objsy#=object size y(23)/2.0
objsz#=object size z(23)/2.0
make static collision box objx#-objsx#,objy#-objsy#,objz#-objsz#,objx#+objsx#,objy#+objsy#,objz#+objsz#

make object box 24,8,2,8
color object 24,rgb(85,0,85)
position object 24,30,14,170
make static object 24
objx#=object position x(24)
objy#=object position y(24)
objz#=object position z(24)
objsx#=object size x(24)/2.0
objsy#=object size y(24)/2.0
objsz#=object size z(24)/2.0
make static collision box objx#-objsx#,objy#-objsy#,objz#-objsz#,objx#+objsx#,objy#+objsy#,objz#+objsz#

make object box 25,30,2,6
color object 25,rgb(85,0,85)
position object 25,115,12,125
make static object 25
objx#=object position x(25)
objy#=object position y(25)
objz#=object position z(25)
objsx#=object size x(25)/2.0
objsy#=object size y(25)/2.0
objsz#=object size z(25)/2.0
make static collision box objx#-objsx#,objy#-objsy#,objz#-objsz#,objx#+objsx#,objy#+objsy#,objz#+objsz#

make object box 26,30,2,6
color object 26,rgb(85,0,85)
position object 26,160,12,125
make static object 26
objx#=object position x(26)
objy#=object position y(26)
objz#=object position z(26)
objsx#=object size x(26)/2.0
objsy#=object size y(26)/2.0
objsz#=object size z(26)/2.0
make static collision box objx#-objsx#,objy#-objsy#,objz#-objsz#,objx#+objsx#,objy#+objsy#,objz#+objsz#

make object box 27,30,2,30
color object 27,rgb(85,0,85)
position object 27,160,12,-37
make static object 27
objx#=object position x(27)
objy#=object position y(27)
objz#=object position z(27)
objsx#=object size x(27)/2.0
objsy#=object size y(27)/2.0
objsz#=object size z(27)/2.0
make static collision box objx#-objsx#,objy#-objsy#,objz#-objsz#,objx#+objsx#,objy#+objsy#,objz#+objsz#

rem jewels
make object cube 175,1
make object cone 75,1 : xrotate object 75,180 : color object 75,rgb(750,10,0)
position object 75,-7,2,25
position object 175,-7,2,25
hide object 175

make object cube 176,1
make object cone 76,1 : xrotate object 76,180 : color object 76,rgb(750,10,0)
position object 76,-25,2,100
position object 176,-25,2,100
hide object 176

make object cube 177,1
make object cone 77,1 : xrotate object 77,180 : color object 77,rgb(750,10,0)
position object 77,115,14,15
position object 177,115,14,15
hide object 177

make object cube 178,1
make object cone 78,1 : xrotate object 78,180 : color object 78,rgb(750,10,0)
position object 78,34,11,76
position object 178,34,11,76
hide object 178

make object cube 179,1
make object cone 79,1 : xrotate object 79,180 : color object 79,rgb(750,10,0)
position object 79,30,16,220
position object 179,30,16,220
hide object 179

make object cube 180,1
make object cone 80,1 : xrotate object 80,180 : color object 80,rgb(750,10,0)
position object 80,160,14,50
position object 180,160,14,50
hide object 180

rem jewel conterparts
make object cone 275,1 : xrotate object 275,180
position object 275,165,21,-37.5

make object cone 276,1 : xrotate object 276,180
position object 276,163,21,-37.5

make object cone 277,1 : xrotate object 277,180
position object 277,161,21,-37.5

make object cone 278,1 : xrotate object 278,180
position object 278,159,21,-37.5

make object cone 279,1 : xrotate object 279,180
position object 279,157,21,-37.5

make object cone 280,1 : xrotate object 280,180
position object 280,155,21,-37.5

rem moving platforms
make object box 100,10,1,10
color object 100,rgb(0,100,0)
position object 100,0,-0.1,70
make object collision box 100,-5,-1,-5,5,1,5,0

make object box 101,10,1,10
color object 101,rgb(0,100,0)
position object 101,30,-0.1,100
point object 101,100,-0.1,100
make object collision box 101,-5,-1,-5,5,1,5,0

make object box 102,10,1,10
color object 102,rgb(0,100,0)
position object 102,70,-0.1,70
make object collision box 102,-5,-1,-5,5,1,5,0

make object box 103,10,1,10
color object 103,rgb(0,100,0)
position object 103,30,12,150
make object collision box 103,-5,-1,-5,5,1,5,0

make object box 104,10,1,10
color object 104,rgb(0,100,0)
position object 104,160,12,75
make object collision box 104,-5,-1,-5,5,1,5,0
point object 104,160,12,125

make object box 105,10,1,10
color object 105,rgb(0,100,0)
position object 105,160,12,25
make object collision box 105,-5,-1,-5,5,1,5,0
point object 105,160,12,-25

rem enimies
make object box 200,5,5,5
color object 200,rgb(1000,10,10)
position object 200,70,2.5,45
point object 200,60,2.5,45

make object box 201,5,5,5
color object 201,rgb(1000,10,10)
position object 201,70,2.5,55
point object 201,80,2.5,55

make object box 202,5,5,5
color object 202,rgb(1000,10,10)
position object 202,40,14,97
point object 202,42.5,14,85

make object box 203,5,5,5
color object 203,rgb(1000,10,10)
position object 203,20,14,97
point object 203,18.5,14,110

make object box 204,5,5,5
color object 204,rgb(1000,10,10)
position object 204,30,14,87
point object 204,18.5,14,85

make object box 205,5,5,5
color object 205,rgb(1000,10,10)
position object 205,30,14,107
point object 205,42.5,14,110

make object box 206,5,5,5
color object 206,rgb(1000,10,10)
position object 206,73,14,125
point object 206,70,14,125

make object box 207,5,5,5
color object 207,rgb(1000,10,10)
position object 207,160,14,125
point object 207,70,14,125

rem stopers
make object box 300,0,5,20
position object 300,50,0,50
hide object 300

make object box 301,0,5,20
position object 301,90,0,50
hide object 301

make object box 302,1,1,1
position object 302,42.5,14,85
hide object 302

make object box 303,1,1,1
position object 303,18.5,14,85
hide object 303

make object box 304,1,1,1
position object 304,18.5,14,110
hide object 304

make object box 305,1,1,1
position object 305,42.5,14,110
hide object 305

make object box 306,8,2,0
position object 306,30,12,228
hide object 306

make object box 307,0,2,10
position object 307,88,14,125
hide object 307

make object box 308,0,2,10
position object 308,58,14,125
hide object 308

make object box 309,0,2,10
position object 309,175,14,125
hide object 309

make object box 310,0,2,10
position object 310,145,14,125
hide object 310

make object box 350,3000,100,3000
position object 350,0,-80,0
hide object 350

rem start off player gravity
playergrav#=0.1

rem
rem MX# = object position x(100)
rem MY# = object position y(100)

rem main loop --------------------------------------------------------------
do

rem level 1 print
center text 320,20,"LEVEL 1"
set text to italic
set text size 40

rem move platforms and enimies; rotate jewels
move object 100,0.08
move object 101,0.08
move object 102,0.08
move object 200,0.2
move object 201,0.2
move object 202,0.2
move object 203,0.2
move object 204,0.2
move object 205,0.2
move object 206,0.2
move object 103,0.08
move object 207,0.2
move object 104,0.08
move object 105,0.08
yrotate object 75,wrapvalue(object angle y(75)-2)
yrotate object 76,wrapvalue(object angle y(76)-2)
yrotate object 77,wrapvalue(object angle y(77)-2)
yrotate object 78,wrapvalue(object angle y(78)-2)
yrotate object 79,wrapvalue(object angle y(79)-2)
yrotate object 80,wrapvalue(object angle y(80)-2)

rem pickup jewel
if object collision(1,175) then hide object 75 : position object 175,0,-80,0 : color object 275,rgb(750,10,0)
if object collision(1,176) then hide object 76 : position object 176,0,-80,0 : color object 276,rgb(750,10,0)
if object collision(1,177) then hide object 77 : position object 177,0,-80,0 : color object 277,rgb(750,10,0)
if object collision(1,178) then hide object 78 : position object 178,0,-80,0 : color object 278,rgb(750,10,0)
if object collision(1,179) then hide object 79 : position object 179,0,-80,0 : color object 279,rgb(750,10,0)
if object collision(1,180) then hide object 80 : position object 180,0,-80,0 : color object 280,rgb(750,10,0)

if object collision(350,180) then yrotate object 280,wrapvalue(object angle y(280)-4)
if object collision(350,179) then yrotate object 279,wrapvalue(object angle y(279)-4)
if object collision(350,178) then yrotate object 278,wrapvalue(object angle y(278)-4)
if object collision(350,177) then yrotate object 277,wrapvalue(object angle y(277)-4)
if object collision(350,176) then yrotate object 276,wrapvalue(object angle y(276)-4)
if object collision(350,175) then yrotate object 275,wrapvalue(object angle y(275)-4)

rem control moving platforms
if object collision(100,7) then point object 100,0,0,100
if object collision(100,9) then point object 100,0,0,50

if object collision(101,9) then point object 101,50,0,100
if object collision(101,8) then point object 101,0,0,100

if object collision(102,8) then point object 102,70,0,50
if object collision(102,10) then point object 102,70,0,100

if object collision(103,21) then point object 103,30,12,200
if object collision(103,306) then point object 103,30,12,150

if object collision(104,26) then point object 104,160,12,-25
if object collision(104,105) then point object 104,160,12,125 : point object 105,160,12,-25

if object collision(105,27) then point object 105,160,12,125

rem control enimies
if object collision(200,300) then point object 200,70,2.5,45
if object collision(200,301) then point object 200,70,2.5,45

if object collision(201,300) then point object 201,70,2.5,55
if object collision(201,301) then point object 201,70,2.5,55

if object collision(202,302) then point object 202,18.5,14,85
if object collision(202,303) then point object 202,18.5,14,110
if object collision(202,304) then point object 202,42.5,14,110
if object collision(202,305) then point object 202,42.5,14,85

if object collision(203,302) then point object 203,18.5,14,85
if object collision(203,303) then point object 203,18.5,14,110
if object collision(203,304) then point object 203,42.5,14,110
if object collision(203,305) then point object 203,42.5,14,85

if object collision(204,302) then point object 204,18.5,14,85
if object collision(204,303) then point object 204,18.5,14,110
if object collision(204,304) then point object 204,42.5,14,110
if object collision(204,305) then point object 204,42.5,14,85

if object collision(205,302) then point object 205,18.5,14,85
if object collision(205,303) then point object 205,18.5,14,110
if object collision(205,304) then point object 205,42.5,14,110
if object collision(205,305) then point object 205,42.5,14,85

if object collision(206,307) then point object 206,58,14,125
if object collision(206,308) then point object 206,88,14,125

if object collision(207,309) then point object 207,145,14,125
if object collision(207,310) then point object 207,175,14,125

rem game over
if object collision(1,350) then delete object 350 : wait 3000 : position object 1,0,5,0 : point object 1,0,0,100 : make object box 350,3000,100,3000 : position object 350,0,-100,0 : hide object 350
if object collision(1,200) then wait 3000 : position object 1,0,5,0 : point object 1,0,0,100
if object collision(1,201) then wait 3000 : position object 1,0,5,0 : point object 1,0,0,100
if object collision(1,202) then wait 3000 : position object 1,0,5,0 : point object 1,0,0,100
if object collision(1,203) then wait 3000 : position object 1,0,5,0 : point object 1,0,0,100
if object collision(1,204) then wait 3000 : position object 1,0,5,0 : point object 1,0,0,100
if object collision(1,205) then wait 3000 : position object 1,0,5,0 : point object 1,0,0,100
if object collision(1,206) then wait 3000 : position object 1,0,5,0 : point object 1,0,0,100
if object collision(1,207) then wait 3000 : position object 1,0,5,0 : point object 1,0,0,100

rem enter endgate
if object collision(1,98) then if spacekey()=1
delete object 3
delete object 4
delete object 5
delete object 6
delete object 7
delete object 8
delete object 9
delete object 10
delete object 11
delete object 12
delete object 13
delete object 14
delete object 15
delete object 16
delete object 17
delete object 18
delete object 19
delete object 20
delete object 21
delete object 22
delete object 23
delete object 24
delete object 25
delete object 26
delete object 27
delete object 300
delete object 301
delete object 302
delete object 303
delete object 304
delete object 305
delete object 306
delete object 307
delete object 308
delete object 309
delete object 310
delete object 350
gosub W
endif

rem Store old positions
oldposx#=object position x(1)
oldposy#=object position y(1)
oldposz#=object position z(1)

rem controls
if upkey()=1 then move object 1,0.35
if downkey()=1 then move object 1,-0.35
if leftkey()=1 then yrotate object 1,wrapvalue(object angle y(1)-3)
if rightkey()=1 then yrotate object 1,wrapvalue(object angle y(1)+3)
if spacekey()=1 and playergrav#=0 then playergrav#=0.35
if inkey$()="p" then wait 500 : suspend for key
if inkey$()="t" then position camera 0,5,-1 : point camera 0,5,0

rem get current object position
posx#=object position x(1)
posy#=object position y(1)
posz#=object position z(1)

rem gravity
playergrav#=playergrav#-0.01
posy#=posy#+playergrav#

rem sliding collision
position object 1,posx#,posy#,posz#
if object collision(1,0)>0
	dec posx#,get object collision x()
	dec posy#,get object collision y()
	dec posz#,get object collision z()
	playergrav#=-0.0
endif

rem Set size for controled object
s#=object size y(1)/2.0

rem Ensure camera stays out of static boxes
if get static collision hit(oldposx#-s#,oldposy#-s#,oldposz#-s#,oldposx#+s#,oldposy#+s#,oldposz#+s#,posx#-s#,posy#-s#,posz#-s#,posx#+s#,posy#+s#,posz#+s#)=1
	dec posx#,get static collision x()
	dec posy#,get static collision y()
	dec posz#,get static collision z()	
	if get static collision y()<>0.0 then playergrav#=0.0
endif

rem Update with new object position
position object 1,posx#,posy#,posz#

rem camera
angle#=object angle y(1)
camdist#=5.5 : camhigh#=posy#+0.8 : camfade#=3.5
set camera to follow posx#,posy#,posz#,angle#,camdist#,camhigh#,camfade#,1
xrotate camera 10

rem end loop
sync
loop
rem win
W:
do
set text to bold : set text size 60 : center text 320,70,"CONGRATULATIONS"
set text size 40 : center text 320,130,"TRY THE OTHER TWO LEVELS"
loop
suspend for key
end