disclaimer: I'm at work, so I can't check my syntax
If you set a maximum number of bullets on screen at one given time, it's made a whole lot easier.
Let's say you're going to allow 100 bullets on screen at one time - declare the following globally (for the moment):
global dim bulletAge(100) as integer
global bulletCounter as integer
then everyTime you fire, set the bulletCounter'th entry in the bulletAge array to 0. As each bullet flies, increment it's age. If its age breaches a threshold, set it's age to -1. Use a bullet's age to determine whether it should be drawn ... Here's some pseudocode..
function fire()
bulletAge(bulletCounter) = 0
inc bulletCounter, 1
if bulletCounter > 100 then bulletCounter = 1
` -- wrap the bullet counter around - this means
` -- we can have a seemingly never ending stream
` -- of bullets
endfunction
function drawBullets()
for i = 1 to 100
if bulletAge(i) > 0:
` -- only draw active bullets --
` -- this could be done simply using move object, where --
` -- the object number is related to i somehow --
inc bulletAge(i), 1
if bulletAge(i) > 5000:
bulletAge(i) = -1 `-- make this bullet inactive
` -- hide your object here too
endif
next i