ScratchData LogoScratchData
Back to CST1229's profile

Script order control using cloning (example)

CSCST1229•Created October 3, 2022
Script order control using cloning (example)
2
1
67 views
View on Scratch

Instructions

This is a slow example that uses pen to draw 500 outlined circles on screen at once, but using separate sprites to draw the outlines and the fills, and l think only using at most 2 clones at a time. This takes advantage of Scratch's "script queue" - hat-triggering blocks like broadcasts and clones put their scripts at the end of a queue of scripts to run this frame, and Scratch steps through the script queue each frame until it is empty. However, things like broadcasts have special behavior that waits for a frame if Scratch detects it as "recursive" (for example, a script like "when l receive [message1 v], broadcast (message1 v)"). When l start as a clone blocks do not get affected by this behavior, presumably because they are run by different targets (or sprites and clones). This is the same behavior that makes scripts like "when l start as a clone, create clone of (myself v), delete this clone" lag - except in this case it isn't infinitely recursive.

Project Details

Project ID740228913
CreatedOctober 3, 2022
Last ModifiedFebruary 23, 2023
SharedOctober 5, 2022
Visibilityvisible
CommentsAllowed