Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » How do i set a cooldown for a keyboard button?
- KingMagic350
-
Scratcher
6 posts
How do i set a cooldown for a keyboard button?
I was wondering how I set a cooldown for dashing in my new scratch game.
- Tetris3DS
-
Scratcher
500+ posts
How do i set a cooldown for a keyboard button?
I was wondering how I set a cooldown for dashing in my new scratch game.
when green flag clicked
forever
if <key [ v] pressed?> then
...
wait (...) secs
end
end
- MasterofTheBrick
-
Scratcher
1000+ posts
How do i set a cooldown for a keyboard button?
Use a wait block to set a variable called dash? to true and false, and only initiate the dash script if this variable is true.
forever
set [dash? v] to [true]
wait (cooldown) secs
set [dash? v] to [false]
wait (cooldown) secs
end
- An0therRand0mC0der
-
Scratcher
1000+ posts
How do i set a cooldown for a keyboard button?
when green flag clicked
...
set [cooldown v] to [10] //10 seconds is an example, not required
forever
if <...> then
...
wait (cooldown) secs
end
end
Last edited by An0therRand0mC0der (June 14, 2021 16:59:53)
- SeaTurtleCpo
-
Scratcher
71 posts
How do i set a cooldown for a keyboard button?
when I receive [ Dash]
if <(dash) = [true]> then
dash
set [ dash] to [false]
wait (cooldown) secs
set [dash] to [true]
end
define dash
when green flag clicked
forever
if <key [ W] pressed?> then
broadcast [ Dash]
end
end
Last edited by SeaTurtleCpo (Nov. 13, 2024 19:24:13)
- KingMagic350
-
Scratcher
6 posts
How do i set a cooldown for a keyboard button?
Thanks! ill try all of these
- MasterAtCode1000
-
Scratcher
3 posts
How do i set a cooldown for a keyboard button?
well im trying all these scripts because i need the same thing but instead of a key its for clicking.
- orangetheory
-
Scratcher
500+ posts
How do i set a cooldown for a keyboard button?
make sure all the above scripts are in a separate script from the main script otherwise the whole loop would wait that many seconds
- orangetheory
-
Scratcher
500+ posts
How do i set a cooldown for a keyboard button?
well im trying all these scripts because i need the same thing but instead of a key its for clicking.https://scratch.mit.edu/discuss/7/topic/add/
- Whatdidyousay245
-
Scratcher
100+ posts
How do i set a cooldown for a keyboard button?
wait (...) secs
- tinpot297
-
Scratcher
1 post
How do i set a cooldown for a keyboard button?
stop [when green flag clicked]
- Markdanieltan20
-
Scratcher
1 post
How do i set a cooldown for a keyboard button?
How do I make a cooldown?:
-Message
-Second
-If
-Message: On cooldown!
-After the Second, Message
-Message
-Second
-If
-Message: On cooldown!
-After the Second, Message
- invalidaccess
-
Scratcher
100+ posts
How do i set a cooldown for a keyboard button?
when green flag clicked
forever
change [ cooldown] by (-1)
if <(cooldown) < [0]> then
set [ cooldown] to [0]
end
if <<key [dash key] pressed?> and <(cooldown) = [0]>> then
broadcast [ dash]
set [ cooldown] to [any number you want]
end
end
this is how i do it
- Discussion Forums
- » Help with Scripts
-
» How do i set a cooldown for a keyboard button?











