Introduction to Scratch and Motion Blocks

Introduction to Scratch and Motion Blocks

What is Scratch?

Scratch is a visual block-based programming language that helps you create animations, stories, and games by arranging blocks like puzzle pieces. Instead of typing code, we drag and drop blocks to make a program.

Scratch Editor: https://scratch.mit.edu/ (Make your account on scratch to save your projects.)

Exploring the Scratch Interface

Before we start coding, let's understand the main sections of Scratch:

  1. Stage: This is where all the action happens. Your sprites (characters) move and interact here.
  2. Sprites Pane: This section shows all the sprites in your project. You can add, delete, and rename them.
  3. Blocks Palette: This contains different categories of blocks (Motion, Looks, Sound, Control, etc.).
  4. Scripts Area: This is where you arrange blocks to create your program.



How to Work with Sprites and Backdrops

1. How to Add a Sprite

Sprites are characters or objects that perform actions in Scratch.

  • Click on the Choose a Sprite button (a cat icon at the bottom right).
  • Select a sprite from the Scratch library or upload your own.
  • The new sprite appears on the Stage and in the Sprites Pane.

2. How to Add a Backdrop

Backdrops set the background of your project.

  • Click on the Choose a Backdrop button (a picture icon at the bottom right).
  • Select a backdrop from the Scratch library or upload your own.
  • The backdrop will appear on the Stage.

3. How to Rename a Sprite

Giving meaningful names to sprites helps in organizing your project.

  • Click on the sprite you want to rename in the Sprites Pane.
  • At the top of the pane, find the text box with the sprite’s name.
  • Type a new name and press Enter.

4. How to Resize a Sprite

You can make sprites bigger or smaller.

  • Click on the sprite you want to resize.
  • In the Sprites Pane, find the Size box.
  • Increase or decrease the number to change the sprite size.

How to Rename and Save Your Projects

1. How to Rename a Project

  • At the top of the Scratch editor, locate the project title (usually “Untitled” by default).
  • Click on the title, type a new project name, and press Enter.

2. How to Save a Project

  • If working online, Scratch automatically saves the project.
  • If working offline, click File > Save to your computer.
  • Choose a folder and save the file with a .sb3 extension.


Motion Blocks Basics

Motion blocks are used to move and control the position, direction, and movement style of sprites in Scratch. These blocks help bring animations and games to life by allowing sprites to move in different ways.

Why are Motion Blocks important?

  • They allow sprites to move in different directions.
  • They help in making animations and interactive games.
  • They are the foundation for building complex movements like jumping, bouncing, or following paths.

1. Move Block

The Move [10] Steps block moves the sprite forward by the given number of steps.

  • Positive numbers move the sprite right.
  • Negative numbers move the sprite left.

Try it:

  1. Drag a Move [10] Steps block into the Scripts area and click it. See how your sprite moves!
  2. Change the number from 10 to -10 and observe how the sprite moves left.
  3. Try different values like 50 or -50.

2. Turn Block

The Turn [15] Degrees block rotates the sprite in a specific direction.

2.1 Turn Right
  • The Turn Right [15] Degrees block rotates the sprite clockwise.
  • Try it: Increase the value to 45 or 90 degrees and observe the change.
2.2 Turn Left
  • The Turn Left [15] Degrees block rotates the sprite counterclockwise.
  • Try it: Set the value to -30 or -90 degrees to see different rotations.

3. Go to Random Position Block

This block teleports the sprite to a random place on the screen.

Try it:

  1. Drag the Go to Random Position block and click it.
  2. Observe how the sprite appears in different locations.

Small Project: Moving a Sprite Randomly

In this activity, you will make a sprite move randomly when clicked.

Steps:

  1. Open Scratch and choose a new sprite (or use the cat sprite).
  2. Drag the Go to Random Position block into the Scripts area.
  3. Connect it with When Sprite Clicked.

When this sprite clicked, it allows functions to move when the sprite is clicked. It is present in the Events Section.

  1. Click on your sprite and watch it move randomly.
  2. Challenge: Add a Turn right block before the random position block. What happens?

Expected Outcome: The sprite jumps to a random position every time you click it.