Scratch - Victor Fitzjarrald

advertisement
Scratch
Computer Programming Level 1
What You’ll Learn…






The characteristics of a computer and the evolution of computer
design
About computer programming languages
About careers in computer programming and software engineering
How to find your way around the Scratch workspace, the function of
palettes and blocks and how to select Sprites
How to use Scratch to program a computer animation
How programming statements control the behavior of characters in
an animation
Stuff You’ll Need…

A Scratch Account…
Evernote Suggestions…




Write down three interesting things you learn (every day)
Keep a glossary of words you learn during these activities. Pay
particular attention to the bold, italicized words you find.
List any online resources you used to help you with your work.
Record your work as you learn Scratch. Keep a record of what you
did to complete each tutorial. Use screen captures to show your
work.
For Extra-Credit:
 Create a simple guide that explains the basic controls and tools
needed to use Scratch. Use images and text.
 Explain the modifications you made to tutorial activities.
 Make a list of new blocks that you taught yourself. Explain what
each block does.
What You Should Know…
What is a Computer?
A computer is any programmable machine that
can take in and store information and produce
something useful with that information.
Computers have evolved along with human
civilization. Early computers were simple
mechanical devices. Modern computers are
powerful, complex electronic devices.
Before digital watches,
clocks used gears to
track time.
Image courtesy of www.coolnerds.com
Image courtesy of
Princeton University
What You Should Know…
Mechanical Computers
Long before electronic computers, humans used mechanical tools to
help them collect, store, and use information. Early devices included
the abacus, the clock, the slide rule and the player piano. These
tools allowed people to keep track of information or perform multiple
calculations.
The holes in the paper roll provided all
the instructions this antique player piano
needed to play a song.
The slide rule, shown above, is a mechanical computer used to
perform complex mathematical calculations.
The abacus is a simple mechanical calculator.
What You Should Know…
Electronic Computers
Modern computers make use of
electricity and microprocessors
or chips. They still work on the
same principle of all computers: to
take in and store information and
to produce useful information.
Early electronic computers were
not small or powerful. In fact, the
power of the machine you are
using to read this is millions or
even billions times greater than
early electronic computers.
The machine pictured above, called Colossus,
was used by the British to crack German codes
during the Second World War. The Colossus used
vacuum tubes and roles of paper to compute
possible solutions to codes.
Image courtesy of the Computer Museum
What You Should Know…
Hardware and Software
Hardware refers to the equipment that makes
up a computer system. A personal computer
contains hardware that you can see, like the
keyboard and the monitor. It also has
electronic equipment inside, like chips and
circuit boards that you only see when you open
the machine.
Software refers to computer instructions and
information, often called programs. You
probably use several types of programs to
write, draw, or play games on a computer.
Most software is stored on the computer.
What You Should Know…
The Power of the Chip
Personal computers became possible in the
1970’s with the development of the
microprocessor, or chip. Chips compress
electronic circuits into very small spaces. The chip
contains information for most of the functions of
the computer. A special chip, known as a central
processing unit or CPU runs the programs that
tell computers what to do. Modern chips are made
of silicon, the same material used to make glass.
Inside the chip are millions or billions of transistors
connected by fine copper wires. Transistors are
special electronic components that contain on/off
switches and control the flow of electricity through
the chip. The flow of electricity determines the
actions of the computer.
Pictured above is the
Intel 4004 – the first chip. It
contains 2,300 transistors.
Pictured above is the Intel Atom
processor. Modern chips contain
millions or billions of transistors.
Images courtesy of Intel
What You Should Know…
Programming Languages
In the movie, 2001: A Space Odyssey, the computer,
named HAL, spoke with the astronauts. The movie,
made in 1968, predicted that computers would speak
with humans and have what is known as artificial
intelligence – the ability to think independently, like a
human brain. Like many science fiction stories, 2001:
A Space Odyssey was ahead of its time.
Although software programs can now translate speech
into computer instructions, we actually communicate
with computers through programming languages.
Programming languages control the behavior of
machines and tell the computer the specific steps to
perform a process, operation or calculation.
The red spot above is the
“eye” of the computer, HAL, from the
movie 2001: A Space Odyssey.
What You Should Know…
Programming Languages
The earliest programming languages go back over 200 years
and were used to control machines like the player piano
pictured earlier in this Learning Launcher or the fabric loom
shown here. Today, most programming languages control
electronic devices like computers.
Computer programming languages are used to write
programs that tell a computer how to perform a computation
or process. Learning a programming language allows you to
write programs to control the computer. You are using
several types of software right now to operate the computer,
display this Learning Launcher, surf the web, and control
devices like the printer or DVD burner.
Programs contain a clear set of step-by-step instructions,
called commands. When you learn how to use commands
you can program computers to perform useful and/or
entertaining tasks.
The programming language for the
Jaquard Loom, invented in 1801, used
cards with punched holes to program
production of complex fabric patterns.
Modern computers understand
programming languages used to
create software programs that
control the computer and perform
many useful functions.
What You Should Know…
Computer Programming Careers
People who use computer languages to create
software are called computer programmers or
computer software engineers. Computer
programmers create and modify the programs
that make computers work, perform important
tasks, or entertain and play games. Computer
programming jobs are one of the fastest growing
job sectors in the U.S!
Some of the most popular programming
languages today are called C, C++, Java and
Python. Computer programmers will typically
specialize in one type of language depending on
the type and uses of software they plan to create.
What You Should Know…
About Scratch
Scratch is fun, easy-to-use software
developed at the Massachusetts
Institute of Technology (M.I.T).
Scratch allows you to create games,
animations and simulations while you
learn the basics of real computer programming languages.
One of the great things about Scratch is that it’s free for anyone to
download and use at home or at school!
Another great thing about Scratch is the large online user community.
You can find lots of free tutorials online. You can also find terrific user
forums to get help, share ideas, even upload and download projects
with other Scratch users all over the world!!
What You Should Know…
About Scratch
Before using Scratch, let’s take a quick tour of the parts of the workspace.
Workspace
You will see this screen
when you start Scratch.
This is the workspace
you will use to create
animations and games.
What You Should Know…
The
workspace
contains
different
areas. Each
area will be
explained in
the following
slides.
Palettes
Stage
Blocks
Scripts
Sprite
What You Should Know…
Sprites
Pick a Sprite
Scratch calls persons,
places, and things
“Sprites”. Scratch
comes with a collection
of Sprites. There are
many types of Sprites
for all the creative ideas
you have!
To find a new Sprite click
on the folder icon. This
opens a folder with many
Sprite choices.
What You Should Know…
Palettes & Blocks
Scratch uses tools called
palettes. Palettes allow
you to control the
appearance and behavior
of your characters.
Palettes contain specific
commands called blocks.
To find the block you want,
you first pick a palette.
In this picture, the
Motion palette is
selected. The motion
blocks appear below
the palette area.
What You Should Know…
Palettes
In art the term, “palette” refers to the
board that holds different color paints.
These are the colors an artist can
choose for his or her painting.
In Scratch, the word “palette” refers to
the choice of commands that are
available to the computer programmer.
Scratch comes with eight palettes, each
representing a category of commands.
Each palette contains a group of
commands within that category.
What You Should Know…
Palettes
Until you’re ready for advanced programming challenges, you’ll
probably focus on five of the palettes: Motion, Looks, Sound, Pen and
Control.
Motion: Controls the
movement of the Sprite
Looks: Controls
the appearance of
the Sprite and
includes text
Sound: Controls
the audio portion
of the animation
Control: Controls when
and how commands from
other palettes happen
Advanced
commands
Pen: Allows you to draw
during the animation
What You Should Know…
Blocks
Blocks are commands that control
the behavior or appearance of a
Sprite.
For example, blocks in Motion
palette tell the character to move
and turn. The blocks in the Looks
palette allow you to change the
appearance of the character.
Notice the shapes of different
blocks. There are tabs and
notches in each block to help you
figure out how different blocks fit
together.
Notice that the blocks
are color coded.
What You Should Know…
Scripts & Blocks
In order to control
Sprites, you must
drag the blocks into
the scripts area of
the workspace. Only
the blocks in the
script area control the
Sprite.
Only blocks placed in this
space control the Sprite!
What You Should Know…
Scripts
Scripts are a series of commands that control or program the Sprite. To
create a script, snap together several blocks. Click the green flag to run
the script. Watch how the Sprite behaves based upon the script you
created. When you create a script, you are creating a computer program!
In this picture, the
script on the left
controls the color of
the fish.
What You Should Know…
Stage
The stage is where all the action
takes place. The Sprite will
perform the actions that you place
in the scripts area of the
workspace.
Use the on/off buttons to
make your Sprite perform.
What You Should Know…
Now that you know a little bit about working with
Scratch, it’s time to begin programming by following
along with some Scratch video tutorials.
But before we begin, there’s something very important
you should understand about computer programming…
The information on next two slides may seem
obvious, but if you take a few moments to
think about what they say, it will make your
computer programming experience a lot
more enjoyable!!
What You Should Know…
Programs only do what they’re told
“It didn’t work!!” You’ll find yourself saying that a lot as you
work with Scratch (or, for that matter, any other method of
computer programming).
That’s because computer programs are rather “simpleminded”; they do exactly what they’re told – no more, no less.
They don’t know what you want your program to do, they can
only perform each instruction literally and in the exact order
given.
When creating a program with a complex set of instructions,
you are bound to miss an important step or have something in the wrong order.
When this happens (and it will), you need to debug your program. The most
important element of the debugging process is always the same: Don’t get
discouraged, you can fix this!!
SmartLabs are all about problem-solving, so approach it like a puzzle and have
some fun!!
What You Should Know…
Debugging Your Program
Here are some important things to keep in mind:
You’re not alone! Virtually every computer program must be
debugged. In fact, software companies often continue debugging
for years after software is released to the public!
 Your program IS working; it’s performing each step exactly as
