Scratch 1.4: Beginner's Guide

By Michael Badger
  • Instant online access to over 7,500+ books and videos
  • Constantly updated with 100+ new titles each month
  • Breadth and depth in over 1,000+ technologies

About this book

If you have the imaginative power to design complex multimedia projects but can't adapt to programming languages, then Scratch 1.4: Beginner's Guide is the book for you. Imagine how good you'll feel when you drag-and-drop your way to interactive games, stories, graphic artwork, computer animations, and much more using Scratch even if you have never programmed before.

This book provides teachers, parents, and new programmers with a guided tour of Scratch's features by creating projects that can be shared, remixed, and improved upon in your own lesson plans. Soon you will be creating games, stories, and animations by snapping blocks of "code" together.

When you program you solve problems. In order to solve problems, you think, take action, and reflect upon your efforts. Scratch teaches you to program using a fun, accessible environment that's as easy as dragging and dropping blocks from one part of the screen to another.

In this book you will program games, stories, and animations using hands-on examples that get you thinking and tinkering. For each project, you start with a series of steps to build something. Then you pause to put our actions into context so that you can relate our code to the actions on Scratch's stage. Throughout each chapter, you'll encounter challenges that encourage you to experiment and learn.

One of the things you're really going to love is that, as you begin working through the examples in the book, you won't be able to stop your imagination and the ideas will stream as fast as you can think of them. Write them down. You'll quickly realize there are a lot of young minds in your home, classroom, or community group that could benefit from Scratch's friendly face. Teach them, please.

Publication date:
July 2009


Chapter 1. Welcome to Scratch!

Learn how to create animations, interactive stories, and games the drag-and-drop way using the computer programming language Scratch. Scratch provides an intuitive interface that makes learning to program fun, easy, and well-suited as an educational tool for our children and students.

We don't need to artificially restrict Scratch to the classroom though it makes a fantastic teaching tool. Anyone with a desire to learn a programming language can use Scratch as an introductory language. Perhaps you've tried other languages, such as Ruby, PHP, Java, or Python and had trouble getting started for one reason or another. Even if you can barely create a presentation using PowerPoint or, you'll find comfort in Scratch's building-block approach to programming.

After using Scratch, programming will make sense. It will seem easy. It will bring a smile to your face.

Whether you want to improve your digital literacy skills by learning to program or you want to learn a new tool to help you teach your students, here's to happy Scratchin'.


What is Scratch?

Scratch is developed by the Lifelong Kindergarten group at the MIT Media Lab. See for more information. The Lifelong Kindergarten group at the MIT Media Lab developed Scratch as a teaching language specifically for 8 to 16 year olds, but there's nothing stopping the rest of us from enjoying the Scratch experience and sharpening our 21st century learning skills.

21st century learning skills

Learning: We do it for life. We should help our children develop skills that will help them keep learning in an increasingly digital environment.

Using Scratch, we learn how to design, think, collaborate, communicate, analyze, and program in a computer language. Many of these ideas incorporate 21st century learning skills. If you'd like more information about 21st century learning skills, visit the Partnership for 21st Century Skills web site at

By the time we make our cat dance for the first time, we'll forget all about the academic research and theories behind Scratch. Instead, we'll be focused on discovering the next idea.

How to use Scratch?

I couldn't begin to suggest every possible way for you to use Scratch; that's why we have an imagination. However, here are a few ideas to get you started.

Use Scratch to teach yourself or your students how to program. That's the obvious one.

Use Scratch to demonstrate math concepts. For example, when it's time to teach variables, set up an interactive game that uses a variable to keep score or moves based on the variable data. Scratch can also demonstrate the X and Y coordinate system.

Inspire your kids to read and write. Find a story and animate each scene, or encourage them to animate the story. Turn their persuasive essays into a Scratch project.

Have a child who only wants to play video games? Make a deal. Your child can play only the games he or she creates with Scratch.

I'm sure you've got a lot of ideas flowing in your mind by now. Keep writing them down no matter how hard, easy, obvious, or silly they seem to be. The next one might be your best idea yet.


Programming concepts

With Scratch, we'll learn how to turn our imaginations into games, stories, and animations, and in the process, we'll learn some common programming concepts. If you're already a knowledgeable programmer, then you'll find out what Scratch has to offer your students.

The Scratch team publishes several resources to help educators, including a Programming Concepts guide, which I've summarized below:



Program Design

When we design a program, we turn our imagination into something that can be shared with others. We create the flow of the program, the interface, and the actions each sprite takes to tell our story.

Loops (Iteration)

