Holding left click doesn't spam attack

Godot Version

4.3

Question

I have mapped spacebar and left click input for “shoot” action. Everything works fine, as long as I move the cursor while holding it, but as soon as I stop moving my cursor, the attack happens only once. It’s as if godot can’t detect that I’m holding my left click. I’ve also tried code like this:
if Input.is_action_pressed("shoot") or Input.is_mouse_button_pressed(MOUSE_BUTTON_LEFT): playerAttack = true

I’ll do a guessing of what is happening but without the entire code is impossible to help you correctly, if you’re checking this inside _input/_unhandled_input that will not work because this functions is called only when a input is received (press a key, release a key, move the mouse, etc) so if this is the case you should check that inside _physics_process callback instead.

Always show the entire code, otherwise will be hard to help.

That is exactly the case. And I figured it out, I just moved the whole if statement there, thank you!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.