TGC Codebase Backup



cube game by Anonymous Coder

20th Sep 2009 10:58
Summary

this is my first game. the aim of the game is to move the cube to the coloured sphere whilst avoiding the white sphres



Description



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    REM Project: cube game
REM Created: 20/09/2009 12:38:41
REM
REM ***** Main Source File *****
REM camera
position camera 0,700,0
point camera 0,0,0
autocam off
set ambient light 100
color ambient light RGB(100,0,20)
make light 1
color light 1,rgb(0,1000,0)
position light 1,200,540,350
point light 1,0,0,0

print "welcome to cube game"
print "there are seven levels to this game"
print "the aim is to move the cube to the coloured sphere"
print "to move the cube use the arrow keys"
print "press any key to continue"
backdrop off : hide mouse
wait key

rem level 1
backdrop on
make object cube 1,50
position object 1,0,0,400
make object sphere 2,100
position object 2,200,0,100
make object sphere 3,100
position object 3,200,0,-100
make object sphere 4,100
position object 4,0,0,200
make object sphere 5,100
position object 5,0,0,-200
make object sphere 6,100
position object 6,-200,0,100
make object sphere 7,100
position object 7,-200,0,-100
make object sphere 8,100
color object 8,RGB(25,50,0)
position object 8,0,0,0
set bsp object collision 2,1,25,1
set bsp object collision 2,2,50,1
set bsp object collision 2,3,50,1
set bsp object collision 2,4,50,1
set bsp object collision 2,5,50,1
set bsp object collision 2,6,50,1
set bsp object collision 2,7,50,1
set bsp object collision 2,8,50,1
do
if upkey()=1 then move object 1,0.5
if downkey()=1 then move object 1,-0.5
if leftkey()=1 then move object left 1,0.5
if rightkey()=1 then move object right 1,0.5
if object collision (1,2)>0
print "try again"
position object 1,0,0,400
endif
if object collision (1,3)>0
print "try again"
position object 1,0,0,400
endif
if object collision (1,4)>0
print "try again"
position object 1,0,0,400
endif
if object collision (1,5)>0
print "try again"
position object 1,0,0,400
endif
if object collision (1,6)>0
print "try again"
position object 1,0,0,400
endif
if object collision (1,7)>0
print "try again"
position object 1,0,0,400
endif
if object collision (1,8)>0
print "well done"
goto _level_2
endif
loop

rem level 2
_level_2:
backdrop on
position object 1,0,0,400
position object 2,300,0,0
position object 3,-230,0,0
position object 4,130,0,0
position object 5,-50,0,0
position object 6,-430,0,0
position object 7,500,0,0
color object 8,RGB(25,50,0)
position object 8,0,0,-200
set bsp object collision 2,1,25,1
set bsp object collision 2,2,50,1
set bsp object collision 2,3,50,1
set bsp object collision 2,4,50,1
set bsp object collision 2,5,50,1
set bsp object collision 2,6,50,1
set bsp object collision 2,7,50,1
set bsp object collision 2,8,50,1
do
if upkey()=1 then move object 1,0.5
if downkey()=1 then move object 1,-0.5
if leftkey()=1 then move object left 1,0.5
if rightkey()=1 then move object right 1,0.5
if object collision (1,2)>0
print "try again"
position object 1,0,0,400
endif
if object collision (1,3)>0
print "try again"
position object 1,0,0,400
endif
if object collision (1,4)>0
print "try again"
position object 1,0,0,400
endif
if object collision (1,5)>0
print "try again"
position object 1,0,0,400
endif
if object collision (1,6)>0
print "try again"
position object 1,0,0,400
endif
if object collision (1,7)>0
print "try again"
position object 1,0,0,400
endif
if object collision (1,8)>0
print "well done"
goto _level_3
endif
loop

