I assume you're reading this book because you want to learn how to create interactive stories, animations, and games using Scratch, or you want to learn Scratch so that you can teach someone else how to program. It matters not whether your classroom is in a middle school, a home school environment, an after-school workshop, or a weekend coding project with your son or daughter. We are all teachers. That's the perspective of this book. You'll learn how to create projects using Scratch so that you can teach someone else, but no programming knowledge is expected.
In this chapter, we will:
Review what Scratch is and how we can use it
Learn more about the types of projects we will create in this book
Explore an example project from the Scratch website and review the project editor
Whether you're 8 or 80, the Scratch programming language provides a beginner-friendly computer programming environment that enables you to create digital projects. Success with Scratch comes quickly. You won't find any quirky syntax to learn, and you won't make any typing mistakes that prevent your program from running.
Creating a project in Scratch is as easy as snapping the color-coded blocks together. This environment allows us to see the positive results quickly. In addition to this, Scratch helps turn passive users into creators.
You'll find comfort in Scratch's building-block approach to create animations, games, and stories. After using Scratch, programming will make sense. It will seem easy. It will bring a smile to your face, and you'll be able to cope with technical concepts in the future.
Mitch Resnick and the Lifelong Kindergarten Group at the Massachusetts Institute of Technology (MIT) in the Media Laboratory developed Scratch as a teaching language primarily for 8 â 16 year olds, but there's nothing stopping the rest of us from enjoying the Scratch experience and sharpening our creative minds.
The natural reaction of people is to see Scratch as a means of teaching computer science and integrating it into classrooms of all levels. There are teachers who use Scratch across a variety of subjects as seen on the ScratchEd site. The ScratchEd site caters to the educational community and aggregates a lot of Scratch resources, including lesson plans and tips. However, the approach and thoroughness of the included material varies greatly. You can check out ScratchEd at http://scratched.media.mit.edu/.
While writing this book, I did not set out to write a computer science textbook. It's quite simply a tutorial for people who want to learn how to use Scratch to create stories, animations, games, or art. It primarily addresses the parents, home school families, and teachers who may not be programmers themselves but want a fun way to help their children become more digitally literate. Everyone, however, can use this tutorial to learn Scratch, and many young students have worked through the Version 1.4 of Scratch of this book. I expect young scratchers will be more than capable of working through the projects in this edition.
My underlying belief is that knowing how to program can benefit everyone, but not everyone needs to be a programmer. The mental work required to create a program inherently develops an understanding of how computers work, sharpens our critical thinking skills, and gives us lots of practice at solving problems.
There's also an increasingly popular idea that sometimes we want to create applications for personal use. Of course, system administrators have always created custom scripts to help automate repetitive tasks. However, modern applications such as Scratch or the MIT App Inventor (originally developed by Google) make it incredibly easy to create programs for personal use or with the intention of sharing it with a small group of friends, which counters the perspective that learning to program is synonymous with wanting to be a professional programmer or an application developer.
When you have a little bit of programming knowledge, you'll approach non-programming problems in a different way. For example, I've used programming as a marketer to manage search engine optimization and keyword research on business websites. I've also used my programming knowledge to write automated software tests.
Bottom line, programming becomes a tool in your problem-solving toolbox. This is the key to understanding how I approach this Scratch tutorial. I want the computer scientists to come along for the ride, but I'm catering to a broader audience.
Use Scratch to teach yourself or your students how to program. That's the obvious one.
Use Scratch to demonstrate Math concepts. Scratch can also demonstrate the x and y coordinate system in an interactive way.
Use Scratch to inspire your kids to read and write. Find a story and animate each scene or encourage them to animate the story. Turn their haiku into a Scratch project.
Have a child who only wants to play video games? Make a deal. Your child can only play the games he creates or remixes with Scratch.
As you work through the examples in this book, write down your project ideas no matter how hard, easy, obvious, or silly they seem. The next one might be your best idea yet.
Learning: we do it for life. We should help our children develop skills that will help them keep learning and solving problems in an increasingly digital environment. Using Scratch, we will learn how to design, think, collaborate, communicate, analyze, and program in a computer language.
You may frame the Scratch approach as computational thinking. According to Wikipedia:
Computational thinking is a problem solving method that uses computer science techniques. The term computational thinking was first used by Seymour Papert in 1996.
This book will give you a well-rounded introduction to Scratch. It's true that creating games are incredibly popular, and young boys tend to want to create games. However, there are other uses of Scratch, and plenty of people who want to do something other than just create games. Generally speaking, we'll make an animation, tell a story, build a game, create art, and sense the real world.
An animation lets the sprites interact with each other. We'll use the common example of a birthday card to demonstrate animations. The following screenshot shows a birthday card example from Chapter 3, Creaing an Animated Birthday Card:
However, some folks have created more complicated projects using stop-motion animations. You can find some stop-motion animations on the Scratch website at http://scratch.mit.edu/studios/254628/.
Our second story project takes a more classical approach to tell a story by creating a book with a table of contents and then animating the individual scenes as a way of narrating the story.
Games are by the far the most popular Scratch project, and people tend to create all the normal types of games: platformer games, scrolling backgrounds, role-playing games, mazes, and classic arcade games. We'll remix the classic Pong game into a challenging game of Breakout, and in the process, we'll set the stage for many common game-programming concepts. The following screenshot shows the Breakout game:
We will encounter randomness throughout the book, but we'll develop a project that applies random outcomes to an interactive story. The following screenshot shows a Trip to the fortune teller:
The Scratch site is loaded with talented illustrators, and Scratch provides all the tools needed to draw characters and scenes, namely a paint editor and an easy way to animate them. The other kind of art you'll find on the Scratch site is computer-generated art, and we'll spend time drawing geometric shapes, as seen in the following screenshot:
Scratch has historically included support for add-on hardware, such as PicoBoard and LEGO WeDo. Scratch also includes built-in support to use the computer's webcam and senses external sounds using the computer's microphone. We'll explore the webcam, microphone, and PicoBoard in our project.
The following table summarizes several programming concepts that can be learned with Scratch. It's included here primarily to reinforce Scratch as a programming language and foreshadow the concepts we'll use throughout the book. We'll introduce concepts in greater detail as we work through the book.
With the release of Scratch 2.0, project creation has primarily moved online. For users who do not have access to the Internet, the Scratch team has launched a complementary offline editor. I'll introduce you to both the environments.
To get started, in your Flash-enabled web browser, go to http://scratch.mit.edu.
For more information about installing Adobe Flash, go to http://get.adobe.com/flashplayer/ in your web browser.
The top of the page contains the Create, Explore, and Discuss links. As we work through our projects, we'll spend our time creating projects, and I'll leave the forum discussions for later. For now, let's just look at a project.
At the time I wrote this chapter, the Following Orange project was displayed as a featured project. It's available at http://scratch.mit.edu/projects/14852464/. If for some reason this project is not available in the future, just click on any project on the Scratch home page and play it. Just experience a Scratch project as a user.
The following screenshot shows the Following Orange project:
When you share your projects with the Scratch community, this is the primary view. It's a relatively intuitive design. The users provide some instructions and credits about the project as seen in the right-half of the previous screenshot. The project displays a green flag in a circle, and clicking on the green flag starts (initializes) the project.
Above the stage, we see the project name with the name of the author (I have no idea who this user is as I just selected it out of convenience). To the right of the project name is a blue See inside button. When you click on See inside, you'll see the project editor.
Clicking on the See inside button for a project will display the details of the project in the project editor, as seen in the following screenshot. If you click on the Create button from the Scratch website, you will open a new project in the same view.
The display gets a little more complicated because there are more things available on the screen, but it's important to note that everything we need to create, test, and run our projects is accessible from the single view of the project editor.
To borrow a phrase from the Scratch Wiki, the project editor is divided into palettes and panes. At this point, I'll draw your attention to three key areas: the stage, the sprites pane, and the script area. Using the Following Orange project as a guide, we'll discuss each one of the three key areas in the following sections.
Sprites are the characters and objects in our Scratch projects. The list of sprites can be found below the stage. The following screenshot shows the list of sprites available to the Following Orange project:
In order to get our sprites to animate, move, or interact with one another on the stage, we need to create one or more scripts for each sprite. If you click on a sprite from the list, the project editor will show the existing stacks of blocks in the scripts area.
A stack of blocks is a script, and a sprite can have multiple scripts assigned to it. In this book, I'll use either script or stack to refer to a collection of blocks.
The following screenshot shows a script for one of the sprites in the Following Orange project:
To create a game, story, or animation in Scratch, we stack blocks together to form a script that gives instructions to the project sprites. In the middle of the project editor screen, we have categories of blocks that are grouped by the kinds of tasks they represent. They are Motion, Looks, Sound, Pen, Data, Events, Control, Sensing, Operators, and More Blocks. Throughout the book, I'll refer to these categories of blocks as palettes; they can be seen in the previous screenshot.
The palettes of blocks are analogous to the palette of colors an artist mixes while creating a painting. We mix the blocks together to form our art work. Each type of block is color coded so that we can easily identify them by their type in our scripts.
The commands written on the blocks are in plain English, and they don't require a lot of effort to understand the basic idea behind any block. Take the script visible in the previous screenshot as an example. You might not know exactly what these two scripts do, but by reading the blocks, you will generally understand that these blocks are initializing the game and changing to the next level.
One of the core features of Scratch is its built-in image editor, which allows us to draw our own backgrounds and sprites. This makes it incredibly easy for users to create sprites and project backgrounds, and it's readily available from the project editor.
Previous versions of Scratch used a bitmap image editor, but as of Version 2.0, Scratch can also draw in vector graphics, which allows us to create images that are smooth and scalable to any size.
The following screenshot shows the default Scratch cat in the paint editor. If you've used any image editor in the past, including GIMP or Photoshop, then the drawing tools should have a familiar feel to them.
Scratch's built-in paint editor is relatively basic in terms of the number of features, but is functional for most of our uses. In general, the paint editor will allow you to perform the following tasks:
Create shapes and text
Import and edit images in popular formats
Resize and change the orientation of the image
The image editor is available from multiple points within the Scratch interface, as we'll see throughout the book. We'll cover the paint editor in greater detail in Chapter 3, Creating an Animated Birthday Card.
It's not possible to be connected to the Internet all the time, which may be an increasingly difficult idea to accept for some people. Nevertheless, consider that your Internet connection may go down, that the Scratch website may be offline for updates, or perhaps your Internet connection is slow.
If you can't get to the Scratch website, then you can't create a project using the online project editor. Thankfully, the Scratch team has released an offline editor. You can download it from http://scratch.mit.edu/scratch2download/.
The download page includes an online installer that will install the prerequisite software, namely Adobe Air, on your computer. The following screenshot shows the Scratch 2 Offline Editor:
As we see, the offline editor looks like the online editor. Using the offline editor, you can create projects and then share them to the Scratch website. We'll review sharing projects in Chapter 2, A Quick Start Guide to Scratch. The offline version of Scratch 2.0 has been in development for several months following the official release of Scratch 2.0.
The previous screenshot indicates that the editor shown is beta. Be sure to double-check the download page for information pertaining to the functionality and release stability of the offline editor. I would highly recommend downloading the offline version as a backup to the online version. While the Scratch team does make a great effort to protect user privacy, creating and saving projects offline does not require an account on the Scratch website, ensuring user privacy.
One of the biggest limiting factors of Scratch 2.0 is its reliance on Flash and Adobe Air (for the offline version). Not all computer systems are capable of running Flash environments; some Linux users and users of the low-cost, credit card-sized Raspberry Pi come to mind. The Pi is a Linux-based computer that's capable of plugging into an existing television set and keyboard. The Pi and Linux versions in general run Scratch 1.4. My XO laptop also runs Scratch 1.4.
All of these Flash challenges increase the likelihood of encountering Scratch 1.4. I do not insist on the use of Scratch 1.4 until we come across the PicoBoard projects in Appendix A, Connecting a PicoBoard to Scratch 1.4; however, if you're a Scratch 1.4 user, most of these projects can be adapted with little effort. I've taken the effort to specifically identify features that are exclusive to Scratch 2.0 so that users of the older versions can adapt appropriately.
The structure of the Scratch interface makes it easy for us to tinker and explore ideas. As we create projects, we evaluate our work and determine whether the results meet our expectations. It's very easy because everything happens in one interface.
To check whether our project works, we don't have to compile the code, switch windows, upload files to a server, or work around any number of other obstacles to run our project. Scratch enables us to modify the program as it runs and see the results in real time.
In this chapter, we reviewed Scratch both in terms of its possibilities and how it's used in the book to create stories, animations, games, and art. Whether you're a mom, a dad, a workshop facilitator, or a young scratcher, this chapter lays the foundation for the work we'll do in the rest of the book. We've even explored a project and the project editor.
In the next chapter, we'll create an online Scratch account, explore the community, and then move right into our first Scratch project. It'll give us an easy way to tinker with the Scratch interface and take our first steps. We'll focus on some project management fundamentals including naming objects, sharing projects, and lots of things in between.