instructed, it’s just not doing what you expected! So all you need to do is find the
instruction that’s causing the unexpected behavior. Most of the time the problem comes
down to something simple. A problem with a single instruction can often lead to
dramatically unexpected behavior.
First, think about how the program is behaving unexpectedly – often that will be your best
clue to the problem.
Second, carefully examine each program step in order to identify the problem instruction(s).
If you have multiple program modules, try playing each one separately to see if that helps
you find the problem.
Don’t give up!
With Scratch everything you
need to solve the problem is
right in front of you!
Do It!
Okay, Time to Scratch!
Scratch Tutorials
Follow along with each of the
five Scratch video tutorials. The
tutorials start with Scratch
basics and gradually explore
more complex programming
concepts.
Pause, rewind or repeat the
video as often as necessary.
Make sure you understand each
programming technique before
moving on to the next tutorial
Watching the tutorial
once without pausing
will help you
understand the goal of
the lesson.
Do It!
Learning Scratch
Use Scratch to program your
Sprite to change colors.
Steps:
1. Click on the image to open the
first video tutorial.
2. Watch the tutorial.
3. Open Scratch software and
repeat the steps shown in the
tutorial.
Try This!
Change the key that controls
the fish.
Create a different effect.
Do It!
Learning Scratch
Use Scratch to program computer
mouse movements to change the
appearance of the butterfly.
Pop Quiz!
What do these
symbols mean?
A: start and stop
Steps:
1. Click on the image to open the
second video tutorial.
2. Watch the tutorial.
3. Open Scratch software and repeat
the steps shown in the tutorial.
4. Save your work to your ePortfolio.
Do It!
Learning Scratch
Use Scratch to program the dancer to
move to the beat of a drum.
Steps:
1.Click on the image to open the
third video tutorial.
2.Watch the tutorial.
3.Open Scratch software and repeat
the steps shown in the tutorial.
4.Save your work to your
ePortfolio.
Try This!
Can you get me to spin
while I dance?
How many steps does it
take to cross the
screen?
Hey, Scratch has tools
everywhere!
Do It!
Learning Scratch
Use Scratch to make an animated
music video.
Steps:
1. Click on the image to open
the fourth video tutorial.
2. Watch the tutorial.
3. Open Scratch software and
repeat the steps shown in
the tutorial.
4. Save your work to your
ePortfolio.
Programming Tip: You can
test each set of blocks
separately before
combining them. This will
help you to “debug” the
program.
Do It!
Learning Scratch
Use Scratch tell a ghost story.
Steps:
1. Click on the image to
open the fifth video
tutorial.
2. Watch the tutorial.
3. Open Scratch software
and repeat the steps
shown in the tutorial.
4. Save your work to your
ePortfolio.
Two characters! Now,
we are talking.
Get ready to animate
your own story.
Do It!
Are You Ready to Scratch on Your Own?
Now that you have learned a little about Scratch and computer
programming, try these challenges.
 Change one of the four tutorials. How can you modify one of your tutorial
