Besides the contest(this is something seperate)I will be putting together a team of people new to darkbasic to learn basic3D commands and also how to work as a team to develop a game. I have added a small engine I made for you to look at as an example. You will also see I included the code. Make sure all your media is saved in the same folder though.
Rem * Title :FPS engine demo
Rem by arbiter410
Rem Setup sync
Sync On
Sync Rate 30
Backdrop on
Set camera range 1,5000
Autocam off
Fog on
Fog distance 4000
Fog color RGB(127,127,127)
Color Backdrop RGB(128,128,170)
Rem make matrix
Make matrix 1,10000,10000,20,20
Rem texture matrix
Load image "grass09.bmp",1
Prepare matrix texture 1,1,1,1
Fill matrix 1,0,1
rem Make Gun
Load object "H-AK47-Static.x" ,1
Fix object pivot 1
Scale object 1,4000,4000,7000
position object 1,10,-7,15
Lock object on 1
rem Make Bullet
Make Object Sphere 2,2
Hide Object 2
Load sound "crickets.wav",1
Loop sound 1
Load 3Dsound "machngun.wav",2
rem Randomize the matrix
randomize matrix 1,125
X#=5000
Z#=5000
Rem Main loop
Do
oldcAY# = cAY#
oldcAX# = cAX#
cAY# = WrapValue(cAY#+MousemoveX()*0.2)
cAX# = WrapValue(cAX#+MousemoveY()*0.2)
caZ# = Camera angle Z()
Rem Control input for camera
If Upkey()=1
XTest# = Newxvalue(X#,cAY#,10)
ZTest# = Newzvalue(Z#,cAY#,10)
If XTest#>0 and XTest#<10000 and ZTest#>0 and ZTest#<10000
X#=XTest#
Z#=ZTest#
Endif
Endif
If Downkey()=1
XTest# = Newxvalue(X#,Wrapvalue(cAY#-180),10)
ZTest# = Newzvalue(Z#,Wrapvalue(cAY#-180),10)
If XTest#>0 and XTest#<10000 and ZTest#>0 and ZTest#<10000
X#=XTest#
Z#=ZTest#
Endif
Endif
If Leftkey()=1
XTest# = Newxvalue(X#,Wrapvalue(cAY#-90),10)
ZTest# = Newzvalue(Z#,Wrapvalue(cAY#-90),10)
If XTest#>0 and XTest#<10000 and ZTest#>0 and ZTest#<10000
X#=XTest#
Z#=ZTest#
Endif
Endif
If Rightkey()=1
XTest# = Newxvalue(X#,Wrapvalue(cAY#+90),10)
ZTest# = Newzvalue(Z#,Wrapvalue(cAY#+90),10)
If XTest#>0 and XTest#<10000 and ZTest#>0 and ZTest#<10000
X#=XTest#
Z#=ZTest#
Endif
Endif
Rem Rotate camera
if cAX#>270
if cAX#-270 > 90 then cAX#=270
else
if cAX# > 90 and cAX#-270<270 then cAX#=90
endif
YRotate camera CurveAngle(cAY#,oldcAY#,24)
XRotate camera CurveAngle(cAX#,oldcAX#,24)
Rem Position Camera
Y# = Get ground height(1,X#,Z#)
Position Camera X#,Y#+35,Z#
Rem Position Listener
Position Listener X#,Y#+35,Z#
Rotate Listener 0,cAY#,0
Rem Shoot bullet
If Mouseclick()=1 and BulletLife=0
Position object 2,X#,Y#+28,Z#
Set object to camera orientation 2
BulletLife =25
show object 2
Loop sound 2
Endif
If BulletLife > 0
Dec BulletLife
Move object 2,20
bX#=Object position X(2)
bY#=Object position Y(2)
bZ#=Object position Z(2)
Position sound 2,bX#,bY#,bZ#
set cursor 10,10
print Sqrt((mX# - bX#)^2 + (mY#+25 - bY#)^2 + (mZ# - bZ#)^2)
if Sqrt((mX# - bX#)^2 + (mY#+25 - bY#)^2 + (mZ# - bZ#)^2) <20
text 240,220 ,"hit hit hit hit hit hit hit hit"
endif
if BulletLife = 0
Hide object 2
stop sound 2
endif
Endif
Rem Refresh Screen
Sync
Loop