_level_3:
backdrop on
position object 1,0,0,400
position object 2,150,0,100
position object 3,150,0,-50
position object 4,0,0,270
position object 5,0,0,-200
position object 6,-150,0,100
position object 7,-150,0,-50
color object 8,RGB(25,50,0)
position object 8,0,0,0
set bsp object collision 2,1,25,1
set bsp object collision 2,2,50,1
set bsp object collision 2,3,50,1
set bsp object collision 2,4,50,1
set bsp object collision 2,5,50,1
set bsp object collision 2,6,50,1
set bsp object collision 2,7,50,1
set bsp object collision 2,8,50,1
do
if upkey()=1 then move object 1,0.5
if downkey()=1 then move object 1,-0.5
if leftkey()=1 then move object left 1,0.5
if rightkey()=1 then move object right 1,0.5
if object collision (1,2)>0
print "try again"
position object 1,0,0,400
endif
if object collision (1,3)>0
print "try again"
position object 1,0,0,400
endif
if object collision (1,4)>0
print "try again"
position object 1,0,0,400
endif
if object collision (1,5)>0
print "try again"
position object 1,0,0,400
endif
if object collision (1,6)>0
print "try again"
position object 1,0,0,400
endif
if object collision (1,7)>0
print "try again"
position object 1,0,0,400
endif
if object collision (1,8)>0
print "well done"
goto _level_4
endif
loop

_credits:
make object cube 9,100
make object cube 10,100
make object cube 11,100
make object sphere 12,100
make object cube 13,100
make object cube 14,100
make object cube 15,100
color object 9,rgb(0,0,100)
color object 10,rgb(0,0,100)
color object 11,rgb(0,0,100)
color object 13,rgb(0,0,100)
color object 14,rgb(0,0,100)
color object 15,rgb(0,0,100)
color object 12,rgb(100,0,0)
color backdrop rgb(0,100,0)
do
print "thank you for playing"
print "this has been an ACB inc production"
print "press space to finish"
move object 1,25
move object 2,25
move object 3,25
move object 4,25
move object 5,25
move object 6,25
move object 7,25
move object 8,25
move object 16,25
move object 17,25
move object 18,25
move object 19,25
move object 20,25
move object 21,25
move object 22,25
move object 23,25
move object 24,25
move object 25,25
move object 26,25
move object 27,25
move object 28,25
move object 29,25
move object 30,25
move object 31,25
move object 32,25
move object 33,25
move object 34,25
yrotate object 9,object angle y(9)+0.6
zrotate object 10,object angle z(10)+0.6
xrotate object 10,object angle x(10)+0.2
yrotate object 11,object angle y(11)+0.6
zrotate object 9,object angle z(9)+0.2
xrotate object 11,object angle x(11)+0.2
move object 9,0.5
move object 10,0.5
move object 11,0.5
yrotate object 13,object angle y(13)+0.2
zrotate object 14,object angle z(14)+0.2
xrotate object 14,object angle x(14)+0.6
yrotate object 15,object angle y(15)+0.2
zrotate object 13,object angle z(13)+0.6
xrotate object 15,object angle x(15)+0.6
move object 13,0.5
move object 14,0.5
move object 15,0.5
if spacekey()=1 then end
loop

_level_4:
make object sphere 16,100
make object sphere 17,100
make object sphere 18,100
make object sphere 19,100
make object sphere 20,100
make object sphere 21,100
position object 16,0,0,400
position object 17,0,0,-400
position object 18,150,0,400
position object 19,150,0,-400
position object 20,-300,0,400
position object 21,-300,0,-400
position object 1,-400,0,0
position object 2,700,0,0
position object 3,700,0,0
position object 4,700,0,0
position object 5,700,0,0
position object 6,700,0,0
position object 7,700,0,0
position object 8,400,0,0
set bsp object collision 2,1,25,1
set bsp object collision 2,18,50,1
set bsp object collision 2,19,50,1
set bsp object collision 2,17,50,1
set bsp object collision 2,16,50,1
set bsp object collision 2,20,50,1
set bsp object collision 2,21,50,1
set bsp object collision 2,8,50,1
do
if upkey()=1 then move object 1,0.5
if downkey()=1 then move object 1,-0.5
if leftkey()=1 then move object left 1,0.5
if rightkey()=1 then move object right 1,0.5
move object 16,-0.4
move object 17,0.4
move object 18,-0.4
move object 19,0.4
move object 20,-0.6
move object 21,0.6
if object collision (16,17)>0
position object 16,0,0,400
position object 17,0,0,-400
endif
if object collision (18,19)>0
position object 18,150,0,400
position object 19,150,0,-400
endif
if object collision (20,21)>0
position object 20,-300,0,400
position object 21,-300,0,-400
endif
if object collision (1,19)>0
position object 1,-400,0,0
endif
if object collision (1,18)>0
position object 1,-400,0,0
endif
if object collision (1,17)>0
position object 1,-400,0,0
endif
if object collision (1,16)>0
position object 1,-400,0,0
endif
if object collision (1,20)>0
position object 1,-400,0,0
endif
if object collision (1,21)>0
position object 1,-400,0,0
endif
if object collision (1,8)>0
goto _level_5
endif
loop

