Discuss Scratch

HeHeTeeHeeHee
Scratcher
100+ posts

DEBOUNCE (When, why, & how)

If you've been programming for a bit, you may have heard of using a debounce to slow things down a little, but you may not know entirely how to use, when to use it, or why to use it.


Debounce is used to slow something down, the best way to explain is with an example. The code below takes advantage of debounce and shows you how to use it.


when green flag clicked
set [Debounce v] to [false]
if <key [q v] pressed?> then
if <[Debounce ] = [false]> then
set [Debounce v] to [true]
switch backdrop to [((backdrop #) + (1)) v]
wait (1) secs
set [Debounce v] to [false]
end
end



Thats it for now!

Last edited by HeHeTeeHeeHee (Jan. 5, 2022 20:20:51)


HeHeTeeHeeHee wrote:

i'm brain dead aren't i
i usually use advanced topics or help with scripts but sometimes i can be found in things i'm playing and reading
Suck_At_This
Scratcher
0 posts

DEBOUNCE (When, why, & how)

yeah but how do you get a boolean (true and false) value I can only make number values
Paddle2See
Scratch Team
1000+ posts

DEBOUNCE (When, why, & how)

Hello! It's great that you want to help out other Scratchers. However, I think we have enough guides in the forums at the moment. Please feel free to welcome new Scratchers on the group welcoming topic or on individual topics created by New Scratchers.

Other places that can always use more helpful Scratchers like you, are the "Help With Scripts“ and ”Questions About Scratch" areas - please use them as designed, by responding to topics created by folks with problems to solve

Finally, a really good place for Scratch guides is the Scratch Wiki - check it out and see if it's something you might like to work on. They have a number of guides - and great organization.

Scratch Team Member, kayak and pickleball enthusiast, cat caregiver.

This is my forum signature! On a forum post, it is okay for Scratchers to advertise in their forum signature. The signature is the stuff that shows up below the horizontal line on the post. It will show up on every post I make.
(credit to Za-Chary)



;

Powered by DjangoBB