Introduction to Scratch

In this lesson, you will be learning to use a piece of software called Scratch. You can use Scratch to make your own computer games or animations. Scratch was developed by the Lifelong Kindergarten Group at the MIT Media Lab. For more information, see scratch.mit.edu.

Getting Started

This is the Scratch window. It has a few different parts. The characters in your program are called sprites, and they are shown in the lower-left corner of the screen. The default character is a cat sprite. To write a program, you will drag blocks from the Blocks area to the Scripts area. Your program will run in the Stage area.

Moving and Turning in Scratch

Start by dragging a move block into the Scripts area. This block is on the Motion menu. This is your first program! Click on this block to run your program. What does the sprite do?

Exercise: Change the number in the block and click on it again. What changes? Try a negative number. What does the sprite do?

You write programs in Scratch by connecting blocks together. Try connecting a turn block to your move block. Drag it into your program until it connects to the move block. Click on your program to run it. What happens?

There are two turn blocks in Scratch, one to turn right and one to turn left.

Exercise: Add a variety of turn and move blocks to your program to make the sprite move in an interesting way. If your sprite moves too far toward the edge of the stage, just click and drag it back to the middle.

Events

So far, you have been running your program by clicking on it. You can also use an event to start a program. An event is an action that the computer can recognize. For example, you might press a key on the keyboard or click on a sprite. Both of those are events.

Click on the Events menu. The top block on this menu is when flag clicked.

Drag the when flag clicked block into your program until it connects to the top of your script. Notice that the shape of this flag shows you that it must be at the top of a script. It can’t be connected below another block.

Now you can run your program by clicking on the green flag at the top of the screen. Try it out!

Another interesting block on the Events menu is the when key pressed block. Use this block to make the sprite move when the spacebar is pressed.

Click on the black triangle in the when key pressed block. A menu will pop up that will allow you to select other keys. Modify your program so that the sprite moves when the right arrow is pressed.

Exercise: You may have already discovered that you can write multiple scripts for the same sprite! You should write four scripts for the cat sprite. These scripts should enable you to use the four arrows on the keyboard to move the cat sprite around the stage. Each arrow should correspond to one movement of the sprite. Think carefully about which arrow you will use for which movement. Test your project to make sure that you can move the cat to any part of the stage.

Saving Your Work

It is very important to save your work often! Otherwise, you might lose something important. To save a new project in Scratch, click on File and then Save as. Give your project a name and then click Save. Once your project has a name, you can save it by going to File and then Save.