Here's the whole program
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 matrix
Make matrix 1,50000,50000,20,20
Rem texture matrix
Load image "C:\Aaronsmisc1\Source\grass09.bmp",1
Prepare matrix texture 1,1,1,1
Fill matrix 1,0,1
rem Make Gun
Make object cylinder 1,2
XRotate Object 1,90
Fix object pivot 1
Scale object 1,100,100,300
position object 1,0,-7,15
Lock object on 1
Rem Make bullet
Make Object Sphere 2,2
Hide Object 2
Load sound "C:\Aaronsmisc1\Source\crickets.wav",1
Loop sound 1
Load 3Dsound "C:\Aaronsmisc1\Source\fireball2.wav",2
MAKE OBJECT BOX 3, 44, 44, 44
position object 3,2000,0,1500
rem Randomize the matrix
randomize matrix 1,125
X#=5000
Z#=5000
Rem Main loop
Do
set cursor 0,0
print X#
print Y#
print Z#
OldCamAngleY# = CameraAngleY#
OldCamAngleX# = CameraAngleX#
CameraAngleY# = WrapValue(CameraAngleY#+MousemoveX()*0.2)
CameraAngleX# = WrapValue(CameraAngleX#+MousemoveY()*0.2)
Rem Control input for camera
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 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#<10000 and ZTest#>0 and ZTest#<10000
X#=XTest#
Z#=ZTest#
Endif
Endif
Rem Rotate camera
if CameraAngleX#>270
if CameraAngleX#-270 > 90 then CameraAngleX#=270
else
if CameraAngleX# > 90 and CameraAngleX#-270<270 then CameraAngleX#=90
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#
if Mouseclick()=1 and BulletLife=0
Position object 2,X#,Y#+45,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
if Sqrt((mX# - bX#)^2 + (mY#+25 - bY#)^2 + (mZ# - bZ#)^2) <20
text 240,220 ,"hit hit hit hit hit hit hit hit"
BulletLife = 0
Endif
if BulletLife = 0
Hide object 2
stop sound 2
Endif
Endif
Rem Position Listener
Position Listener X#,Y#+50,Z#
Rotate Listener 0,cameraAngleY#,0
Rem Refresh Screen
Sync
Loop
return
Hey!!