Loops iterate through a series of steps for as long as we tell the program to run the loop. We can use other programming concepts, such as conditional statements, to control the loop.

Conditional Statements

Check to see if a statement is true. For example, if 4 > 0 is a conditional statement.

Boolean Logic

Boolean logic operators include and, or, and not. If 4 > 0 and 4 > 1 is one example.


Variables store text or numbers for reuse in the program. They come in global and local types. For example, if x > 0 creates a conditional statement where x is 0, 1, 2, or anything else we define.

Arrays (Lists)

Arrays are similar to variables in that they store dynamic data. However, a list stores multiple values in the same way a grocery list stores a group of items.


An action in the program prompts another part of the program to take an action. For example, when the Space bar is pressed, the sprite hides.

Synchronization and Coordination

Programming a sprite to receive a broadcast message from another sprite coordinates a cause and effect. Broadcasting a message and waiting for all the other sprites to act on the broadcast synchronizes the action.


Creating two scripts to run on the same control enables parallel execution. For example, programming four different sprites to pixelate when the flag (green in color) is clicked creates four threads.

Dynamic Interaction

Dynamic interaction provides real-time input into the Scratch program in order to manipulate the sprite in some way. For example, the position of the mouse is always known, so we can create a sprite that always follows the mouse position.

Random Numbers

Random numbers are picked from the range we specify.

Programming limitations

As of Scratch version 1.4, there are a few limitations with the language. As taken from Scratch's Programming Concepts guide, here are the concepts Scratch does not cover: functions, recursion, exception handling, file input/output, inheritance, parameter and return values, and defining classes of objects.

If that last paragraph sounds like gibberish, don't worry about it.


Scratch anatomy

For those of us with a desire to use geek terms, Scratch provides an Integrated Development Environment (IDE) that enables us to design, program, and run our projects. Don't worry; we'll just call it the Scratch interface from this point forward. You can see it in the following screenshot:

In the following chapters, we will become familiar with the parts of the Scratch interface, so we don't need to spend a lot of time reviewing what each button does. Let's instead stick with the big concepts.

Building blocks

If we review the Scratch interface from left to right, everything we need to create a project is readily accessible. To the left side of the interface, we have categories of blocks that are grouped by the kinds of tasks they perform. They are Motion, Looks, Sound, Pen, Control, Sensing, Operators, and Variables.

Throughout the book, I'll refer to these categories of blocks as palettes.

The palette of blocks available to us as Scratch programmers are analogous to the palette of colors an artist mixes when creating a painting. Each type of block is color-coded so that we can easily identify them in our scripts.

Write the script

When we create our Scratch programs, we build a group of scripts that tell our story. Instead of using words as you're used to reading them on this page, we'll build our scripts from the palette of blocks.

We'll drag, drop, and snap them into place in the Scripts area to create our story. The following screenshot shows a script that was taken from one of the sample projects included with Scratch:

If we read the blocks shown in the screenshot from top to bottom, we should have a good idea of the story this sprite tells. Who doesn't love a knock-knock joke?

To see our story play out, we watch the stage.

Watch the story

When it comes time to review the script, we watch it on the stage. It's here that we get to see our ideas turn into reality.

And just like the stage at the theater, we can see from our screenshot that we can have a cast of characters to entertain us.

Scratch even provides a built-in image editor to help us create and modify our characters, which we call sprites.

Built-in image editor

Scratch includes a simple image editing environment called the Paint Editor that allows us to apply text, color, and shape to our sprites and backgrounds.

The Paint Editor allows us to do the following:

  • Create shapes and text

  • Import and edit images

  • Apply color treatments

  • Resize, rotate, and flip an image

The Paint Editor is available from multiple points within the Scratch interface, as we'll see later in the book.

Interface promotes tinkering

The structure of the Scratch interface makes it easy for us to tinker and explore ideas. As we create, we evaluate our work and determine if the results meet our expectations. It's very easy because everything happens in one interface.

We don't have to compile code, switch windows, upload files to a server, or encounter any number of obstacles to see if our code works. Scratch enables us to modify the program as it runs and see the results in real time.


Learning Scratch

I took a project-based approach in this book. So, instead of working with a single project, each chapter creates something new.

While I may want to tell a story, you may want to create a game, build an animation, or explore an interactive art project. By working with a range of projects, we'll quickly learn and focus on the concepts that matter the most.

The more ideas we generate, the better off we'll be when it comes to helping our children or students learn Scratch. Feel free to adapt the projects in this book to your own needs. Reuse them as needed.

