Scratch_agent_V1 / blocks /stack_blocks.json
WebashalarForML's picture
Upload 197 files
3abfe5a verified
{
"block_category": "Stack Blocks",
"description": "Stack blocks are the most common block shape, featuring a notch at the top and a bump at the bottom. They perform the main commands within a script and can connect both above and below them.",
"blocks": [
{
"block_name": "move () steps",
"block_type": "Motion",
"block_shape": "Stack Block",
"op_code": "motion_movesteps",
"functionality": "Moves the sprite forward by the specified number of steps in the direction it is currently facing. A positive value moves it forward, and a negative value moves it backward.",
"inputs": [
{
"name": "STEPS",
"type": "number"
}
],
"example_standalone": "move () steps",
"example_with_other_blocks": [
{
"script": "when green flag clicked\n go to x: (0) y: (0)\n point in direction (90)\n move (50) steps\nend",
"explanation": "This script first places the sprite at the center of the stage, points it to the right (90 degrees), and then moves it 50 steps in that direction."
}
]
},
{
"block_name": "turn right () degrees",
"block_type": "Motion",
"block_shape": "Stack Block",
"op_code": "motion_turnright",
"functionality": "Turns the sprite clockwise by the specified number of degrees.",
"inputs": [
{
"name": "DEGREES",
"type": "number"
}
],
"example_standalone": "turn (clockwise icon) (15) degrees",
"example_with_other_blocks": [
{
"script": "when [right arrow v] key pressed\n turn (clockwise icon) (15) degrees\nend",
"explanation": "This script makes the sprite turn clockwise by 15 degrees every time the right arrow key is pressed."
},
{
"script": "when green flag clicked\n forever\n turn (clockwise icon) (15) degrees\n wait (0.5) seconds\n end",
"explanation": "This script makes the sprite continuously spin clockwise by 15 degrees every half second."
}
]
},
{
"block_name": "turn left () degrees",
"block_type": "Motion",
"block_shape": "Stack Block",
"op_code": "motion_turnleft",
"functionality": "Turns the sprite counter-clockwise by the specified number of degrees.",
"inputs": [
{
"name": "DEGREES",
"type": "number"
}
],
"example_standalone": "turn (counter-clockwise icon) (15) degrees",
"example_with_other_blocks": [
{
"script": "when [left arrow v] key pressed\n turn (counter-clockwise icon) (15) degrees\nend",
"explanation": "This script makes the sprite turn counter-clockwise by 15 degrees every time the left arrow key is pressed."
},
{
"script": "when green flag clicked\n forever\n turn (counter-clockwise icon) (15) degrees\n wait (0.5) seconds\n end\nend",
"explanation": "This script makes the sprite continuously spin counter-clockwise by 15 degrees every half second."
}
]
},
{
"block_name": "go to ()",
"block_type": "Motion",
"block_shape": "Stack Block",
"op_code": "motion_goto",
"functionality": "Moves the sprite to a specified location, which can be a random position, the mouse pointer, or another sprite.",
"inputs": [
{
"name": "TO",
"type": "dropdown",
"options": [
"random position",
"mouse-pointer",
"sprite1",
"..."
]
}
],
"example_standalone": "go to [random position v]",
"example_with_other_blocks": [
{
"script": "when this sprite clicked\n go to [mouse-pointer v]",
"explanation": "This script moves the sprite to the current position of the mouse pointer whenever the sprite is clicked."
}
]
},
{
"block_name": "go to x: () y: ()",
"block_type": "Motion",
"block_shape": "Stack Block",
"op_code": "motion_gotoxy",
"functionality": "Moves the sprite to the specified X and Y coordinates on the stage.",
"inputs": [
{
"name": "X",
"type": "number"
},
{
"name": "Y",
"type": "number"
}
],
"example_standalone": "go to x: (0) y: (0)",
"example_with_other_blocks": [
{
"script": "when green flag clicked\n go to x: (0) y: (0)\n say [Ready to start! v] for (1) seconds\nend",
"explanation": "This script positions the sprite at the center of the stage at the beginning of the project and then makes it say 'Ready to start!'."
}
]
},
{
"block_name": "glide () secs to ()",
"block_type": "Motion",
"block_shape": "Stack Block",
"op_code": "motion_glideto",
"functionality": "Glides the sprite smoothly to a specified location (random position, mouse pointer, or another sprite) over a given number of seconds.",
"inputs": [
{
"name": "SECS",
"type": "number"
},
{
"name": "TO",
"type": "dropdown",
"options": [
"random position",
"mouse-pointer",
"sprite1",
"..."
]
}
],
"example_standalone": "glide (1) secs to [random position v]",
"example_with_other_blocks": [
{
"script": "when green flag clicked\n glide (1) secs to [mouse-pointer v]\nend",
"explanation": "This script makes the sprite glide smoothly to the mouse pointer's position over 1 second when the green flag is clicked."
}
]
},
{
"block_name": "glide () secs to x: () y: ()",
"block_type": "Motion",
"block_shape": "Stack Block",
"op_code": "motion_glidesecstoxy",
"functionality": "Glides the sprite smoothly to the specified X and Y coordinates over a given number of seconds.",
"inputs": [
{
"name": "SECS",
"type": "number"
},
{
"name": "X",
"type": "number"
},
{
"name": "Y",
"type": "number"
}
],
"example_standalone": "glide (1) secs to x: (100) y: (50)",
"example_with_other_blocks": [
{
"script": "when green flag clicked\n glide (2) secs to x: (150) y: (-100)\n glide (2) secs to x: (-150) y: (100)\nend",
"explanation": "This script makes the sprite glide to two different points on the stage, taking 2 seconds for each movement."
}
]
},
{
"block_name": "point in direction ()",
"block_type": "Motion",
"block_shape": "Stack Block",
"op_code": "motion_pointindirection",
"functionality": "Sets the sprite's direction to a specified angle in degrees (0 = up, 90 = right, 180 = down, -90 = left).",
"inputs": [
{
"name": "DIRECTION",
"type": "number"
}
],
"example_standalone": "point in direction (90)",
"example_with_other_blocks": [
{
"script": "when green flag clicked\n point in direction (0)\n move (100) steps\nend",
"explanation": "This script makes the sprite point upwards (0 degrees) and then move 100 steps in that direction."
}
]
},
{
"block_name": "point towards ()",
"block_type": "Motion",
"block_shape": "Stack Block",
"op_code": "motion_pointtowards",
"functionality": "Points the sprite towards the mouse pointer or another specified sprite.",
"inputs": [
{
"name": "TOWARDS",
"type": "dropdown",
"options": [
"mouse-pointer",
"sprite1",
"..."
]
}
],
"example_standalone": "point towards [mouse-pointer v]",
"example_with_other_blocks": [
{
"script": "when this sprite clicked\n point towards [mouse-pointer v]\n move (10) steps\nend",
"explanation": "When the sprite is clicked, it will point towards the mouse pointer and then move 10 steps in that direction."
},
{
"script": "when green flag clicked\n forever\n point towards [mouse-pointer v]\n move (5) steps\n end\nend",
"explanation": "This script makes the sprite continuously follow the mouse pointer."
}
]
},
{
"block_name": "change x by ()",
"block_type": "Motion",
"block_shape": "Stack Block",
"op_code": "motion_changexby",
"functionality": "Changes the sprite's X-coordinate by the specified amount, moving it horizontally.",
"inputs": [
{
"name": "DX",
"type": "number"
}
],
"example_standalone": "change x by (10)",
"example_with_other_blocks": [
{
"script": "when [right arrow v] key pressed\n change x by (10)\nend",
"explanation": "This script moves the sprite 10 steps to the right when the right arrow key is pressed."
}
]
},
{
"block_name": "set x to ()",
"block_type": "Motion",
"block_shape": "Stack Block",
"op_code": "motion_setx",
"functionality": "Sets the sprite's X-coordinate to a specific value, placing it at a precise horizontal position.",
"inputs": [
{
"name": "X",
"type": "number"
}
],
"example_standalone": "set x to (0)",
"example_with_other_blocks": [
{
"script": "when green flag clicked\n set x to (0)\n set y to (0)\nend",
"explanation": "This script centers the sprite horizontally at the start of the project."
}
]
},
{
"block_name": "change y by ()",
"block_type": "Motion",
"block_shape": "Stack Block",
"op_code": "motion_changeyby",
"functionality": "Changes the sprite's Y-coordinate by the specified amount, moving it vertically.",
"inputs": [
{
"name": "DY",
"type": "number"
}
],
"example_standalone": "change y by (10)",
"example_with_other_blocks": [
{
"script": "when [up arrow v] key pressed\n change y by (10)\nend",
"explanation": "This script moves the sprite 10 steps up when the up arrow key is pressed."
}
]
},
{
"block_name": "set y to ()",
"block_type": "Motion",
"block_shape": "Stack Block",
"op_code": "motion_sety",
"functionality": "Sets the sprite's Y-coordinate to a specific value, placing it at a precise vertical position.",
"inputs": [
{
"name": "Y",
"type": "number"
}
],
"example_standalone": "set y to (0)",
"example_with_other_blocks": [
{
"script": "when green flag clicked\n set x to (0)\n set y to (0)\nend",
"explanation": "This script centers the sprite vertically at the start of the project."
}
]
},
{
"block_name": "if on edge, bounce",
"block_type": "Motion",
"block_shape": "Stack Block",
"op_code": "motion_ifonedgebounce",
"functionality": "Reverses the sprite's direction if it touches the edge of the stage.",
"inputs": null,
"example_standalone": "if on edge, bounce",
"example_with_other_blocks": [
{
"script": "when I receive [start moving v]\n repeat (50)\n move (5) steps\n if on edge, bounce\n end\nend",
"explanation": "Upon receiving the 'start moving' broadcast, the sprite will move 5 steps repeatedly for 50 times, bouncing off edges if it touches them."
},
{
"script": "when green flag clicked\n forever\n move (10) steps\n if on edge, bounce\n end\nend",
"explanation": "This script makes the sprite move continuously and bounce off the edges of the stage."
}
]
},
{
"block_name": "set rotation style ()",
"block_type": "Motion",
"block_shape": "Stack Block",
"op_code": "motion_setrotationstyle",
"functionality": "Determines how the sprite rotates: 'left-right' (flips horizontally), 'don't rotate' (stays facing one direction), or 'all around' (rotates freely).",
"inputs": [
{
"name": "STYLE",
"type": "dropdown",
"options": [
"left-right",
"don't rotate",
"all around"
]
}
],
"example_standalone": "set rotation style [left-right v]",
"example_with_other_blocks": [
{
"script": "when backdrop switches to [game level 1 v]\n set rotation style [all around v]\nend",
"explanation": "When the backdrop changes to 'game level 1', the sprite's rotation style will be set to 'all around', allowing it to rotate freely."
},
{
"script": "when green flag clicked\n set rotation style [left-right v]\n forever\n move (10) steps\n if on edge, bounce\n end \nend",
"explanation": "This script makes the sprite move horizontally and flip its costume when it hits an edge, instead of rotating."
}
]
},
{
"block_name": "say () for () seconds",
"block_type": "Looks",
"block_shape": "Stack Block",
"op_code": "looks_sayforsecs",
"functionality": "Displays a speech bubble containing specified text for a set duration.",
"inputs": [
{
"name": "MESSAGE",
"type": "string"
},
{
"name": "SECS",
"type": "number"
}
],
"example_standalone": "say [Hello!] for (2) seconds",
"example_with_other_blocks": [
{
"script": "when green flag clicked\n say [Grr] for (3) seconds\n say [Have you seen my honey? v] for (3) seconds\nend",
"explanation": "This script makes the sprite display two sequential speech bubbles with different messages and durations. First, it says 'Grr' for 3 seconds, then 'Have you seen my honey?' for another 3 seconds."
}
]
},
{
"block_name": "say ()",
"block_type": "Looks",
"block_shape": "Stack Block",
"op_code": "looks_say",
"functionality": "Displays a speech bubble with the specified text indefinitely until another 'say' or 'think' block is activated.",
"inputs": [
{
"name": "MESSAGE",
"type": "string"
}
],
"example_standalone": "say [Hello! v]",
"example_with_other_blocks": [
{
"script": "when green flag clicked\n say [Welcome to my game! v]\n wait (2) seconds\n say [] \nend",
"explanation": "This script makes the sprite say 'Welcome to my game!' for 2 seconds, then clears the speech bubble."
}
]
},
{
"block_name": "think () for () seconds",
"block_type": "Looks",
"block_shape": "Stack Block",
"op_code": "looks_thinkforsecs",
"functionality": "Displays a thought bubble containing specified text for a set duration.",
"inputs": [
{
"name": "MESSAGE",
"type": "string"
},
{
"name": "SECS",
"type": "number"
}
],
"example_standalone": "think [Hmm... v] for (2) seconds",
"example_with_other_blocks": [
{
"script": "when this sprite clicked\n think [What should I do? v] for (2) seconds\nend",
"explanation": "This script makes the sprite display a thought bubble saying 'What should I do?' for 2 seconds when clicked."
}
]
},
{
"block_name": "think ()",
"block_type": "Looks",
"block_shape": "Stack Block",
"op_code": "looks_think",
"functionality": "Displays a thought bubble with the specified text indefinitely until another 'say' or 'think' block is activated.",
"inputs": [
{
"name": "MESSAGE",
"type": "string"
}
],
"example_standalone": "think [Got it! v]",
"example_with_other_blocks": [
{
"script": "when I receive [correct answer v]\n think [That's right! v]\n wait (1) seconds\n think [good v] \nend",
"explanation": "This script makes the sprite think 'That's right!' for 1 second when a 'correct answer' broadcast is received, then clears the thought bubble."
}
]
},
{
"block_name": "switch costume to ()",
"block_type": "Looks",
"block_shape": "Stack Block",
"op_code": "looks_switchcostumeto",
"functionality": "Alters the sprite's appearance to a designated costume.",
"inputs": [
{
"name": "COSTUME",
"type": "dropdown/number"
}
],
"example_standalone": "switch costume to [costume1 v]",
"example_with_other_blocks": [
{
"script": "when I receive [explosion v]\n repeat (5)\n next costume\n end\n hide[costume1 v] \nend",
"explanation": "This script animates an explosion by rapidly switching costumes, then hides the sprite. [3]"
}
]
},
{
"block_name": "next costume",
"block_type": "Looks",
"block_shape": "Stack Block",
"op_code": "looks_nextcostume",
"functionality": "Switches the sprite's costume to the next one in its costume list. If it's the last costume, it cycles back to the first.",
"inputs": null,
"example_standalone": "next costume",
"example_with_other_blocks": [
{
"script": "when [space v] key pressed\n repeat (3)\n next costume\n wait (0.1) seconds\n end \nend",
"explanation": "When the space key is pressed, the sprite will cycle through its next three costumes with a short delay between each change."
},
{
"script": "when green flag clicked\n forever\n next costume\n wait (0.2) seconds\n end \nend",
"explanation": "This script continuously animates the sprite by switching to the next costume every 0.2 seconds, creating a walking or flying effect."
}
]
},
{
"block_name": "switch backdrop to ()",
"block_type": "Looks",
"block_shape": "Stack Block",
"op_code": "looks_switchbackdropto",
"functionality": "Changes the stage's backdrop to a specified backdrop.",
"inputs": [
{
"name": "BACKDROP",
"type": "dropdown/number"
}
],
"example_standalone": "switch backdrop to [backdrop1 v]",
"example_with_other_blocks": [
{
"script": "when green flag clicked\n switch backdrop to [start screen v]\nend ",
"explanation": "This script sets the stage to a 'start screen' backdrop when the project begins."
}
]
},
{
"block_name": "switch backdrop to () and wait",
"block_type": "Looks",
"block_shape": "Stack Block",
"op_code": "looks_switchbackdroptowait",
"functionality": "Changes the stage's backdrop to a specified backdrop and pauses the script until any 'When backdrop switches to' scripts for that backdrop have finished.",
"inputs": [
{
"name": "BACKDROP",
"type": "dropdown/number"
}
],
"example_standalone": "switch backdrop to [game over v] and wait",
"example_with_other_blocks": [
{
"script": "broadcast [game over v]\n switch backdrop to [game over v] and wait\n stop [all v] \nend",
"explanation": "This script broadcasts a 'game over' message, then changes the backdrop to 'game over' and waits for any associated scripts to finish before stopping all processes."
}
]
},
{
"block_name": "next backdrop",
"block_type": "Looks",
"block_shape": "Stack Block",
"op_code": "looks_nextbackdrop",
"functionality": "Switches the stage's backdrop to the next one in its backdrop list. If it's the last backdrop, it cycles back to the first.",
"inputs": null,
"example_standalone": "next backdrop",
"example_with_other_blocks": [
{
"script": "when [space v] key pressed\n next backdrop\nend",
"explanation": "This script changes the stage to the next backdrop in the list each time the space key is pressed."
}
]
},
{
"block_name": "change size by ()",
"block_type": "Looks",
"block_shape": "Stack Block",
"op_code": "looks_changesizeby",
"functionality": "Changes the sprite's size by a specified percentage. Positive values make it larger, negative values make it smaller.",
"inputs": [
{
"name": "CHANGE",
"type": "number"
}
],
"example_standalone": "change size by (10)",
"example_with_other_blocks": [
{
"script": "when green flag clicked\n repeat (10)\n change size by (5)\n wait (0.1) seconds\n end \nend ",
"explanation": "This script makes the sprite gradually grow larger over 10 steps, with a short pause between each size change."
}
]
},
{
"block_name": "set size to () %",
"block_type": "Looks",
"block_shape": "Stack Block",
"op_code": "looks_setsizeto",
"functionality": "Sets the sprite's size to a specific percentage of its original size.",
"inputs": [
{
"name": "SIZE",
"type": "number"
}
],
"example_standalone": "set size to (100) %",
"example_with_other_blocks": [
{
"script": "when green flag clicked\n set size to (50) %\n wait (1) seconds\n set size to (100) %\nend ",
"explanation": "This script makes the sprite shrink to half its original size at the start, waits for 1 second, then returns to its original size."
}
]
},
{
"block_name": "change () effect by ()",
"block_type": "Looks",
"block_shape": "Stack Block",
"op_code": "looks_changeeffectby",
"functionality": "Changes a visual effect on the sprite by a specified amount (e.g., color, fisheye, whirl, pixelate, mosaic, brightness, ghost).",
"inputs": [
{
"name": "EFFECT",
"type": "dropdown",
"options": [
"color",
"fisheye",
"whirl",
"pixelate",
"mosaic",
"brightness",
"ghost"
]
},
{
"name": "CHANGE",
"type": "number"
}
],
"example_standalone": "change [color v] effect by (25)",
"example_with_other_blocks": [
{
"script": "when loudness > (10)\n change [fisheye v] effect by (5)\nend",
"explanation": "When the loudness detected by the microphone is greater than 10, the sprite's fisheye effect will increase by 5."
},
{
"script": "when green flag clicked\n forever\n change [color v] effect by (5)\n wait (0.1) seconds\n end \nend",
"explanation": "This script makes the sprite continuously cycle through different colors."
}
]
},
{
"block_name": "set () effect to ()",
"block_type": "Looks",
"block_shape": "Stack Block",
"op_code": "looks_seteffectto",
"functionality": "Sets a visual effect on the sprite to a specific value.",
"inputs": [
{
"name": "EFFECT",
"type": "dropdown",
"options": [
"color",
"fisheye",
"whirl",
"pixelate",
"mosaic",
"brightness",
"ghost"
]
},
{
"name": "VALUE",
"type": "number"
}
],
"example_standalone": "set [ghost v] effect to (50)",
"example_with_other_blocks": [
{
"script": "when green flag clicked\n set [ghost v] effect to (75)\nend",
"explanation": "This script makes the sprite 75% transparent at the start of the project."
}
]
},
{
"block_name": "clear graphic effects",
"block_type": "Looks",
"block_shape": "Stack Block",
"op_code": "looks_cleargraphiceffects",
"functionality": "Removes all visual effects applied to the sprite.",
"inputs": null,
"example_standalone": "clear graphic effects",
"example_with_other_blocks": [
{
"script": "when green flag clicked\n change [color v] effect by (50)\n wait (2) seconds\n clear graphic effects\nend",
"explanation": "This script changes the sprite's color effect, waits 2 seconds, then resets all graphic effects."
}
]
},
{
"block_name": "show",
"block_type": "Looks",
"block_shape": "Stack Block",
"op_code": "looks_show",
"functionality": "Makes the sprite visible on the stage.",
"inputs": null,
"example_standalone": "show",
"example_with_other_blocks": [
{
"script": "when green flag clicked\n hide[start game v]\nwhen I receive [start game v]\n show [start game v] \nend",
"explanation": "This script hides the sprite at the beginning of the project and makes it visible when a 'start game' broadcast is received."
}
]
},
{
"block_name": "hide",
"block_type": "Looks",
"block_shape": "Stack Block",
"op_code": "looks_hide",
"functionality": "Makes the sprite invisible on the stage.",
"inputs": null,
"example_standalone": "hide",
"example_with_other_blocks": [
{
"script": "when green flag clicked\n hide \nend",
"explanation": "This script hides the sprite from the stage when the green flag is clicked."
}
]
},
{
"block_name": "go to () layer",
"block_type": "Looks",
"block_shape": "Stack Block",
"op_code": "looks_gotofrontback",
"functionality": "Moves the sprite to the front-most or back-most layer of other sprites on the stage.",
"inputs": [
{
"name": "FRONT_BACK",
"type": "dropdown",
"options": [
"front",
"back"
]
}
],
"example_standalone": "go to [front v] layer",
"example_with_other_blocks": [
{
"script": "when green flag clicked\n go to [front v] layer\nend",
"explanation": "This script ensures the sprite is always visible on top of other sprites at the start of the project."
}
]
},
{
"block_name": "go () layers",
"block_type": "Looks",
"block_shape": "Stack Block",
"op_code": "looks_goforwardbackwardlayers",
"functionality": "Moves the sprite forward or backward a specified number of layers in relation to other sprites.",
"inputs": [
{
"name": "FORWARD_BACKWARD",
"type": "dropdown",
"options": [
"forward",
"backward"
]
},
{
"name": "NUM",
"type": "number"
}
],
"example_standalone": "go [forward v] (1) layers",
"example_with_other_blocks": [
{
"script": "when this sprite clicked go [forward v] (1) layers\nend",
"explanation": "This script brings the clicked sprite one layer closer to the front."
}
]
},
{
"block_name": "play sound () until done",
"block_type": "Sound",
"block_shape": "Stack Block",
"op_code": "sound_playuntildone",
"functionality": "Plays a specified sound and pauses the script's execution until the sound has completed.",
"inputs": [
{
"name": "sound name",
"type": "dropdown"
}
],
"example_standalone": "play sound [Meow v] until done",
"example_with_other_blocks": [
{
"script": "when backdrop switches to [winning screen v]\n play sound [fanfare v] until done\n say [You won!] for (2) seconds\nend",
"explanation": "When the backdrop changes to the 'winning screen', a 'fanfare' sound will play until it finishes, and then the sprite will say 'You won!' for 2 seconds."
},
{
"script": "forever\n play sound [Music v] until done \nend",
"explanation": "This script creates a continuous loop for background music, playing the 'Music' sound repeatedly."
}
]
},
{
"block_name": "start sound ()",
"block_type": "Sound",
"block_shape": "Stack Block",
"op_code": "sound_start",
"functionality": "Initiates playback of a specified sound without pausing the script, allowing other actions to proceed concurrently.",
"inputs": [
{
"name": "sound name",
"type": "dropdown"
}
],
"example_standalone": "start sound [Pop v]",
"example_with_other_blocks": [
{
"script": "when this sprite clicked\n start sound [Pop v]\n change [score v] by (1)\nend",
"explanation": "This script plays a 'Pop' sound and increments the score simultaneously when the sprite is clicked."
}
]
},
{
"block_name": "stop all sounds",
"block_type": "Sound",
"block_shape": "Stack Block",
"op_code": "sound_stopallsounds",
"functionality": "Stops all currently playing sounds.",
"inputs": null,
"example_standalone": "stop all sounds",
"example_with_other_blocks": [
{
"script": "when I receive [game over v]\n stop all sounds\nend",
"explanation": "This script stops any sounds currently playing when the 'game over' broadcast is received."
}
]
},
{
"block_name": "change volume by ()",
"block_type": "Sound",
"block_shape": "Stack Block",
"op_code": "sound_changevolumeby",
"functionality": "Changes the project's sound volume by a specified amount.",
"inputs": [
{
"name": "change",
"type": "number"
}
],
"example_standalone": "change volume by (-10)",
"example_with_other_blocks": [
{
"script": "when [down arrow v] key pressed\n change volume by (-5)\nend",
"explanation": "This script decreases the project's volume by 5 when the down arrow key is pressed."
}
]
},
{
"block_name": "set volume to () %",
"block_type": "Sound",
"block_shape": "Stack Block",
"op_code": "sound_setvolumeto",
"functionality": "Sets the sound volume to a specific percentage (0-100).",
"inputs": [
{
"name": "percentage",
"type": "number"
}
],
"example_standalone": "set volume to (100) %",
"example_with_other_blocks": [
{
"script": "when green flag clicked\n set volume to (50) %\nend",
"explanation": "This script sets the project's volume to 50% when the green flag is clicked."
}
]
},
{
"block_name": "broadcast ()",
"block_type": "Events",
"block_shape": "Stack Block",
"op_code": "event_broadcast",
"functionality": "Sends a broadcast message throughout the Scratch program, activating any 'when I receive ()' blocks that are set to listen for that message, enabling indirect communication.",
"inputs": [
{
"name": "message name",
"type": "string/dropdown"
}
],
"example_standalone": "broadcast [start game v]",
"example_with_other_blocks": [
{
"script": "if <key [space v] pressed?> then\n broadcast [jump v]\nend",
"explanation": "This script sends a 'jump' message to other scripts or sprites when the space key is pressed."
}
]
},
{
"block_name": "broadcast () and wait",
"block_type": "Events",
"block_shape": "Stack Block",
"op_code": "event_broadcastandwait",
"functionality": "Sends a broadcast message and pauses the current script until all other scripts activated by that broadcast have completed their execution, ensuring sequential coordination.",
"inputs": [
{
"name": "message name",
"type": "string/dropdown"
}
],
"example_standalone": "broadcast [initialize sprites v] and wait",
"example_with_other_blocks": [
{
"script": "broadcast [initialize sprites v] and wait\n say [Game Started!] for (2) seconds",
"explanation": "This script ensures all sprite initialization routines complete before displaying 'Game Started!' for 2 seconds."
}
]
},
{
"block_name": "wait () seconds",
"block_type": "Control",
"block_shape": "Stack Block",
"op_code": "control_wait",
"functionality": "Pauses the script for a specified duration.",
"inputs": [
{
"name": "seconds",
"type": "number"
}
],
"example_standalone": "wait (1) seconds",
"example_with_other_blocks": [
{
"script": "say [Hello!] for (1) seconds\n wait (0.5) seconds\n say [Goodbye!] for (1) seconds",
"explanation": "This script creates a timed dialogue sequence, pausing for 0.5 seconds between two speech bubbles."
}
]
},
{
"block_name": "wait until ()",
"block_type": "Control",
"block_shape": "Stack Block",
"op_code": "control_wait_until",
"functionality": "Pauses the script until the specified boolean condition becomes true.",
"inputs": [
{
"name": "condition",
"type": "boolean"
}
],
"example_standalone": "wait until <key [space v] pressed?>",
"example_with_other_blocks": [
{
"script": "wait until <key [space v] pressed?>\n start sound [pop v]\nend",
"explanation": "This script pauses until the space key is pressed, then plays a 'pop' sound."
}
]
},
{
"block_name": "stop ()",
"block_type": "Control",
"block_shape": "Stack Block",
"op_code": "control_stop",
"functionality": "Stops all scripts, this script, or other scripts in the sprite. Becomes a Cap Block if 'all' or 'this script' is selected in the dropdown menu.",
"inputs": [
{
"name": "option",
"type": "dropdown",
"options": [
"all",
"this script",
"other scripts in sprite"
]
}
],
"example_standalone": "stop [all v]",
"example_with_other_blocks": [
{
"script": "if <score = (0)> then\n stop [all v]\nend",
"explanation": "This script stops the entire project if the 'score' variable becomes 0."
}
]
},
{
"block_name": "create clone of ()",
"block_type": "Control",
"block_shape": "Stack Block",
"op_code": "control_create_clone_of",
"functionality": "Generates a copy, or clone, of a specified sprite (or 'myself' for the current sprite).",
"inputs": [
{
"name": "sprite_name",
"type": "dropdown",
"options": [
"myself",
"sprite1",
"..."
]
}
],
"example_standalone": "create clone of [myself v]",
"example_with_other_blocks": [
{
"script": "when I start as a clone\n show\n go to random position\n wait (2) seconds\n delete this clone\nend",
"explanation": "When a clone is created, it will show itself, go to a random position, wait for 2 seconds, and then delete itself."
}
]
},
{
"block_name": "delete this clone",
"block_type": "Control",
"block_shape": "Stack Block",
"op_code": "control_delete_this_clone",
"functionality": "Deletes the clone that is currently running the script.",
"inputs": null,
"example_standalone": "delete this clone",
"example_with_other_blocks": [
{
"script": "when I start as a clone\n wait (5) seconds\n delete this clone\nend",
"explanation": "This script makes each clone wait for 5 seconds after it's created, then deletes itself."
}
]
},
{
"block_name": "set [my variable v] to ()",
"block_type": "Data",
"block_shape": "Stack Block",
"op_code": "data_setvariableto",
"functionality": "Assigns a specific value (number, string, or boolean) to a variable.",
"inputs": [
{
"name": "variable name",
"type": "dropdown"
},
{
"name": "value",
"type": "any"
}
],
"example_standalone": "set [score v] to (0)",
"example_with_other_blocks": [
{
"script": "when green flag clicked\n set [score v] to (0)\n set [player name v] to [Guest]\nend",
"explanation": "This script initializes the 'score' variable to 0 and the 'player name' variable to 'Guest' when the project starts."
}
]
},
{
"block_name": "change [my variable v] by ()",
"block_type": "Data",
"block_shape": "Stack Block",
"op_code": "data_changevariableby",
"functionality": "Increases or decreases a variable's numerical value by a specified amount.",
"inputs": [
{
"name": "variable name",
"type": "dropdown"
},
{
"name": "value",
"type": "number"
}
],
"example_standalone": "change [score v] by (1)",
"example_with_other_blocks": [
{
"script": "when this sprite clicked\n change [score v] by (1)\nend",
"explanation": "This script increments the 'score' variable by 1 each time the sprite is clicked."
}
]
},
{
"block_name": "add () to [my list v]",
"block_type": "Data",
"block_shape": "Stack Block",
"op_code": "data_addtolist",
"functionality": "Appends an item to the end of a list.",
"inputs": [
{
"name": "item",
"type": "any"
},
{
"name": "list name",
"type": "dropdown"
}
],
"example_standalone": "add [apple] to [shopping list v]",
"example_with_other_blocks": [
{
"script": "when green flag clicked\n add [apple] to [shopping list v]\n add [banana] to [shopping list v]\nend",
"explanation": "This script adds 'apple' and 'banana' as new items to the 'shopping list' when the project starts."
}
]
},
{
"block_name": "delete () of [my list v]",
"block_type": "Data",
"block_shape": "Stack Block",
"op_code": "data_deleteoflist",
"functionality": "Removes an item from a list by its index or by selecting 'all' items.",
"inputs": [
{
"name": "index/option",
"type": "number/dropdown",
"options": [
"all",
"last",
"random"
]
},
{
"name": "list name",
"type": "dropdown"
}
],
"example_standalone": "delete (1) of [my list v]",
"example_with_other_blocks": [
{
"script": "when green flag clicked\n delete (all) of [my list v]\nend",
"explanation": "This script clears all items from 'my list' when the green flag is clicked."
}
]
},
{
"block_name": "insert () at () of [my list v]",
"block_type": "Data",
"block_shape": "Stack Block",
"op_code": "data_insertatlist",
"functionality": "Inserts an item at a specific position within a list.",
"inputs": [
{
"name": "item",
"type": "any"
},
{
"name": "index",
"type": "number"
},
{
"name": "list name",
"type": "dropdown"
}
],
"example_standalone": "insert [orange] at (2) of [fruits v]",
"example_with_other_blocks": [
{
"script": "insert [orange] at (2) of [fruits v]",
"explanation": "This script inserts 'orange' as the second item in the 'fruits' list, shifting subsequent items."
}
]
},
{
"block_name": "replace item () of [my list v] with ()",
"block_type": "Data",
"block_shape": "Stack Block",
"op_code": "data_replaceitemoflist",
"functionality": "Replaces an item at a specific position in a list with a new value.",
"inputs": [
{
"name": "index",
"type": "number"
},
{
"name": "list name",
"type": "dropdown"
},
{
"name": "new item",
"type": "any"
}
],
"example_standalone": "replace item (1) of [colors v] with [blue]",
"example_with_other_blocks": [
{
"script": "replace item (1) of [colors v] with [blue]",
"explanation": "This script changes the first item in the 'colors' list to 'blue'."
}
]
},
{
"block_name": "show variable [my variable v]",
"block_type": "Data",
"block_shape": "Stack Block",
"op_code": "data_showvariable",
"functionality": "Makes a variable's monitor visible on the stage.",
"inputs": [
{
"name": "variable name",
"type": "dropdown"
}
],
"example_standalone": "show variable [score v]",
"example_with_other_blocks": [
{
"script": "when green flag clicked\n show variable [score v]\nend",
"explanation": "This script displays the 'score' variable on the stage when the project starts."
}
]
},
{
"block_name": "hide variable [my variable v]",
"block_type": "Data",
"block_shape": "Stack Block",
"op_code": "data_hidevariable",
"functionality": "Hides a variable's monitor from the stage.",
"inputs": [
{
"name": "variable name",
"type": "dropdown"
}
],
"example_standalone": "hide variable [score v]",
"example_with_other_blocks": [
{
"script": "when I receive [game over v]\n hide variable [score v]\nend",
"explanation": "This script hides the 'score' variable when the 'game over' broadcast is received."
}
]
},
{
"block_name": "show list [my list v]",
"block_type": "Data",
"block_shape": "Stack Block",
"op_code": "data_showlist",
"functionality": "Makes a list's monitor visible on the stage.",
"inputs": [
{
"name": "list name",
"type": "dropdown"
}
],
"example_standalone": "show list [shopping list v]",
"example_with_other_blocks": [
{
"script": "when green flag clicked\n show list [shopping list v]\nend",
"explanation": "This script displays the 'shopping list' on the stage when the project starts."
}
]
},
{
"block_name": "hide list [my list v]",
"block_type": "Data",
"block_shape": "Stack Block",
"op_code": "data_hidelist",
"functionality": "Hides a list's monitor from the stage.",
"inputs": [
{
"name": "list name",
"type": "dropdown"
}
],
"example_standalone": "hide list [shopping list v]",
"example_with_other_blocks": [
{
"script": "when I receive [game over v]\n hide list [shopping list v]\nend",
"explanation": "This script hides the 'shopping list' when the 'game over' broadcast is received."
}
]
},
{
"block_name": "Ask () and Wait",
"block_type": "Sensing",
"block_shape": "Stack Block",
"op_code": "sensing_askandwait",
"functionality": "Displays an input box with specified text at the bottom of the screen, allowing users to input text, which is stored in the 'Answer' block.",
"inputs": [
{
"name": "question",
"type": "text"
}
],
"example_standalone": "ask [What is your name? v] and wait",
"example_with_other_blocks": [
{
"script": "ask [What is your name? v] and wait\n say join [Hello v] (answer) for (2) seconds \nend",
"explanation": "This script prompts the user for their name, waits for input, then greets them using the provided answer."
}
]
},
{
"block_name": "Reset Timer",
"block_type": "Sensing",
"block_shape": "Stack Block",
"op_code": "sensing_resettimer",
"functionality": "Sets the timer’s value back to 0.0.",
"inputs": null,
"example_standalone": "reset timer",
"example_with_other_blocks": [
{
"script": "when green flag clicked\n reset timer\n wait (5) seconds\n say timer for (2) seconds\nend",
"explanation": "This script resets the timer at the start, waits for 5 seconds, then says the current timer value."
}
]
},
{
"block_name": "set drag mode [draggable v]",
"block_type": "Sensing",
"block_shape": "Stack Block",
"op_code": "sensing_setdragmode",
"functionality": "Sets whether the sprite can be dragged by the mouse on the stage.",
"inputs": null,
"fields": {
"DRAG_MODE": {
"type": "dropdown",
"options": [
"draggable",
"not draggable"
]
}
},
"example_standalone": "set drag mode [draggable v]",
"example_with_other_blocks": [
{
"script": "when green flag clicked\n set drag mode [not draggable v]\nend when this sprite clicked\n set drag mode [draggable v] \nend",
"explanation": "This script makes the sprite not draggable when the project starts, but allows it to be dragged once it's clicked."
}
]
},
{
"block_name": "[my custom block]",
"block_type": "My Blocks",
"block_shape": "Stack Block",
"op_code": "procedures_call",
"functionality": "Executes the script defined by a corresponding 'define' Hat block. This block allows users to call and reuse custom code sequences by simply dragging and dropping it into their scripts, optionally providing required input values.",
"inputs": [
{
"name": "argument_name_1",
"type": "any"
},
{
"name": "argument_name_2",
"type": "any"
}
],
"example_standalone": "jump (50)",
"example_with_other_blocks": [
{
"script": "when green flag clicked\n go to x: (0) y: (0)\n jump (50)\n wait (1) seconds\n say [I jumped!] for (2) seconds",
"explanation": "This script moves the sprite to a starting position, then calls the 'jump' custom block with an input of 50 (assuming 'jump' is a custom block that moves the sprite up and down). After the jump, the sprite says 'I jumped!'."
},
{
"script": "when green flag clicked\n hide\n forever\n create clone of [myself v]\n wait (1) seconds\n end",
"explanation": "This script continuously creates new clones of the current sprite every second after the original sprite hides itself."
}
]
}
]
}