I setup a on_mouse_pressed(just_begun, released)
signal and on the firearm a timer with the corresponding fire rate, which would call a function as long as mouse was pressed. Like this:
func _ready():
Player.connect("on_mouse_pressed", self, "attack")
Timer.connect("timeout", self, "attack", [false, false])
func attack(begun, released):
if released:
Timer.stop()
return
Timer.start()
This allows me to achieve any fire rate, i.e 120, without using the fps depending _process
or the limited at 60 _physics_process
.