Scratchblocks Test
This is a test page for scratchblocks integration.
Basic Example
Section titled “Basic Example”when flag clickedmove (10) stepsExample with Variables
Section titled “Example with Variables”when flag clickedset [counter v] to (0)forever change [counter v] by (1) say (counter) wait (1) secondsendExample with Conditionals
Section titled “Example with Conditionals”when flag clickedforever if <key [space v] pressed?> then play sound [pop v] wait (0.5) seconds endendExample with Multiple Blocks
Section titled “Example with Multiple Blocks”when flag clickedclearforever pen down if <touching [mouse-pointer v]?> then switch costume to [button v] else add (x position) to [list v] end move (10) steps turn ccw (9) degreesendHow it works
Section titled “How it works”The ScratchblocksRenderer component dynamically loads the scratchblocks npm package on the client and uses its parse/render APIs to turn the provided code prop into Scratch-style block visuals.