Discuss Scratch

gamemakersom
Scratcher
2 posts

I need help with cooldown

I'm making a DOD style smash bros game. But I can't figure out out to make a normal punch cooldown. I don't want people to spam punches, so how do I fix this????

I made it smth like this: https://instasize.com/p/97f2761067072c5dc052d6fc9fd48aaedadb756beebc7da9410f0e3cc7591cda
kansea
Scratcher
20 posts

I need help with cooldown

You need to add a cooldown timer. Here's a quick example I wrote.

Basically, you want to check if the cooldown timer is active before punching. If it's not active, you punch and set the timer. There's more than one way to do it, though.

https://scratch.mit.edu/projects/1258882536/
tiger18lps
Scratcher
5 posts

I need help with cooldown

Similar to other Roblox Studio code, but you can add a debounce system that kinda works like this:

when green flag clicked
set [d] to [0]
define cooldown
if <(d) = [0]> then
set [d] to [1]
wait (cooldown idk) secs
set [d] to [0]
end
gamemakersom
Scratcher
2 posts

I need help with cooldown

thanks guys!!!

Powered by DjangoBB