Mar 31, 2024 13:49:18
Adding a cooldown to In-game Button scripts
view on scratch
view on legacy ocular
lion334
loading
how do I set a cool down for a move for a character?
I reckon you've got a Movement-Script:
Movement Script
Therefore, my version of doing a cooldown would be this:
when green flag clicked
forever
if <[0] < (Cooldown)> then
wait (0.1) secs
change [Cooldown v] by (-0.1) //You can't just do "Wait Cooldown Seconds" and then set it to 0, as this would mean that if a Cooldown is added ontop of another, it would be ignored.
end
end
if <(Cooldown) < [0.01]> then //Updated Movement Script
Movement Script
end
set [Cooldown v] to [2] //Set a fixed cooldown
change [Cooldown v] by (2) //Or add to a cooldown
This should solve your problem.
Sincerely,
lion334