Malith,
You need to create more than just one bullet object as your projectile. Instead, create enough bullets that you will not cycle through them all before the last bullet shot runs out of 'life'. Let's say that each bullet's life will last to 300 units out, and their speed will be 5 units each frame(game loop). Let's also say that you wish to shoot a bullet every 5 frames, as long as the 'trigger' is held down. Let's do some math.
Simply, divide the bullets' lifes by the distance they will travel each frame. 300 / 5 = 60. So, we need 60 bullets to make this loop fluent.
Now, there is a need for an array to control all the properties of each bullets. What do we need to record? In the 2D program I need to record the bullets' x and y coordinates. In 3D, you may need to record their z coordinates. Also, their bulletlife, in which this value will also be used to make the bullet move if it is above 0 bulletlife. Lastly, bulletangle.
There is no way to correct the sound problem the way you are writing the code, because you are only using one bullet, and AS SOON as it dies, it is reset and the sound is played again.
The code snippet below is a small program made in order to show this loop working. It is all in 2D, however, we're not focusing on the graphics, but the loop. The code is heavily commented to guide you through it processes. Watch for the "THIS IS WHERE YOU PLAY THE SOUND" comment. Enjoy!
set display mode 800,600,32
sync on
sync rate 60
REM << this will be the array, storing the bullets' information(60 bullets, 4 slots of info each)
REM << there is no need to fill it with anything until the bullet needs to be fired
REM << 12,1 = xcoord;12,2 = ycoord;12,3 = angle;12,4 = bulletlife
dim bullet(60,4)
REM << prepare count2 for game, since there is no 0 slot in the array, or 0 number of bullet
count2 = 1
REM << pre-position player in center of screen
playerx# = 400
playery# = 300
REM <<<<<<<< main loop >>>>>>>>>
repeat
REM << enable the player to shoot a bullet
if mouseclick() = 1
REM << count1 is our delay variable, will only only a bullet to be shot when its value = 5
inc count1
if count1 = 5
REM << reset count1 for next delay
count1 = 0
REM << count2 is incremented after each delay and used as which dimension in the array to be edited(lamen:which bullet is being fired)
inc count2
REM << if count2 goes above the amount of bullets(in this case 60, then reset it to 1)to continue fluid loop of bullets moving
if count2 > 60 then count2 = 1
REM << now, let's prepare the bullet, # of count2, which is going to be fired, by setting its properties
bullet(count2,1) = playerx# + (cos(playerangle) * 20)
bullet(count2,2) = playery# + (sin(playerangle) * 20)
REM << store the present angle of the player
bullet(count2,3) = playerangle
REM << set its bulletlife to 300
bullet(count2,4) = 300
REM <<<<<<<<<< THIS IS WHERE YOU WOULD PLAY THE SOUND! >>>>>>>>>>
endif
endif
REM << this is where we use bulletlife to move the bullet, that if it is above 0 then move the bullet
REM << we'll use a for next loop to decide which bullets to move
for t = 1 to 60
REM << check to see if the bullet's life is valued above 0
if bullet(t,4) > 0
REM << if above 0 then the bullet is 'active' so then make it move according to its angle
bullet(t,1) = bullet(t,1) + (cos(bullet(t,3)) * 5)
bullet(t,2) = bullet(t,2) + (sin(bullet(t,3)) * 5)
REM << decrement bulletlife
bullet(t,4) = bullet(t,4) - 1
endif
next t
REM << don't focus on this section, its just the player movement and screen displaying
if rightkey() = 1 then playerangle = wrapvalue(playerangle + 1)
if leftkey() = 1 then playerangle = wrapvalue(playerangle - 1)
if upkey() = 1
inc playerx#,(cos(playerangle) * 2)
inc playery#,(sin(playerangle) * 2)
endif
REM << draw to screen
ink rgb(0,0,255),0
circle playerx#,playery#,10
line playerx# + (cos(playerangle) * 10),playery# + (sin(playerangle) * 10),playerx# + (cos(playerangle) * 20),playery# + (sin(playerangle) * 20)
REM << instructions
ink rgb(255,255,255),0
text 0,0,"Use arrow keys to move character"
text 0,15,"Press left mouse button to fire weapon"
text 0,30,"Press right mouse button to end program"
REM << draw bullets to screen
ink rgb(255,0,0),0
for t = 1 to 60
if bullet(t,4) > 0 then dot bullet(t,1),bullet(t,2)
next t
sync
cls
until mouseclick() = 2
end

+NanoBrain+