In my game, if the player presses the control buttons repeatedly, it can lead to accidental death. How can I limit the number of times the control buttons can be pressed so that the player cannot intentionally die by spamming the keyboard? Thank you so much in advance for your help!
Note!
Creating a timer doesn't help.
How can I limit the number of times a player can press a button?
Scel Creating a timer doesn't help.
why not?
my_button.pressed.connect(button_press.bind(my_button))
func button_press(oth : Button) -> void:
oth.disabled = true
await get_tree().create_timer(0.5).timeout#wait 0.5 seconds to click again
oth.disabled = false
just an example