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.
You'll get a page that resembles the following screenshot:
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.
Looking inside a Scratch project
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.
The large space beneath the green flag and the stop sign icons is the stage. This is where our sprites act out their scripts. It's here that we get to see the result of our programming.
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.
Tip
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.
The built-in image editor
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
- Apply color
- 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.
Using Scratch 2.0 offline
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.