_level_5:
make object sphere 22,100
make object sphere 23,100
make object sphere 24,100
make object sphere 25,100
make object sphere 26,100
make object sphere 27,100
make object sphere 28,100
make object sphere 29,50
make object sphere 30,50
color object 28,rgb(25,50,0)
position object 22,-50,0,200
position object 23,-50,0,-200
position object 24,-150,0,200
position object 25,-150,0,-200
position object 26,-300,0,400
position object 27,-300,0,-400
position object 1,-450,0,0
position object 2,700,0,0
position object 3,700,0,0
position object 4,700,0,0
position object 5,700,0,0
position object 6,700,0,0
position object 7,700,0,0
position object 28,400,0,0
position object 16,700,0,0
position object 17,700,0,0
position object 18,700,0,0
position object 19,700,0,0
position object 20,700,0,0
position object 21,700,0,0
position object 8,700,0,0
position object 29,-370,0,400
position object 30,-370,0,-400
set bsp object collision 2,22,50,1
set bsp object collision 2,23,50,1
set bsp object collision 2,24,50,1
set bsp object collision 2,25,50,1
set bsp object collision 2,26,50,1
set bsp object collision 2,27,50,1
set bsp object collision 2,29,25,1
set bsp object collision 2,30,25,1
do
if upkey()=1 then move object 1,0.5
if downkey()=1 then move object 1,-0.5
if leftkey()=1 then move object left 1,0.5
if rightkey()=1 then move object right 1,0.5
yrotate object 22,object angle y(22)-0.4
yrotate object 23,object angle y(23)+0.4
yrotate object 24,object angle y(24)-0.4
yrotate object 25,object angle y(25)+0.4
move object 22,-1.1
move object 23,1.1
move object 24,-1.1
move object 25,1.1
move object 26,-0.6
move object 27,0.6
move object 29,-0.8
move object 30,0.8
if object collision (26,27)>0
position object 26,-300,0,400
position object 27,-300,0,-400
endif
if object collision (29,30)>0
position object 29,-370,0,400
position object 30,-370,0,-400
endif
if object collision (1,22)>0
position object 1,-400,0,0
endif
if object collision (1,23)>0
position object 1,-400,0,0
endif
if object collision (1,24)>0
position object 1,-400,0,0
endif
if object collision (1,25)>0
position object 1,-400,0,0
endif
if object collision (1,26)>0
position object 1,-400,0,0
endif
if object collision (1,27)>0
position object 1,-400,0,0
endif
if object collision (1,28)>0
goto _level_6
endif
if object collision (1,29)>0
position object 1,-450,0,0
endif
if object collision (1,30)>0
position object 1,-450,0,0
endif
loop

