Scratch . . . allows us to
introduce extremely
sophisticated ideas
in math, science,
and computer
programming in a way
that’s fun for kids and
adults to learn together.
about the many useful Help features
available at the MIT site. The best way to
learn Scratch is to just start using it.
Scratch, like most 2D gaming and animation tools, is based on the notion of
sprites. A sprite is an image with special
properties; it can move, turn, and bump
into other sprites (and often it can do
much more, but those are the basics).
If you look at the right-hand panel
you’ll see a cat in a white box. The white
box is your stage, and the cat is your first
sprite. (The default sprite is called Scratch
the cat, the mascot of the Scratch project.) The panel farthest to the left contains a series of buttons. Each of these
buttons indicates something the current
sprite can do. Try this experiment: Be
sure the blue Motion buttons are visible,
and double-click the Move 10 Steps button repeatedly. Watch what happens to
the cat. He moves!
Now take the Move 10 Steps button
and drag it into the large center area. It
will just sit there. Now take one of the
Turn 15 Degrees buttons, and drag it into
the same center area. If you get close to
a button that’s already in the center area,
you’ll see a white bar, indicating you
can join the two buttons together. Do
that, so that the two buttons are joined.
(It doesn’t matter which order they are
in for now.) You’ve put two commands
together to make something new. If you
double-click this new combination, it
Figure 2
will both move and rotate that cat. Congratulations! You’re now a computer programmer. It gets a little harder than this,
but not much.
There are a couple more steps to do
before you can call this first animation
“finished.” The blue buttons are all about
changing the motion of the cat, but
there’s much more you can do. The buttons in the upper-left corner all let you
access different trays of commands. Click
the yellow Control button to see the commands about controlling the general flow
of behavior. Many of the most important
commands are here. Find the one that
says Forever. It looks to me kind of like
an alligator mouth. (Don’t use Forever If;
that’s a different command.)
Take the Forever block and drag it to
the combination you’ve just made in the
center area. If you get it close enough, the
“mouth” opens up and the Forever block
surrounds the other elements. If you
double click this, the cat will quickly spin
around! Give it a try!
Finally, it’s nice to add a cleaner way
to start and stop your programs. With-
in the same set of Control commands,
you should see a button that says When
<green flag> Clicked. This button looks
kind of like a hat, because it’s meant to
indicate the beginning of a block of code.
Drop it right on top of your other code.
When you’re finished, your code should
look like Figure 2.
Used properly, games and animations can be
used as an interesting way to motivate history
lessons, demonstrate ideas, explore the world, and
(especially) reinforce math ideas.
Sliding Back and Forth
I’ve walked you through the first project, but this is about gaming, so the rest
of the exercises are positioned as gaming challenges. I will provide you with a
sample and some hints, and your job is
to figure out how to make the sample.
It’s best to work with a partner, and you
can look things up online, but really you
just need some imagination and willingness to play around. If you get stuck anywhere, I have solutions to all the exercises
on my website (
www.aharrisbooks.net/
scratchTutorial).
Your first challenge is to make Scratch
the cat walk back and forth. Here’s my
sample:
aharrisbooks.net/scratchTutorial/
backForth.html.
Note that the first time you try to
open this file, you might be prompted
to install or update Java. This is a technology often used in web programs.
The form of Java used in this example is
completely safe. Please allow the use of
Java for the example programs in this
tutorial.
The first example involves making the
cat walk back and forth on the screen.
There are a few main ideas to notice:
•;Scratch;starts;moving;when;you;click
the green flag.