Hey there I need help with something!

So I’m making a Super Smash Bros. game in Gdevelop 5, and there is a problem I can’t fix.
It’s that the Player can easily spam the attack key, and I don’t know how I can fix this.

Can somebody please help me with my problem?

Check out timers, they can be used as cooldown

1 Like

Try something like this
When player press the key or button
Begin of the scene
scene_variable_player_attacking = 0

Event if
Pressed key
scene_variable_player_attacking = 0
Trigger Once
Reset “AttackTimer”
scene_variable_player_attacking = 1

Another event
Timer “AttackTimer” is greater than 0.5
scene_variable_player_attacking = 1
scene_variable_player_attacking = 0

So the player can attack again

1 Like

Thanks man, it worked, but now I have the problem that if I turn the Player to the right he still can spam it

i recommend to add the scene_variable_attacking to check the player movement like in the same attack event

if Left Pressed && scene_variable_player_attacking = 0 then move the player left
if Right Pressed && scene_variable_player_attacking = 0 then move the player right


My next problem, I don’t know why this happens