Sync On
Sync Rate 30
Hide mouse
Backdrop on
Set camera range 1,5000
Fog on
Fog distance 4000
Fog color RGB(128,128,128)
Color Backdrop RGB(128,128,128)
Rem Make bullet
Load image "C:\Program Files\Dark Basic Software\bullet.bmp",10
Make Object Sphere 2,0.45
Texture object 2,10
Hide object 2
Rem intialize particle counter
Pn=10
Rem make matrix
Make matrix 1,10000,10000,20,20
Rem texture matrix
Load image "C:\Program Files\Dark Basic Software\stoney02.bmp",1
Prepare matrix texture 1,1,1,1
Fill matrix 1,0,1
rem Randomize the matrix
randomize matrix 1,125
X#=5000
Z#=5000
rem make scorpions
for scorploop = 666 to 700
Load object "D:\Games\DarkBasic\Myproj\Room\obj\ScorpWalk.x",scorploop
scorpY# = int(rnd(10000))
scorpZ# = int(rnd(10000))
scorpX# = Get ground height(1,scorpX#,scorpZ#)
loop object scorploop
position object scorploop, scorpY#,scorpX#+270 ,scorpZ#
next scorploop
rem Make Gun
Load image "C:\Program Files\Dark Basic Software\metal.bmp",3
Make object cylinder 1,2
XRotate Object 1,90
Fix object pivot 1
Scale object 1,100,100,500
position object 1,0,-7,15
texture object 1,3
Lock object on 1
Rem Main loop
Do
OldCamAngleY# = CameraAngleY#
OldCamAngleX# = CameraAngleX#
CameraAngleY# = WrapValue(CameraAngleY#+MousemoveX()*0.2)
CameraAngleX# = WrapValue(CameraAngleX#+MousemoveY()*0.2)
Rem Shoot
If mouseclick()=1
Load 3Dsound "C:\Program Files\Dark Basic Software\cannon.wav",12
play sound 12
Position object 2,X#,Y#+43,Z#
Set object to camera orientation 2
BulletLife =25
Show object 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)
if BulletLife = 0
Hide object 2
endif
Endif
for bulletloop = 666 to 700
cbmX# = object position X(bulletloop)
cbmY# = object position Y(bulletloop)
cbmZ# = object position Z(bulletloop)
if bX# = cbmX# and bY# = cmbY# and bZ# = cmbZ#
hide object bulletloop
endif
next bulletloop
Rem Control input for camera
if escapekey() = 1
end
endif
If Upkey()=1
XTest# = Newxvalue(X#,CameraAngleY#,10)
ZTest# = Newzvalue(Z#,CameraAngleY#,10)
If XTest#>0 and XTest#<10000 and ZTest#>0 and ZTest#<10000
X#=XTest#
Z#=ZTest#
Endif
Endif
If Upkey()=1 and Shiftkey() = 1
XTest# = Newxvalue(X#,CameraAngleY#,13)
ZTest# = Newzvalue(Z#,CameraAngleY#,13)
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(CameraAngleY#-180),10)
ZTest# = Newzvalue(Z#,Wrapvalue(CameraAngleY#-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(CameraAngleY#-90),10)
ZTest# = Newzvalue(Z#,Wrapvalue(CameraAngleY#-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(CameraAngleY#+90),10)
ZTest# = Newzvalue(Z#,Wrapvalue(CameraAngleY#+90),10)
If XTest#>0 and XTest#<50000 and ZTest#>0 and ZTest#<50000
X#=XTest#
Z#=ZTest#
Endif
Endif
Yrotate camera CurveAngle(CameraAngleY#,OldCamAngleY#,24)
Xrotate camera CurveAngle(CameraAngleX#,OldCamAngleX#,24)
Y# = Get ground height(1,X#,Z#)
Position Camera X#,Y#+50,Z#
Rem Refresh Screen
Sync
Loop