It's true that Scratch will teach us how to program, but it really just provides us a visual framework. We can use this framework to express creative thinking while we learn how to do the following:

  • Design the project's scenes and interfaces

  • Analyze behavior and troubleshoot problems

  • Improve the project through revisions

  • Share our imagination with our peers through our projects

I expect that after we get started, you'll have your own ideas about a project or a variation on the current exercise. Keep a pen nearby and write those ideas in the margin.

Here's a chapter-by-chapter look at what we'll cover in the book.

Welcome to Scratch!

You're reading this chapter right now. You'll find out what we can expect from Scratch and how it can help us teach 21st century learning skills.


Scratch is a cross-platform application, which means you can use it on Windows, Macintosh, and Linux operating systems. In this chapter, we'll look at the installation procedure on each operating system and even learn how to run Scratch from your USB flash drive.

We'll also make sure your web browser can view Java applets, which is the technology Scratch uses to publish projects on the Web.

Start Scratching

We will explore the Scratch interface and create some simple scripts that demonstrate how easily we can build a project. This is a high-speed tour of Scratch that gets us tinkering and thinking about what's possible.

Sharing is a central philosophy to Scratch. Each project we upload to the community web site will be available under a Creative Commons Attribution-Share Alike license. Since we don't have any work to share, this gives us an idea of where we're heading. We'll demonstrate how to find and download a project to inspire us.

Graphics and Slideshows

In Chapter 4, we will slow down the pace and talk about the concepts in more detail. We will also create two projects; the first will be an animated birthday card, and the second will be a picture slideshow using our favorite photos.

We'll use the Paint Editor to design images for the project and transform those images with various graphic effects. We'll also learn how to control the sequence of our scenes.


We will develop a barnyard humor book that lets us shine as storytellers. We'll find out how to turn our chapters into scenes using Scratch.

Our sprites will change appearances, speak, make noise, and report to specific stage coordinates. The emphasis will be on how to use these elements to tell their story.

Arcade Games

In Chapter 6, we will take a classic pong game that's included with Scratch and give it a little personality. Our Scratch installation comes with a classic looking pong game, so rather than start over, we'll modify it.

The central concepts in this chapter include dynamic interaction and conditional statements to control how our paddle and ball move across the stage. We will also introduce variables as a way to store and retrieve information for use in our programs.

Games of Fortune

Here, we will visit the fortune-teller and learn the answers to all our deepest questions. It might be more appropriate to say we'll build the fortune-teller game, so we shouldn't really trust our "fortunes."

In Chapter 7, we will combine what we know about variables with lists, also known as arrays. We will use the lists to store information about our fortunes and use random numbers to retrieve the data. Variables store dynamic data that we use to determine how our program should behave.

Math and Finance

Chapter 8 proposes the following problem: Would you rather have a dollar today that doubles every day for a set number of days? Or, would you rather have a lump sum of money? We will build the program to answer that question.

This chapter compares the power of doubling versus the accrual of simple interest. We'll make the math problem interactive and allow the user to input custom starting values. Then, we'll show the results in a graphical format using the pen tool.


We're back to sharing. In Chapter 3, we learned how to download a project from the Scratch web site. In Chapter 6, we transformed a Scratch project to meet our own needs. In Chapter 9, we will give back to the Scratch community by making our own project available on the web site for others to enjoy and adapt.

In the process, we'll review the many ways in which we can promote our project to gain fans. For advanced users, we'll incorporate our Scratch projects on our own web server.

Real-world stimuli

We'll add our own personal touch to Scratch in Chapter 10 by connecting a webcam and a PicoBoard to our computer. The PicoBoard is an add-on piece of hardware that connects to our computer and delivers real-world stimuli to Scratch.

If you don't have a PicoBoard, you can still review this chapter to see what kinds of things you can do. Then, you can decide whether or not you want to get one. For example, this chapter gives us an example of how to program gravity that may be useful in your game whether you use a PicoBoard or not.

To demonstrate the board's light, sound, button, slider, and electrical resistance sensors, we will modify existing projects.



Imagine. Create. Share. It's the Scratch way. And now that we know that Scratch is good for our brains, let's get started with the installation.

About the Author

  • Michael Badger

    Michael Badgeris a writer and technical communicator who has worked in a range of technical roles, including support, automated software testing, and project management. He has authored several books for Packt Publishing, including Scratch 1.4 Beginner's Guide. He also authors a regular Scratch column for Raspberry Pi Geek Magazine, which focuses on Scratch 1.4.

    Browse publications by this author
Book Title
Access this book, plus 7,500 other titles for FREE
Access now