Instance Variable for the shooter:
var fireDelay = 0; // Detect if ready to fire.
var fireRate = 20; // Speed of fire rate.
When button is holding:
shooter.fireDelay -1
---- If (shooter.fireDelay <= 0)
{shooter.fireDelay = shooter.fireRate, Fire bullet}
On button release:
shooter.fireDelay = 0
Hope it helps.