_level_6:
make object sphere 31,100
make object sphere 32,100
make object sphere 33,100
make object sphere 34,100
position object 1,0,0,400
position object 2,200,0,100
position object 3,200,0,-100
position object 4,0,0,200
position object 5,0,0,-200
position object 6,-200,0,100
position object 7,-200,0,-100
position object 8,0,0,0
position object 31,-150,0,320
position object 32,-150,0,-320
position object 33,150,0,320
position object 34,150,0,-320
color object 8,RGB(25,50,0)
set bsp object collision 2,1,25,1
set bsp object collision 2,2,50,1
set bsp object collision 2,3,50,1
set bsp object collision 2,4,50,1
set bsp object collision 2,5,50,1
set bsp object collision 2,6,50,1
set bsp object collision 2,7,50,1
set bsp object collision 2,8,50,1
set bsp object collision 2,31,50,1
set bsp object collision 2,32,50,1
set bsp object collision 2,33,50,1
set bsp object collision 2,34,50,1
do
move object 16,25
move object 17,25
move object 18,25
move object 19,25
move object 20,25
move object 21,25
move object 22,25
move object 23,25
move object 24,25
move object 25,25
move object 26,25
move object 27,25
move object 28,25
move object 29,25
move object 30,25
move object 31,-0.6
move object 32,0.6
move object 33,-0.6
move object 34,0.6
if upkey()=1 then move object 1,0.5
if downkey()=1 then move object 1,-0.5
if leftkey()=1 then move object left 1,0.5
if rightkey()=1 then move object right 1,0.5
if object collision (1,2)>0
print "try again"
position object 1,0,0,400
endif
if object collision (1,3)>0
print "try again"
position object 1,0,0,400
endif
if object collision (1,4)>0
print "try again"
position object 1,0,0,400
endif
if object collision (1,5)>0
print "try again"
position object 1,0,0,400
endif
if object collision (1,6)>0
print "try again"
position object 1,0,0,400
endif
if object collision (1,7)>0
print "try again"
position object 1,0,0,400
endif
if object collision (1,31)>0
print "try again"
position object 1,0,0,400
endif
if object collision (1,32)>0
print "try again"
position object 1,0,0,400
endif
if object collision (1,33)>0
print "try again"
position object 1,0,0,400
endif
if object collision (1,34)>0
print "try again"
position object 1,0,0,400
endif
if object collision (1,8)>0
print "well done"
goto _level_7
endif
if object collision (31,32)>0
position object 31,-150,0,320
position object 32,-150,0,-320
endif
if object collision (33,34)>0
position object 33,150,0,320
position object 34,150,0,-320
endif
loop

_level_7:
position object 1,-400,0,0
position object 2,-400,0,-150
position object 3,-300,0,-150
position object 4,-200,0,-150
position object 5,-100,0,500
position object 6,-100,0,-400
position object 7,0,0,-150
position object 8,-400,0,-300
position object 16,-500,0,-150
position object 17,100,0,-150
position object 18,500,0,-150
set bsp object collision 2,1,25,1
set bsp object collision 2,2,50,1
set bsp object collision 2,3,50,1
set bsp object collision 2,4,50,1
set bsp object collision 2,5,50,1
set bsp object collision 2,6,50,1
set bsp object collision 2,7,50,1
set bsp object collision 2,8,50,1
do
move object 31,25
move object 32,25
move object 33,25
move object 34,25
move object 5,-0.6
move object 6,0.6
move object left 18,0.6
if upkey()=1 then move object 1,0.5
if downkey()=1 then move object 1,-0.5
if leftkey()=1 then move object left 1,0.5
if rightkey()=1 then move object right 1,0.5
if object collision (1,2)>0
print "try again"
position object 1,-400,0,0
endif
if object collision (1,3)>0
print "try again"
position object 1,-400,0,0
endif
if object collision (1,4)>0
print "try again"
position object 1,-400,0,0
endif
if object collision (1,5)>0
print "try again"
position object 1,-400,0,0
endif
if object collision (1,6)>0
print "try again"
position object 1,-400,0,0
endif
if object collision (1,7)>0
print "try again"
position object 1,-400,0,0
endif
if object collision (1,8)>0
print "well done"
goto _credits
endif
if object collision (1,16)>0
print "try again"
position object 1,-400,0,0
endif
if object collision (1,17)>0
print "try again"
position object 1,-400,0,0
endif
if object collision (1,18)>0
print "try again"
position object 1,-400,0,0
endif
if object collision (5,6)>0
position object 5,-100,0,500
position object 6,-100,0,-400
endif
if object collision (17,18)>0
position object 18,500,0,-150
endif
loop