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

  1. Click on the "Choose a Sprite" button (cat icon) in the bottom-right corner
  2. Select any sprite you like from the library
  3. You can also paint your own sprite or upload an image

Step 2: Add Movement

  1. Go to the "Events" category (yellow blocks)
  2. Drag out the "when green flag clicked" block
  3. Go to the "Motion" category (blue blocks)
  4. Attach a "move 10 steps" block
  5. Click the green flag to test your program

Step 3: Add a Loop

  1. From the "Control" category (orange blocks), add a "forever" block around your movement block
  2. Add a "if on edge, bounce" block inside the forever loop
  3. 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:

  1. Click "File" in the top-left corner
  2. Select "Save to your computer"
  3. Choose a location and name your file (it will save with a .sb3 extension)

To share your project online:

  1. Create a free Scratch account at scratch.mit.edu
  2. Click "Share" in the top-right corner
  3. Add a title and instructions
  4. Click "Share" to make it public

Practice Activity

Create a simple animation where a sprite:

  1. Starts in the center of the stage when the green flag is clicked
  2. Moves in a square pattern using motion blocks
  3. Changes color each time it turns a corner
  4. Plays a sound when it completes the square

Hint: You'll need blocks from Motion, Looks, Sound, and Control categories.