CLipEmbedScratch / blocks /hat_blocks.json
WebashalarForML's picture
Upload 2854 files
93416d9 verified
raw
history blame
8.54 kB
{
"block_category": "Hat Blocks",
"description": "Hat blocks are characterized by a rounded top and a bump at the bottom. They initiate scripts, meaning they are the starting point for a sequence of interconnected blocks.",
"blocks": [
{
"block_name": "when green flag pressed",
"block_type": "Events",
"op_code": "event_whenflagclicked",
"block_shape": "Hat Block",
"functionality": "This Hat block initiates the script when the green flag is clicked, serving as the common starting point for most Scratch projects.",
"inputs": null,
"example_standalone": "when green flag clicked",
"example_with_other_blocks": [
{
"script": "when green flag clicked\n go to x: (0) y: (0)\n say [Hello!] for (2) seconds\nend",
"explanation": "This script makes the sprite go to the center of the stage and then say 'Hello!' for 2 seconds when the green flag is clicked."
}
]
},
{
"block_name": "when () key pressed",
"block_type": "Events",
"op_code": "event_whenkeypressed",
"block_shape": "Hat Block",
"functionality": "This Hat block initiates the script when a specified keyboard key is pressed.",
"inputs": [
{
"name": "key",
"type": "dropdown",
"options": [
"space",
"up arrow",
"down arrow",
"right arrow",
"left arrow",
"any",
"a",
"b",
"c",
"d",
"e",
"f",
"g",
"h",
"i",
"j",
"k",
"l",
"m",
"n",
"o",
"p",
"q",
"r",
"s",
"t",
"u",
"v",
"w",
"x",
"y",
"z",
"0",
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9"
]
}
],
"example_standalone": "when [space v] key pressed",
"example_with_other_blocks": [
{
"script": "when [space v] key pressed\n repeat (10)\n change y by (10)\n wait (0.1) seconds\n change y by (-10)\n end",
"explanation": "This script makes the sprite jump when the spacebar is pressed."
},
{
"script": "when [right arrow v] key pressed\n point in direction (90)\n move (10) steps\nend",
"explanation": "This script moves the sprite right when the right arrow key is pressed."
}
]
},
{
"block_name": "when this sprite clicked",
"block_type": "Events",
"op_code": "event_whenthisspriteclicked",
"block_shape": "Hat Block",
"functionality": "This Hat block starts the script when the sprite itself is clicked.",
"inputs": null,
"example_standalone": "when this sprite clicked",
"example_with_other_blocks": [
{
"script": "when this sprite clicked\n say [Ouch!] for (1) seconds\n change [score v] by (-1)\nend",
"explanation": "This script makes the sprite say 'Ouch!' and decreases the score by 1 when the sprite is clicked."
}
]
},
{
"block_name": "when backdrop switches to ()",
"block_type": "Events",
"op_code": "event_whenbackdropswitchesto",
"block_shape": "Hat Block",
"functionality": "This Hat block triggers the script when the stage backdrop changes to a specified backdrop.",
"inputs": [
{
"name": "backdrop name",
"type": "dropdown",
"options": ["backdrop1", "backdrop2", "..."]
}
],
"example_standalone": "when backdrop switches to [game over v]",
"example_with_other_blocks": [
{
"script": "when backdrop switches to [game over v]\n stop [all v]\nend",
"explanation": "This script stops all running processes when the backdrop changes to 'game over'."
},
{
"script": "when backdrop switches to [level completed v]\n stop [all v]\nend",
"explanation": "This script stops all running processes when the backdrop changes to 'level completed'."
}
]
},
{
"block_name": "when () > ()",
"block_type": "Events",
"op_code": "event_whengreaterthan",
"block_shape": "Hat Block",
"functionality": "This Hat block starts the script when a certain value (e.g., loudness from a microphone, or the timer) exceeds a defined threshold.",
"inputs": [
{
"name": "value type",
"type": "dropdown",
"options": [
"loudness",
"timer"
]
},
{
"name": "threshold",
"type": "number"
}
],
"example_standalone": "when [loudness v] > (70)",
"example_with_other_blocks": [
{
"script": "when [loudness v] > (70)\n start sound [scream v]\nend",
"explanation": "This script starts a 'scream' sound when the microphone loudness exceeds 70."
}
]
},
{
"block_name": "when I receive ()",
"block_type": "Events",
"op_code": "event_whenbroadcastreceived",
"block_shape": "Hat Block",
"functionality": "This Hat block initiates the script upon the reception of a specific broadcast message. This mechanism facilitates indirect communication between sprites or the stage.",
"inputs": [
{
"name": "message name",
"type": "dropdown",
"options": ["message1", "message2", "new message..."]
}
],
"example_standalone": "when I receive [start game v]",
"example_with_other_blocks": [
{
"script": "when I receive [start game v]\n show\n go to x: (0) y: (0)\nend",
"explanation": "This script makes the sprite visible and moves it to the center of the stage when it receives the 'start game' broadcast."
},
{
"script": "when I receive [game over v]\n set score to 0\n stop [all v]\nend",
"explanation": "This script stops all and resets the score on stage when it receives the 'game over' broadcast."
}
]
},
{
"block_name": "When I Start as a Clone",
"block_type": "Control",
"op_code": "control_start_as_clone",
"block_shape": "Hat Block",
"functionality": "This Hat block initiates the script when a clone of the sprite is created. It defines the behavior of individual clones.",
"inputs": null,
"example_standalone": "When I Start as a Clone",
"example_with_other_blocks": [
{
"script": "when I start as a clone\n go to x: (pick random -240 to 240) y: (pick random -180 to 180)\n show\n forever\n move (10) steps\n if on edge, bounce\n end\nend",
"explanation": "This script makes a newly created clone appear at a random position, become visible, and then continuously move 10 steps, bouncing if it hits an edge."
}
]
},
{
"block_name": "define [my custom block]",
"block_type": "My Blocks",
"op_code": "procedures_definition",
"block_shape": "Hat Block",
"functionality": "This Hat block serves as the definition header for a custom block's script. It allows users to define reusable sequences of code by specifying the block's name and any input parameters it will accept. This promotes modularity and abstraction in projects.",
"inputs": [
{
"name": "PROCCONTAINER",
"type": "block_prototype"
}
],
"example_standalone": "define jump (height)",
"example_with_other_blocks": [
{
"script": "define jump (height)\n change y by (height)\n wait (0.5) seconds\n change y by (0 - (height))\nend\n\nwhen green flag clicked\n jump (50)\nend",
"explanation": "This script first defines a custom block named 'jump' that takes a numerical input 'height'. The definition outlines the actions for jumping up and then down. Later, 'jump (50)' is called to make the sprite jump 50 units."
}
]
}
]
}