📋
In Scratch, a block is a single command or instruction. Think of it as a physical puzzle piece that contains a specific "rule" for the computer to follow. Instead of typing code, you snap these pieces together to build a program.
1. The Anatomy of a Block
Blocks are designed with "notches" (indents) and "bumps" so that they only fit together if the logic makes sense.
There are six main shapes of blocks, each serving a different purpose:
| Shape | Name | What it does | Example |
| Rounded Top | Hat Blocks | They start every script. They "listen" for an event (like a click). | When green flag clicked |
| Rectangle with Notch | Stack Blocks | The main "action" blocks. They perform a command. | move (10) steps |
| Diamond/Hexagon | Boolean Blocks | They check if something is True or False. | touching mouse-pointer? |
| Rounded Ends | Reporter Blocks | They hold values (numbers or words). | score, x position |
| "C" Shaped | C-Blocks | They wrap around other blocks to repeat them or check conditions. | forever, if...then |
| Flat Bottom | Cap Blocks | They stop a script or the whole project. | stop all |
2. How to Use Blocks
Using blocks is a simple three-step process:
Find: Look through the Block Palette on the left. They are color-coded (e.g., Blue for Motion, Yellow for Events).
Drag: Click and hold a block, then drag it into the Scripts Area (the big empty space in the middle).
Snap: Bring one block close to the bottom of another. You’ll see a gray highlight appear; let go, and they will "click" together like magnets.
3. The Color Palette (Categories)
Scratch organizes blocks into colors so you can find them instantly:
🔵 Motion: Moving and turning.
🟣 Looks: Changing costumes, speech bubbles, and size.
🌆 Sound: Playing music and sound effects.
🟡 Events: The "triggers" that start the code.
🟠 Control: Loops (
forever) and logic (if/then).🧪 Sensing: Detecting touching, colors, or mouse position.
🟢 Operators: Math ($+$, $-$, $\times$, $\div$) and comparing numbers ($>$, $<$, $=$).
🧱 My Blocks: Where you can create your own custom blocks!
4. Pro Tip: Deleting and "Un-snapping"
To un-snap: Grab the block below the one you want to keep and pull it away.
To delete: Drag any block or stack back into the Block Palette area, or right-click it and select "Delete Block."
To test: Just click on a single block or a stack in the Scripts Area to see it run immediately on the stage—you don't even have to click the Green Flag!
Would you like to learn how to create your own "My Blocks" (Functions) to keep your code clean and organized?
📋
0 件のコメント:
コメントを投稿