projects to do something new and different?
 Explore other blocks. Pick some blocks that you have not used and learn
what they do. Try one each from motion, looks, sound, and control.
 Learn to use other tools on the screen. Look at these images and learn what
each tool does in Scratch.
Record all your work in
your ePortfolio. Use
screen captures to
explain what you did,
why, and how.
Extend Yourself…
Go Online for Ideas, Help, Tutorials and to Share Projects
A big advantage for programming in Scratch is the huge online user community! You
can find lots of project ideas, tutorials, and helpful hints online. You can even
download other user’s projects and build upon their work, and post your own
projects!
 Check out the official MIT Scratch Site: http://scratch.mit.edu/
 Browse the many great tutorials on YouTube (if you can’t access YouTube from
your SmartLab, you may have to do this from home)
 Explore the video tutorials at http://learnscratch.org/
 Do an online search for other great Scratch resources and tutorials (HINT: Search
for “Scratch software” or Scratch MIT” to narrow your search)
Extend Yourself…

Explore other palettes and blocks to learn more ways to control the
behavior or appearance of a Sprite.

Create a list of links to helpful Scratch online resources for your
classmates.

Go online and explore careers in computer programming. What kind
of education do computer programmers and software engineers
require?

Create a timeline of computers or computer languages.

Swap programming ideas with a friend to share and learn new ways
to control the computer animation.

Explore the Scratch activity cards. Pick a card and see if you can
solve the programming challenge. Or take turns challenging your
partner!
Extend Yourself…

Click File>Open>Examples to explore some of the sample projects in
Scratch. Can you modify any of the sample programs?
Download