4. Concepts and Overview of Scratch
Before we get our knuckles sore, let's take a moment to go over some basic
concepts.
Welcome to the Theater
While I suppose that all the world's a stage, I think it is helpful to look at
a Scratch project as a play production. Any play is presented on a stage . The
stage is where backgrounds are placed and actors carry out their lines. (The
stage, in Scratch, is also in charge of "things that happen behind the scenes",
but we'll get into that later).
On the stage, our actors perform. In Scratch, actors are called sprites, and I
dare say that you may feel your own actors aren't robots of your own creations,
but capricious characters with their own motives.
Each sprite can have one or more costumes as well as a script . The script
contains the directions and actions it should perform.
Like an actor in a play, a sprite can begin off-stage (we call it hiding), and
then move across the stage, repeat its lines, and then exit. Unlike in a play,
however, the sprite can change costume mid-scene without causing a ruckus.

First Look at the Environment
If you haven't already done so, now is a good time to start up the Scratch
program. Let me highlight a couple of key areas; feel free to ignore the
other dials, knobs and whistles for the moment.
On the right side near the top is a large white area (in the screen shot below,
I've marked with pink lines). This is the stage. This is where all the
stories are told, the art designs are shown, the games are played, and the
action happens.

Below the stage is the Sprite Container, listing all of the sprites in the project.
When you start a new project, you will have a single sprite, named Sprite1
wearing a cat costume. It just so happens that this sprite is wearing his
costume centered on the stage.
Next to the sprites is an icon representing the stage. Clicking on this will
allow you to change the backgrounds for the stage.
Occupying the center section is the Sprite Details Area. It displays details
based on which sprite (or the stage) is selected. Three tab allows you
to change what is displayed:
- Scripts. Instructions and directions for the sprite's performance is
placed in this area.
- Costumes. Each sprite can have one more more costumes. A costume is an
image that the sprite can change based on a script. For instance, a sprite
can change color, or a script can cycle through costumes in order to animate the sprite walking.
- Sounds. Each sprite can have a collection of recordings that it can
speak based on instructions from the scripts.

We'll talk about the details of this section later. I just wanted to get you
familiar with the environment.
Overview of Blocks
When the Scripts tab is selected, the instructions for a particular sprite is
shown. A sprite's script is where most of the interest lies, for without
the script, our play would be quite lifeless. A single action for the sprite to
perform is encapsulated in a block.
The blocks come from the section on the far left side of the window, the
Blocks Palette area. Scratch comes with a lot of blocks, so the blocks are
grouped based on what they do or what they affect.
- Motion. Blocks that move and manipulate the placement of a sprite.
- Looks. Blocks that affect how the sprite appears; for example, to be larger or smaller or in different costumes.
- Sound. Blocks that play music, drum beats or recordings.
- Pen. Blocks that allow the sprite to draw on the screen.
- Control. Blocks that determine when scripts should run and control other stacks of blocks.
- Sensing. Blocks that allow a sprite to sense what is around it; for instance, various colors or other sprites.
- Numbers. Blocks that help a sprite perform math operations.
- Variables. Blocks that remember things.

A block from a particular group has a color that matches the group. This feature
is helpful in finding a particular block, as well as the added benefit of making it
easier to duplicate the script listings in this book.
Block Types
Blocks come in two flavors, connectable and embeddable (called reporters).
Connectable blocks connect into a sequence. An embeddable block is placed within
another block and affects how it behaves.

In the above diagram are three connectable blocks. As you can see, a
connectable block is a lot like a LEGO brick in that in can be connected to
other blocks to create a stack . Each block has the action it performs written
on the brick. Each of these particular blocks has a notch at the top and
bottom, which means that the brick can come anywhere in a stack.
Hat Blocks
The other type of connectable block is called a hat block which only occurs at
the beginning of a stack. It usually specifies when the stack will be executed.

Grouping Blocks
Grouping blocks surround a stack of other blocks (they are also called crocodile mouths
because of the oral resemblance). A grouping block can be a looping block, in
which case, the inner stack is executed more than one time (as in the example
below), or it could be conditional, in which case, it may not be executed at
all.

Value Blocks
Embeddable blocks come in two flavors: value blocks and conditional blocks.
The value blocks contain some
value that can be placed into another block to affect how it behaves. For
instance, in the following stack, when the "Kitty Cat" sprite is clicked, it
changes its size. The size is determined by the value block, pick random which
will choose a random number and give this random number to the set size to
block.

Conditional Blocks
Conditional blocks evaluate something and return either true or false . These
blocks are distinguishable from value blocks by having pointy sides. In the
following example, the if block has a conditional block that compares if the
sprite is touching a particular color, and if so, it executes the commands
inside. In this case, it hides the sprite.

Conclusion
In this chapter, we were introduced to the concepts and ideas of Scratch.
You can't stop now, since we just scratched the surface. Now that you have
the concepts in mind, jump to the next chapter and let's start building your
first project.
Tell others about this article: