File size: 10,339 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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
{
  "block_category": "Boolean Blocks",
  "description": "Boolean blocks are hexagonal in shape. They represent conditions that evaluate to either 'true' or 'false' and are typically used as inputs for control flow blocks.",
  "blocks": [
    {
      "block_name": "<() < ()>",
      "block_type": "operator",
      "op_code": "operator_lt",
      "block_shape": "Boolean Block",
      "functionality": "Checks if the first value is less than the second.",
      "inputs": [
        {"name": "OPERAND1", "type": "any"},
        {"name": "OPERAND2", "type": "any"}
      ],
      "example_standalone": "<(score) < (10)>",
      "example_with_other_blocks": [
        {
          "script": "if <(score) < (10)> then\n  say [Keep trying!]",
          "explanation": "This script causes the sprite to say 'Keep trying!' if the 'score' variable is less than 10."
        }
      ]
    },
    {
      "block_name": "<() = ()>",
      "block_type": "operator",
      "op_code": "operator_equals",
      "block_shape": "Boolean Block",
      "functionality": "Checks if two values are equal.",
      "inputs": [
        {"name": "OPERAND1", "type": "any"},
        {"name": "OPERAND2", "type": "any"}
      ],
      "example_standalone": "<(answer) = (5)>",
      "example_with_other_blocks": [
        {
          "script": "if <(answer) = (5)> then\n  say [Correct!]",
          "explanation": "This script makes the sprite say 'Correct!' if the value of the 'answer' variable is exactly 5."
        }
      ]
    },
    {
      "block_name": "<() > ()>",
      "block_type": "operator",
      "op_code": "operator_gt",
      "block_shape": "Boolean Block",
      "functionality": "Checks if the first value is greater than the second.",
      "inputs": [
        {"name": "OPERAND1", "type": "any"},
        {"name": "OPERAND2", "type": "any"}
      ],
      "example_standalone": "<(health) > (0)>",
      "example_with_other_blocks": [
        {
          "script": "if <(health) > (0)> then\n  move (10) steps\nelse\n  stop [all v]\nend",
          "explanation": "This script moves the sprite if its 'health' is greater than 0; otherwise, it stops all scripts."
        }
      ]
    },
    {
      "block_name": "<<> and <>>",
      "block_type": "operator",
      "op_code": "operator_and",
      "block_shape": "Boolean Block",
      "functionality": "Returns 'true' if both provided Boolean conditions are 'true'.",
      "inputs": [
        {"name": "OPERAND1", "type": "boolean"},
        {"name": "OPERAND2", "type": "boolean"}
      ],
      "example_standalone": "<<mouse down?> and <touching [mouse-pointer]?> >",
      "example_with_other_blocks": [
        {
          "script": "if <<mouse down?> and <touching [mouse-pointer]?> > then\n  say [You're clicking me!]\nend",
          "explanation": "This script makes the sprite say 'You're clicking me!' only if the mouse button is pressed AND the mouse pointer is touching the sprite."
        }
      ]
    },
    {
      "block_name": "<<> or <>>",
      "block_type": "operator",
      "op_code": "operator_or",
      "block_shape": "Boolean Block",
      "functionality": "Returns 'true' if at least one of the provided Boolean conditions is 'true'.",
      "inputs": [
        {"name": "OPERAND1", "type": "boolean"},
        {"name": "OPERAND2", "type": "boolean"}
      ],
      "example_standalone": "<<key [left arrow v] pressed?> or <key [a v] pressed?>>",
      "example_with_other_blocks": [
        {
          "script": "if <<key [left arrow v] pressed?> or <key [a v] pressed?>> then\n  change x by (-10)\nend",
          "explanation": "This script moves the sprite left if either the left arrow key OR the 'a' key is pressed."
        }
      ]
    },
    {
      "block_name": "<not <>>",
      "block_type": "operator",
      "op_code": "operator_not",
      "block_shape": "Boolean Block",
      "functionality": "Returns 'true' if the provided Boolean condition is 'false', and 'false' if it is 'true'.",
      "inputs": [
        {"name": "OPERAND", "type": "boolean"}
      ],
      "example_standalone": "<not <mouse down?>>",
      "example_with_other_blocks": [
        {
          "script": "if <not <touching [Sprite2 v]?>> then\n  say [I'm safe!]\nend",
          "explanation": "This script makes the sprite say 'I'm safe!' if it is NOT touching 'Sprite2'."
        }
      ]
    },
    {
      "block_name": "<() contains ()?>",
      "block_type": "operator",
      "op_code": "operator_contains",
      "block_shape": "Boolean Block",
      "functionality": "Checks if one string contains another string.",
      "inputs": [
        {"name": "STRING1", "type": "string"},
        {"name": "STRING2", "type": "string"}
      ],
      "example_standalone": "<[apple] contains [a]?>",
      "example_with_other_blocks": [
        {
          "script": "if <[answer] contains [yes]?> then\n  say [Great!]\nend",
          "explanation": "This script makes the sprite say 'Great!' if the 'answer' variable contains the substring 'yes'."
        }
      ]
    },
    {
      "block_name": "<touching ()?>",
      "block_type": "Sensing",
      "op_code": "sensing_touchingobject",
      "block_shape": "Boolean Block",
      "functionality": "Checks if its sprite is touching the mouse-pointer, edge, or another specified sprite.",
      "inputs": [
        {"name": "TOUCHINGOBJECTMENU", "type": "dropdown", "options": ["mouse-pointer", "edge", "Sprite1", "..." ]}
      ],
      "example_standalone": "<touching [edge v]?>",
      "example_with_other_blocks": [
        {
          "script": "if <touching [edge v]?> then\n  bounce off edge\nend",
          "explanation": "This script makes the sprite reverse direction if it comes into contact with the edge of the stage."
        }
      ]
    },
    {
      "block_name": "<touching color ()?>",
      "block_type": "Sensing",
      "op_code": "sensing_touchingcolor",
      "block_shape": "Boolean Block",
      "functionality": "Checks whether its sprite is touching a specified color.",
      "inputs": [
        {"name": "COLOR", "type": "color"}
      ],
      "example_standalone": "<touching color [#FF0000]?>",
      "example_with_other_blocks": [
        {
          "script": "if <touching color [#FF0000]?> then\n  change [health v] by (-1)\nend",
          "explanation": "This script decreases the 'health' variable by 1 if the sprite touches any red color on the stage."
        }
      ]
    },
    {
      "block_name": "<color () is touching ()?>",
      "block_type": "Sensing",
      "op_code": "sensing_coloristouchingcolor",
      "block_shape": "Boolean Block",
      "functionality": "Checks whether a specific color on its sprite is touching another specified color on the stage or another sprite.",
      "inputs": [
        {"name": "COLOR1", "type": "color"},
        {"name": "COLOR2", "type": "color"}
      ],
      "example_standalone": "<color [#00FF00] is touching [#FF0000]?>",
      "example_with_other_blocks": [
        {
          "script": "if <color [#00FF00] is touching [#FF0000]?> then\n  say [Collision!]\nend",
          "explanation": "This script makes the sprite say 'Collision!' if a green part of the sprite touches a red color elsewhere in the project."
        }
      ]
    },
    {
      "block_name": "<key () pressed?>",
      "block_type": "Sensing",
      "op_code": "sensing_keypressed",
      "block_shape": "Boolean Block",
      "functionality": "Checks if a specified keyboard key is currently being pressed.",
      "inputs": [
        {"name": "KEY_OPTION", "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": "<key [space v] pressed?>",
      "example_with_other_blocks": [
        {
          "script": "forever\n  if <key [space v] pressed?> then\n    broadcast [shoot v]\n  end\nend",
          "explanation": "This script continuously checks if the space key is pressed and, if so, sends a 'shoot' broadcast."
        }
      ]
    },
    {
      "block_name": "<mouse down?>",
      "block_type": "Sensing",
      "op_code": "sensing_mousedown",
      "block_shape": "Boolean Block",
      "functionality": "Checks if the computer mouse's primary button is being clicked while the cursor is over the stage.",
      "inputs": null,
      "example_standalone": "<mouse down?>",
      "example_with_other_blocks": [
        {
          "script": "if <mouse down?> then\n  go to mouse-pointer\nend",
          "explanation": "This script makes the sprite follow the mouse pointer only when the mouse button is held down."
        }
      ]
    },
    {
      "block_name": "<[my list v] contains ()?>",
      "block_type": "Data",
      "op_code": "data_listcontainsitem",
      "block_shape": "Boolean Block",
      "functionality": "Checks if a list includes a specific item.",
      "inputs": [
        {"name": "LIST", "type": "dropdown"},
        {"name": "ITEM", "type": "any"}
      ],
      "example_standalone": "<[inventory v] contains [key]?>",
      "example_with_other_blocks": [
        {
          "script": "if <[inventory v] contains [key]?> then\n  say [You have the key!]\nend",
          "explanation": "This script makes the sprite say 'You have the key!' if the 'inventory' list contains the item 'key'."
        }
      ]
    }
  ]
}