1

I'm building a game in Godot and I am running into an issue where Input.is_action_pressed, Input.is_action_just_pressed, and Input.is_action_just_released are all triggering multiple times if the mouse or gamepad joysticks are moving while clicking the buttons. I have tried checking for is_echo, but nothing registers as an echo.

I am looking for input via:

func _input(event):
    if Input.is_action_just_released("AttackRange"):
        fireGun()

This is very easily repeatable for me right now. All I have to do is move my mouse around while clicking, or moving either of the joysticks on the gamepad while pressing buttons. I can't figure out what is causing this. Should I be listening for inputs in a different way?

Help would be greatly appreciated!

HeroicNate
  • 63
  • 7

1 Answers1

1

Yeah, you are mixing ways to get input.

Either use _input and process only the input you get in the event parameter. This is usually better for pointing input (mouse or touch).

Or put your code in _process (or _physics_process if necessary) and use the Input object.

In this particular case, I'd move the code you have to _process.

Theraot
  • 31,890
  • 5
  • 57
  • 86