hello I have a player animation called “attack2” that plays on a timer when “x” key is pressed to prevent the player spamming but the delay happens on the initial key press how do I delay the attack only on subsequent key presses?
events
hello I have a player animation called “attack2” that plays on a timer when “x” key is pressed to prevent the player spamming but the delay happens on the initial key press how do I delay the attack only on subsequent key presses?
events
Are you looking for a slowly repeated attack, or to stop them from being able to attack again without releasing the key?
For the former, you’re going to need to completely separate your timers from your current events, and have them reset a variable from 1 to 0. Then you set that variable’s default to 0, and put “Variable = 0” as the condition in your event, and add an action to set the variable to 1 at the end of the event. This way the first press will already be at 0 and activate, but the second press/activation won’t occur until after the timer.
For the latter (you must release the key and press it again to allow a second attack), you should just outright use a toggle variable as listed here: How to toggle states using Variables [GDevelop wiki]
Have the variable toggle back upon the key being released, instead of with a timer.