Scratch_vlm_v1 / blocks /c_blocks.json
WebashalarForML's picture
Upload 175 files
a522962 verified
raw
history blame
4.27 kB
{
"block_category": "C Blocks",
"description": "C blocks are shaped like the letter 'C'. They are used to loop or conditionally execute blocks that are placed within their opening, managing the flow of scripts.",
"blocks": [
{
"block_name": "repeat ()",
"block_type": "Control",
"block_shape": "C-Block",
"op_code": "control_repeat",
"functionality": "Repeats the blocks inside it a specified number of times.",
"inputs": [
{
"name": "times",
"type": "number"
}
],
"example_standalone": "repeat (10)",
"example_with_other_blocks": [
{
"script": "when [space v] key pressed\n repeat (10)\n move (10) steps\n wait (0.1) seconds\n end",
"explanation": "This script makes the sprite move 10 steps Ten times, with a short pause after each movement on spacebar pressed."
},
{
"script": "when [up arrow 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, with a short pause after each movement on up arrow pressed."
}
]
},
{
"block_name": "forever",
"block_type": "Control",
"block_shape": "C-Block",
"op_code": "control_forever",
"functionality": "Continuously runs the blocks inside it.",
"inputs": null,
"example_standalone": "forever",
"example_with_other_blocks": [
{
"script": "when green flag clicked\n forever\n move (5) steps\n if on edge, bounce\n end",
"explanation": "This script makes the sprite move endlessly and bounce off the edges of the stage, creating continuous motion."
}
]
},
{
"block_name": "if <> then",
"block_type": "Control",
"block_shape": "C-Block",
"op_code": "control_if",
"functionality": "Executes the blocks inside it only if the specified boolean condition is true. [NOTE: it takes boolean blocks as input]",
"inputs": [
{
"name": "condition",
"type": "boolean"
}
],
"example_standalone": "if <touching [mouse-pointer v]?> then",
"example_with_other_blocks": [
{
"script": "forever\n if <touching [color (red) v]?> then\n stop [this script v]\n end",
"explanation": "This script continuously checks if the sprite is touching a red color, and if so, it stops the current script."
}
]
},
{
"block_name": "if <> then else",
"block_type": "Control",
"block_shape": "C-Block",
"op_code": "control_if_else",
"functionality": "Executes one set of blocks if the specified boolean condition is true, and a different set of blocks if the condition is false. [NOTE: it takes boolean blocks as input]",
"inputs": [
{
"name": "condition",
"type": "boolean"
}
],
"example_standalone": "if <score > (10)> then else",
"example_with_other_blocks": [
{
"script": "if <(score) > (10)> then\n say [You win!] for (2) seconds\nelse\n say [Keep trying!] for (2) seconds\nend",
"explanation": "This script checks the 'score'. If the score is greater than 10, it says 'You win!'; otherwise, it says 'Keep trying!'."
}
]
},
{
"block_name": "repeat until <>",
"block_type": "Control",
"block_shape": "C-Block",
"op_code": "control_repeat_until",
"functionality": "Repeats the blocks inside it until the specified boolean condition becomes true. [NOTE: it takes boolean blocks as input]",
"inputs": [
{
"name": "condition",
"type": "boolean"
}
],
"example_standalone": "repeat until <touching [edge v]?>",
"example_with_other_blocks": [
{
"script": "repeat until <touching [edge v]?>\n move (5) steps\nend",
"explanation": "This script makes the sprite move 5 steps repeatedly until it touches the edge of the stage."
}
]
}
]
}