ScratchData LogoScratchData
Back to kriblo_test's profile

Example: One click at a time

KRkriblo_test•Created March 26, 2024
Example: One click at a time
8
6
74 views
View on Scratch

Instructions

When an event handler (including "when this sprite is clicked") is called, it starts running the attached code. However, if the same event handler is called again, while that code is running, it will simply stop running the code, and start from the top again. So, how do you deal with frantic clickers? See inside for commented code, but in essence: In the first responder event handler, do as little as possible, just: - Check that "Handling Click" is not true. - Set variable "Handling Click" to prevent further clicks. - Set a global variable indicating which clone was clicked. - Call (without wait) "Handle Click" (or whatever broadcast you're using). In the secondary event handler ("Handle Click"): - Use a condition, based on the global variable set in the first responder event handler, to run the code in a specific clone. - Run whatever frame-spanning code you need to run. - Set "Handling Click" to false. All code by me (@kriblo).

Project Details

Project ID989756477
CreatedMarch 26, 2024
Last ModifiedMarch 26, 2024
SharedMarch 26, 2024
Visibilityvisible
CommentsAllowed