Whenever I try to put in code so that when I shoot It dosn't sound right at all! All I get during the game is a buzz! Heres the code I'm useing.
rem an fps demo by Justin Camden
autocam off
hide mouse
rem set up the world
load image "SUBTXT.BMP",1
make matrix 1,10000,10000,50,50
Prepare matrix texture 1,1,1,1
Fog on
Fog distance 1000
Fog color RGB(128,28,28)
Color Backdrop RGB(168,28,28)
make object sphere 4,50
load sound "Automatic loop.wav",1
position object 4,0,100,0
load music "At the Gates.mid",1
load object "LASERRIF.X",1
load object "HANDGUN2.X",20
load object "GUN15.X",3
load object "GUN19.X",40
load object "GUN2.X" ,5
hide object 5
hide object 20
hide object 3
hide object 40
fix object pivot 3
fix object pivot 20
fix object pivot 1
fix object pivot 40
fix object pivot 5
scale object 40,500,500,500
scale object 1,500,500,500
scale object 20,500,500,500
scale object 3,2500,2500,2500
scale object 5,500,500,500
position object 1,0,-7,15
position object 20,0,-7,15
position object 3,0,-7,15
position object 40,0,-7,15
position object 5,0,-7,15
lock object on 1
lock object on 20
lock object on 3
lock object on 40
lock object on 5
make object sphere 2,3
hide object 2
hide object 4
rem set camera and sync
set camera range 1,3000
sync on
sync rate 100
rem begin game loop
do
rem position camera at location and rotation of object 4
position camera object position x(4),object position y(4),object position z(4)
rotate camera object angle x(4),object angle y(4),object angle z(4)
rem define camera variables
wvtx=object angle x(4)
wvty=object angle y(4)
wvtz=object angle z(4)
wcax=wrapvalue(wvtx)
wcay=wrapvalue(wvty)
wcaz=wrapvalue(wvtz)
rem controls
rem aiming
cya#=wrapvalue(cya#+(mousemovex()/3.0))
cxa#=cxa#+(mousemovey()/3.0)
if cxa#<-45.0 then cxa#=-45.0
if cxa#>45.0 then cxa#=45.0
cx#=newxvalue(x#,cya#,sin(cxa#)*10)
cz#=newzvalue(z#,cya#,sin(cxa#)*10)
rotate camera wrapvalue(cxa#),cya#,0
rotate object 4,0,camera angle y(),0
position camera object position x(4),object position y(4),object position z(4)
rem walking
if upkey()=1 then move object 4,8
if downkey()=1 then move object 4,-8
rem weapon select
if inkey$()="1" then show object 1: hide object 20: hide object 3: hide object 40: hide object 5
if inkey$()="2" then show object 20: hide object 1: hide object 3: hide object 40: hide object 5
if inkey$()="3" then show object 3: hide object 1: hide object 20: hide object 40: hide object 5
if inkey$()="4" then show object 40: hide object 1: hide object 20: hide object 3: hide object 5
if inkey$()="5" then show object 5: hide object 1: hide object 20: hide object 3: hide object 40
rem music
loop music 1
rem jumping
if controlkey()=1 and ajump=1
jumpb=1
height=30
endif
if jumpb=1
height=height-1
position object 4,object position x(4),object position y(4)+height,object position z(4)
endif
if object position y(4)>100 then ajump=0 else ajump=1
if object position y(4)<100
position object 4,object position x(4),100,object position z(4)
jump=0
height=0
endif
rem shooting
if mouseclick()>0 and dst=0
shot=1
bdst=1
show object 2
position object 2,object position x(4),object position y(4)-1,object position z(4)
rotate object 2,camera angle x(),camera angle y(),camera angle z()
endif
if object position x(2)<0 or object position x(2)>10000 or object position z(2)>10000 or object position z(2)<0 or object position y(2)<0 or object position y(2)>10000
hide object 2
stop sound 1
dst=0
shot=0
endif
if shot=1
dst=dst+1
bdst=bdst+1
endif
if shot=1
loop sound 1
move object 2,100
dst=dst+1
endif
rem sync
sync
rem end game loop
loop
Dont worry and keep a cool head.