This is what I would do. It doesn't delete the sprites though when they go off screen but that's easy to implement.
Basically, when you keep pressed the left mouse button it fires a bullet then resets the global bullettimer.
// Project: BulletTest
// Created: 19-05-27
// show all errors
SetErrorMode(2)
// set window properties
SetWindowTitle("BulletTest")
SetWindowSize(1024, 768, 0)
SetWindowAllowResize(1) // allow the user to resize the window
// set display properties
SetVirtualResolution(1024, 768) // doesn't have to match the window
SetOrientationAllowed(1, 1, 1, 1) // allow both portrait and landscape on mobile devices
SetSyncRate(30, 0) // 30fps instead of 60 to save battery
SetScissor(0, 0, 0, 0) // use the maximum available screen space, no black borders
UseNewDefaultFonts(1)
#insert "constants.agc"
img_bullet = LoadImage( "bullet.png" )
type bullet
sprite as integer
x as float
y as float
speed as float
endtype
Global bulletlist as bullet[]
Global BulletTimer as float
BulletTimer = Timer()
do
if GetRawMouseLeftState() = 1
if Timer() > BulletTimer + 0.2 // if the current timer is greater than bullettimer + value then shoot
local b as bullet
b.sprite = CreateSprite( img_bullet )
b.x = GetRawMouseX()
b.y = GetRawMouseY()
b.speed = 20
bulletlist.insert(b)
BulletTimer = Timer() // reset the bullet timer to the current time
endif
endif
if bulletlist.length > -1
for iter = bulletlist.length to 0 step -1
bulletlist[iter].y = bulletlist[iter].y - bulletlist[iter].speed
SetSpritePosition(bulletlist[iter].sprite, bulletlist[iter].x, bulletlist[iter].y)
next
endif
Print(ScreenFPS())
Sync()
loop

Win 10 Pro - AMD RYZEN 7 Octacore 3.8ghz - 32GB DDR4 - RTX 2070 8GB