You want to check press once? there are many ways to do that.
The simplest is to add a flag, if the key/action was pressed, change that flag and don't allow more presses.
Then do the opposite on _input
with release and the same flag to enable it again.
Like (pseudocode):
export(int) var max_jumps = 2
var jump_remaining = max_jumps
var jump_unlocked = true
...
_fixed_process:
...
if jump_unlocked && jump_remaining>0 && Input.is_action_pressed("jump"):
do_jump_stuff()
jump -= 1
jump_unlocked = false #can't jump yet (lock)
...
_input(event)
...
if !jump_unlocked && event.is_action_released("jump"):
jump_unlocked = true #can try to jump again (unlock)
...
This should work with key input too, and if checking for pressed on _input
be careful with echoes (event.is_echo()
).
Godot 3 will have just_pressed
for input actions to make this more easy.