Spaces:
Sleeping
Sleeping
File size: 4,143 Bytes
3abfe5a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
{
"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.",
"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.",
"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.",
"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."
}
]
}
]
}
|