3.2 Scratch Basics
Introduction to Scratch
Scratch is a free, block-based programming language developed by MIT that makes it easy to create interactive stories, games, and animations. It's designed to be fun, educational, and accessible for beginners of all ages.
Why Use Scratch?
- Visual programming interface (no syntax errors!)
- Great for learning programming concepts
- Large online community with millions of shared projects
- Can be used online or offline
Scratch Interface Overview
Main Components:
| Area | Purpose |
|---|---|
| Stage | Where your project runs and is displayed (480x360 pixels) |
| Sprite List | Shows all characters and objects in your project |
| Blocks Palette | Contains all the programming blocks organized by category |
| Scripts Area | Where you drag and snap blocks together to create scripts |
| Costumes/Backdrops | Where you edit sprites and backgrounds |
| Sounds | Where you add and edit sounds for your project |
Your First Scratch Program
Let's create a simple program where a sprite moves across the screen when the green flag is clicked.
Step 1: Choose a Sprite
- Click on the "Choose a Sprite" button (cat icon) in the bottom-right corner
- Select any sprite you like from the library
- You can also paint your own sprite or upload an image
Step 2: Add Movement
- Go to the "Events" category (yellow blocks)
- Drag out the "when green flag clicked" block
- Go to the "Motion" category (blue blocks)
- Attach a "move 10 steps" block
- Click the green flag to test your program
Step 3: Add a Loop
- From the "Control" category (orange blocks), add a "forever" block around your movement block
- Add a "if on edge, bounce" block inside the forever loop
- Click the green flag to see your sprite bounce back and forth
Essential Scratch Blocks
| Category | Key Blocks | Purpose |
|---|---|---|
| Motion | move, turn, point in direction, go to x: y: | Control sprite movement and rotation |
| Looks | say, switch costume, change size by | Change appearance and display text |
| Sound | play sound, change volume by | Add sound effects and music |
| Events | when green flag clicked, when key pressed | Start scripts based on events |
| Control | wait, repeat, forever, if-then | Control script flow and timing |
| Sensing | touching color?, key pressed?, mouse x/y | Detect user input and conditions |
| Variables | set to, change by | Store and modify data |
Saving and Sharing Projects
To save your project:
- Click "File" in the top-left corner
- Select "Save to your computer"
- Choose a location and name your file (it will save with a .sb3 extension)
To share your project online:
- Create a free Scratch account at scratch.mit.edu
- Click "Share" in the top-right corner
- Add a title and instructions
- Click "Share" to make it public
Practice Activity
Create a simple animation where a sprite:
- Starts in the center of the stage when the green flag is clicked
- Moves in a square pattern using motion blocks
- Changes color each time it turns a corner
- Plays a sound when it completes the square
Hint: You'll need blocks from Motion, Looks, Sound, and Control categories.