Hi everybody,
I've been writing this game for awhile now and feel that it's time to post some of my work.
It's a maze game that uses all primitive graphics in dbpro, so you can paste the code directly into your dbpro compiler.
The circles don't move yet, but the idea is that you (the player) must dodge the circles in this maze. If one of the circles touches you then you lose.
Rem Project: Mission Survive
Rem Created: 7/25/2005 7:44:48 PM
Rem ***** Main Source File *****
`incNumY = 10000
`incNumX = 10000
sync on : sync rate 30 : autocam off : color backdrop 0
position camera 0, 50, 35, 50 : automatic camera collision 0, 1, 1
fog on : fog color 0 : fog distance 250
randomize timer()
create bitmap 1, 512, 512
set current bitmap 1
INK RGB(130,120,60), 0
BOX 0,0,256,256
`ink 0, 0
`line 0, 0, 256, 256
`line 0, 256, 256, 0
get image 1, 0, 0, 256, 256, 0
ink rgb(10, 10, 255), 0
box 0, 0, 256, 256
get image 2, 0, 0, 256, 256, 0
ink rgb(255, 10, 10), 0
box 0, 0, 512, 512
get image 3, 0, 0, 512, 512, 0
set current bitmap 0
set point light 0, 5, 200, 0
make object sphere 100, 75
color object 100, rgb(255, 0, 0)
position object 100, 750, 50, 950
ghost object on 100
make object sphere 101, 75
color object 101, rgb(255,0,0)
position object 101, 150, 50, 950
ghost object on 101
make particles 102, 3, 75, 50
position particle emissions 102, 750, 50, 950
make particles 103, 3, 75, 50
position particle emissions 103, 150, 50, 950
object = 1
dim boxesPos(10, 10)
dim matrixHeight#(20, 20)
dim matrixDir#(20, 20)
data 0,0,1,0,0,0,1,0,0,0
data 0,1,1,0,1,0,1,1,1,0
data 0,0,0,0,1,0,1,0,0,0
data 0,1,1,0,1,0,1,0,1,0
data 0,0,1,0,1,0,0,0,1,0
data 1,1,1,0,0,0,1,1,1,0
data 0,0,0,0,1,0,1,0,0,0
data 0,1,1,0,1,0,0,0,1,0
data 0,1,1,0,1,0,1,1,1,0
data 0,0,1,0,0,0,1,0,0,0
for i = 1 TO 10
read boxesPos(i,1),boxesPos(i,2),boxesPos(i,3),boxesPos(i,4),boxesPos(i,5),boxesPos(i,6),boxesPos(i,7),boxesPos(i,8),boxesPos(i,9),boxesPos(i,10)
next i
for i = 1 TO 38
make object cube i, 100
set object collision on i
set object collision to boxes i
randomNum = rgb(rnd(50),rnd(50), 255)
color object i, randomNum
`ghost object on i
`set object specular i, randomNum
`set object specular power i, 50
`set shadow shading on i
`texture object i, 1
next i
for y = 1 TO 10
for x = 1 TO 10
if boxesPos(y,x) = 1
position object object, (x * 100)-50, 50, (y * 100)-50
inc object
endif
next x
next y
make matrix 1, 1000, 1000, 20, 20
prepare matrix texture 1, 1, 1, 1
randomize matrix 1, 20
`set matrix 1, 0, 0, 0, 2, 1, 1, 1
update matrix 1
make matrix 2, 1000, 1000, 20, 20
set matrix 2, 0, 0, 0, 2, 1, 1, 1
prepare matrix texture 2, 2, 1, 1
ghost matrix on 2
position matrix 2, 0, 21, 0
counterTwo# = 10
counterThree = 1
for y = 1 TO 20
for x = 1 TO 20
matrixHeight#(x,y) = counterTwo#
matrixDir#(x,y) = counterThree
counterTwo# = counterTwo# - .2
if x < 10 OR rnd(5) = 1 THEN counterThree = 1
if x > 10 OR rnd(5) = 1THEN counterThree = 2
next x
next y
update matrix 2
remstart
make object plain 200, 1000, 1000
rotate object 200, 90, 0, 0
position object 200, 500, 0, 500
set object collision off 200
remend
make object plain 201, 1000, 1000
rotate object 201, 90, 0, 0
position object 201, 500, 100, 500
set object collision off 201
for i = 300 TO 303
make object box i, 20, 100, 1010
set object collision on i
next i
`left edge
position object 300, -10, 50, 500
`right edge
position object 301, 1010, 50, 500
`top edge
position object 302, 500, 50, 1010
rotate object 302, 0, 90, 0
`bottom edge
position object 303, 500, 50, -10
rotate object 303, 0, 90, 0
`for i = 300 TO 303
` texture object i, 1
`next i
do
if upkey() THEN move camera 0, 5
if downkey() THEN move camera 0, -5
if rightkey() THEN turn camera right 0, 3
if leftkey() THEN turn camera left 0, 3
position light 0, camera position x(), camera position y(), camera position z()
`rotate light 0, camera angle x(), camera angle y(), camera angle z()
`dec incNumX
`inc incNumY
remstart
for i = 1 TO 38
scroll object texture i, incNumX, incNumY
next i
for i = 300 TO 303
scroll object texture i, incNumX, incNumY
next i
remend
position camera 0, camera position x(), 40+get ground height(1, camera position x(), camera position z()), camera position z()
if counterOne = 5
for y = 1 TO 20
for x = 1 TO 20
set matrix height 2, x, y, matrixHeight#(x, y)
if matrixDir#(x, y) = 1 THEN dec matrixHeight#(x, y)
if matrixDir#(x, y) = 2 THEN inc matrixHeight#(x, y)
if matrixHeight#(x,y) > 5 THEN matrixDir#(x,y) = 1
if matrixHeight#(x,y) < 1 THEN matrixDir#(x,y) = 2
next x
next y
counterOne = 0
update matrix 2
endif
counterOne = counterOne + 1
gosub enemyTest
sync
loop
enemyTest:
`see where the circles are
remstaRT
circleOneY = object position z(100)
circleOneX = object position
for y = 1 TO 10
for x = 1 TO 10
remend
return
As you can see, the code is pretty simple. I use a lot of subroutines. And I made the textures entirely inside of dbpro.
bye
It's a cook book! A COOKBOOK!