Ebook File Document 6995
Ebook File Document 6995
https://ebookmeta.com/product/super-scratch-programming-
adventure-covers-version-1-4-learn-to-program-by-making-cool-
games-1st-edition-project-the-lead/
https://ebookmeta.com/product/libreoffice-expert-2022-covers-
version-7-2-2-2022nd-edition-unknown/
https://ebookmeta.com/product/tensorflow-in-action-covers-
tensorflow-version-2-9-1st-edition-thushan-ganegedara/
https://ebookmeta.com/product/learn-to-program-with-scratch-a-
visual-introduction-to-programming-with-games-art-science-and-
math-1st-edition-majed-marji/
Python How-To - MEAP Version 2 Yong Cui
https://ebookmeta.com/product/python-how-to-meap-version-2-yong-
cui/
https://ebookmeta.com/product/the-creative-programmer-meap-
version-2-wouter-groeneveld/
https://ebookmeta.com/product/learn-to-program-with-
python-3-a-step-by-step-guide-to-programming-2nd-ed-2nd-edition-
irv-kalb/
https://ebookmeta.com/product/think-like-a-cto-meap-
version-2-alan-williamson/
https://ebookmeta.com/product/modern-x86-assembly-language-
programming-covers-x86-64-bit-avx-avx2-and-avx-512-2nd-edition-
daniel-kusswurm/
version 2
covers
As you read this book, let your imagination run wild.
c
What will you create with Scratch? ve ov
rs er
– from the foreword by professor mitchel resnick, creator of scratch io s
super
SC R ATC H
Comics! games! Programming!
VENTURE !
AD
Scratch is the wildly popular educational This full-color comic book makes pro-
PROGR AMMING
programming language used by millions gramming concepts like variables, flow
of first-time learners in classrooms and control, and subroutines effortless to
homes worldwide. By dragging together absorb. Packed with ideas for games
colorful blocks of code, kids can learn that kids will be proud to show off,
computer programming concepts and Super Scratch Programming Adventure!
make cool games and animations. The is the perfect first step for the budding
latest version, Scratch 2, brings the lan programmer.
guage right into your web browser, with
About the Author
no need to download software.
The Learning through Engineering,
In Super Scratch Programming Adventure!, Art, and Design (LEAD) Project is an
kids learn programming fundamentals educational initiative established to
as they make their very own playable encourage the development of creative Learn to
video games. They’ll create projects thinking through the use of technology. Program
g
by Makin
inspired by classic arcade games that Created by the Hong Kong Federation of
can be programmed (and played!) in an Youth Groups in collaboration with the
Cool
Games !
afternoon. Patient, step-by-step expla- MIT Media Lab, the LEAD Project pro-
nations of the code and fun program- motes hands-on, design-based activities
ming challenges will have kids creating to foster innovation, problem-solving
their own games in no time. skills, and technical literacy.
T H E F I N E ST I N G E E K E N T E RTA I N M E N T ™
w w w.nostarch.com
The Project
Praise for
Super Scratch
Programming Adventure!
“If you think you might have a future programmer on your hands,
it’s time to introduce your kid to Scratch. . . . Super Scratch Pro
gramming Adventure! makes it even easier to get started.”
—Ruth Suehle, GeekMom
“If you have a kid who plays around with a computer and can read
even a little, get this.”
—Greg Laden, National Geographic’s ScienceBlogs
“If you’ve got a child or maybe even a classroom of students who are
wanting to make their own games, Scratch is a great option. . . . For
structured training that is also entertaining, Super Scratch Program
ming Adventure! will make a great textbook.”
—James Floyd Kelly, GeekDad
“If you’re looking for a way to get your kid interested in programming,
and Scratch in particular, I can’t recommend this Scratch book enough.”
—Chris O’Brien, San Jose Mercury News’ SiliconBeat
S u pe r
S c r at
atc h
dv e n tu r e!
i ng A m
Pr o g r a m
Learn to
by
Pr o g r a m
ool
Making C
Gam es!
The Project
Super Scratch Programming Adventure! Copyright © 2014 by the LEAD Project.
This edition has been updated to cover Scratch 2.
All rights reserved. No part of this work may be reproduced or transmitted in any form or by
any means, electronic or mechanical, including photocopying, recording, or by any information
storage or retrieval system, without the prior written permission of the copyright owner and
the publisher.
Printed in USA
First printing
17 16 15 14 13 1 2 3 4 5 6 7 8 9
ISBN-10: 1-59327-531-5
ISBN-13: 978-1-59327-531-0
No Starch Press and the No Starch Press logo are registered trademarks of No Starch
Press, Inc. Other product and company names mentioned herein may be the trademarks of
their respective owners. Rather than use a trademark symbol with every occurrence of a
trademarked name, we are using the names only in an editorial fashion and to the benefit of
the trademark owner, with no intention of infringement of the trademark.
The information in this book is distributed on an “As Is” basis, without warranty. While every
precaution has been taken in the preparation of this work, neither the author nor No Starch
Press, Inc. shall have any liability to any person or entity with respect to any loss or damage
caused or alleged to be caused directly or indirectly by the information contained in it.
All characters in this publication are fictitious, and any resemblance to real persons, living or
dead, is purely coincidental.
Contents
10
N ote The Resources file includes two versions of each game
in the book. One version is a completely finished and
playable game, perfect for young learners and anyone
who wants to build on the games in the book. The
second set of projects has no programming added, so
that students can follow along with the programming
instructions in this book. Remember, there’s no wrong
way to play with Scratch!
11
Who Created Scratch?
Scratch is a project funded by the US National Science Founda-
tion (NSF). It was developed by the Massachusetts Institute of
Technology (MIT) Media Lab’s Lifelong Kindergarten Group.
12
Designing Scratch projects challenges kids to think cre-
atively, and learning how to overcome obstacles and solve
problems builds confidence. This gives learners an advantage
later in life.
13
Scratch is used around the world in elementary, middle, and
high schools. Computer science professors also use Scratch as a
means of introducing programming concepts to college students.
14
• Students at a university in Istanbul used Scratch to examine
video game culture by rapidly prototyping their own games
and testing the games with the public.
• English students in a middle school in California used
Scratch to build a random story generator.
• Students in an elementary school in Russia used Scratch to
build their own personalized tutorials for learning about the
coordinate system and trigonometry.
• High school students in Michigan used Scratch to build a
physics simulator.
The possibilities are endless. It is our sincere hope that
this book inspires students to create their own games, stories,
and more.
15
As long as they have the username and password at hand,
kids can find games to play through the project gallery, remix
them, and share their thoughts with others from around the
world! To see how someone else’s game was built, just click the
See Inside button ( ). To add to the program, click the
big orange Remix button ( ).
To share your own projects with the rest of the world, click
the big Share button ( ) in the Scratch editor. To make a
project private again, click the Unshare button in the My Stuff
listing.
Just remember that as a member of the Scratch community,
you’ll be sharing projects and ideas with people of all ages, all
levels of experience, and all parts of the world. So be sure to:
• Be respectful of other players
• Be constructive when commenting
• Help keep the site friendly and fun
• Keep personal information private
For more ideas and information about sharing and remixing
projects, visit http://wiki.scratch.mit.edu/wiki/Remix.
16
My Computer Can’t Run
Scratch 2.0!
If your computer doesn’t meet the requirements listed on
page 10, you can still download and install Scratch 1.4. (http://
scratch.mit.edu/scratch_1.4/). Scratch 1.4 projects are compat-
ible with the Web-based Scratch 2.0, and you can still share your
projects on the Scratch website using Scratch 1.4. (Unfortunately,
Scratch 1.4 cannot read programs created in the Scratch 2.0
software.)
You can download free PDF versions of Chapters 1 and 2,
which explain how the older 1.4 interface works, by visiting
http://nostarch.com/scratch/. You can also find versions of the
book’s games that are compatible with 1.4 on that page.
17
Meet the Cast
Mitch
A computer science
student who loves to
make cool programs,
he’s passionate about
movies and art, too!
Mitch is an all-around
good guy.
Beoo
Beoo o-
oo
p!
Earthqu
I sure wish ak
Meanwhile, in
programming e!
school on Earth...
were easier...
Whoa!
Chirp Chirp
Wake up.
W-who are
Come on, you? What just
wake up! happened?
20
My name is That’s right. I Amazing! My
Scratchy. followed that name is Mitch. I’m a
I’m from flash of light, And computer science
Cyberspace. here I am! student!
You’re from a
computer?!
Oh no! I
can’t move
my legs!
Hey Mitch.
um…is your Where is
planet always
so gray?
everybody?
Ahhh!
Me neither!
Something Help!!
terrible is
forming in
the sky!
No way!
Something’s
wrong. Let’s
go check
it out!
take this
Secret Manual
Stay Calm! before the
Thank goodness Black Tornado
I found you! swallows you!
Then follow my
Your body is instructions!
being frozen!
Let’s
do
this!
21
Breaking the Spell!
Chapter Focus The Game
Let’s get to know Scratch! We need to get Scratchy the cat
We’ll also learn about sprites moving again. We’ll make him
and coordinates. dance across the Stage.
an d D r
ck a
i
Cl
22
A Guided Tour of the Scratch Interface!
Palette
Sprite Toolbar Each of these ten buttons lets you choose
Contains the functions (called blocks) for programming your
Play the Give your Duplicate, Delete, sprites. You can combine these command
game full project a Grow, Shrink, and blocks in stacks to create programs that
screen. new name. Block Help tools control objects on the screen.
Stage
Displays your creation
Scripts Area
Here’s where you build your
programs. Stacking blocks
The green flag starts the together here lets you control
game and the red flag the sprites in your project. Click
stops the game. one of the three tabs at the top
to change to other functions:
Scripts: Allows you to
drag command blocks from
the Palette and put them
together to write a program
Costumes: Allows you to
draw, import, or edit images
Sprite List
for a sprite
Here are the characters
and objects you’ve created, Sounds: Allows you to record
including the Stage itself. or import sound files for a
Click the icons to edit each sprite to use
sprite individually.
23
Sprite Information
You might have noticed a little blue i in the corner of the box around
Scratchy when you select his sprite in the Sprite List. Try clicking the i,
and you’ll get information about that sprite.
This section shows the sprite’s name, position, and direction it is facing
(the little blue line).
Choose
the xy-grid
backdrop and
click OK to
use it. It’s in
the “Other”
category.
24
Now you can see exactly how Scratch positions objects.
Everything is on a grid with two axes:
y-axis: A vertical line that marks up and down positions;
ranges from –180 (lowest) to +180 (highest)
x-axis: A horizontal line that marks left and right positions;
ranges from –240 (farthest left) to +240 (farthest right)
Scratchy’s default position is at the point where the x-axis
and y-axis meet. His coordinates are (X: 0, Y: 0).
25
Click the number of a coordinate to change it. Set x to 0 and
set y to 125. Now click the block to run it! Scratch goes right
to that position. We’ve just written our first program! It’s really
that simple.
26
Type these coordinates in your
own program, so it matches this
picture. When you’re finished,
click the whole command block
to make Scratchy jump around
in a pentagon shape!
27
Because we used the When clicked command, we
can use these buttons above the Stage to start ( )
and stop ( ) the game.
28
This software bug can be fixed by adding
some more code—that is, new blocks—to
your program. In this case, simply place
a new go to block (from the blue Motion
palette) above the green Pen blocks and
below the When clicked block.
29
Remember to save
this file so you can
play with it later!
If you are logged into Scratch, the website stores all of your projects into
My Stuff so you can easily find them. The website saves your progress
every so often, but you can save manually too: File4Save Now. You can
also save different versions of your programs to make sure you don’t lose
older versions of your games and can safely experiment—File4Save Copy
creates a new version of your project in My Stuff. If you want to download
a version for yourself, try File4Download to your computer. Then save
it in a safe spot!
Scratchy’s Challenge!!
Can you edit this program to make Scratchy draw
different kinds of shapes? Give it a try!
30
Entering
Space
Magic Alright! I can
star web! feel my limbs
sh again!
WhoO
32
Great Idea!
This Secret Yes! If I learn You can design
Manual saved to program, it new equipment and
us. Maybe might help to even control our
it can help defeat the Dark movements!
other people Wizard!
as well!
We need the
energy from seven
Alright! dimensional strings
But why does
to open the stargate
Scratchy need
the space suit?
and reach my
friends...
Oh no!
My fellow ...but inside the
defenders are in vortex, there’s no
trouble! Change oxygen, and lightning
into a space suit can make things
and save them, disappear!
kind feline!
by the way,
Gobo, my name
is Scratchy, and
he’s Mitch! The adventure into
space begins…
33
A Space Odyssey!
Chapter Focus The Game
Learn to design new costumes Avoid the lightning bolts and
and program a sprite’s move collect seven dimensional strings.
ments, reactions, and sound Once you’ve got them all, the
effects. Monolith will appear!
34
Here’s where all the tools
are. The Brush and Eraser
tools make it easy to draw.
35
You also have tools to draw rectangles and ellipses.
Can you give Scratchy a stovepipe hat like Abe
Lincoln using the Rectangle and Ellipse tools?
36
To use the Select tool, use your
mouse to create a frame around a
certain area. Then you can do all
sorts of things to the selected part
of your costume:
• Click and drag the selection to
move it to a new location.
• Resize, smush, or stretch the
image using the handles on the
sides of the box
• Rotate the selection by clicking
and dragging the handle at the
top center of the box
• Press and hold the ctrl key and
C key at the same time to copy
the image area (Mac users can
use -C instead). Then press
ctrl-V to paste your selection,
as many times as you like.
• Press the delete key to erase
the selection.
37
Vector Mode
You may have noticed that
when you edit other sprites in
Scratch, you don’t see the same
Paint Editor tools. Some newer
sprites are vector art—that’s just
a fancy way to say they’re made
of shapes, instead of pixels.
Vector art have small filesizes,
but they are great quality—and
they can be resized without
losing quality.
38
Try opening a vector
graphic from Scratch’s
library, and give editing
one a try.
The Backpack
Here’s a cool new feature. If you’re logged into the
Scratch website, you’ll see something called the
Backpack at the very bottom of the screen. Click it,
and it’ll open up. Yours will be empty until you throw
some sprites in it.
39
Once you know how to use the Paint Editor’s
tools, Scratchy can put on his space suit!
Go ahead and draw your own, or use the
costume that’s already in the project.
40
Next, let’s take a look at the other
sprites in the game. You can use the
art that’s already in the game, or
draw new artwork yourself! Click
to draw a new sprite.
41
Next, let’s look at the Stage.
I used artwork of a black hole
from NASA! You can draw a
new backdrop if you like. Click
the Stage in the Sprite List, and
then click the Backdrops tab.
42
❷ For program ❷, we’ll make a conditional—if something
is true, then something else will happen. In the Control
palette, drag out an if block. Then for the diamond shape,
drag the Sensing block key ______ pressed?. Right below
the if, put what you want to happen when the statement
is true. Drag out the rest of these commands to form the
complete program. Now you can move Scratchy up, down,
left, and right by using the keyboard!
43
Another random document with
no related content on Scribd:
particular atom, why does it not at least detach corpuscles from all of
the atoms over which it passes?
Again when ultra-violet light falls on a metal it, too, like X-rays, is
found to eject negative electrons. This phenomenon of the emission
of electrons under the influence of light is called the photo-electric
effect. Lenard[165] first made the astonishing discovery that the
energy of ejection of the electron is altogether independent of the
intensity of the light which causes the ejection, no matter whether
this intensity is varied by varying the distance of the light or by
introducing absorbing screens. I have myself[166] subjected this
relation to a very precise test and found it to hold accurately.
Furthermore, this sort of independence has also been established for
the negative electrons emitted by both X- and -rays.
Facts of this sort are evidently difficult to account for on any sort
of a spreading-wave theory. But it wall be seen that they lend
themselves to easy interpretation in terms of a corpuscular theory,
for if the energy of an escaping electron comes from the absorption
of a light-corpuscle, then the energy of emission of the ejected
electron ought to be independent of the distance of the source, as it
is found to be, and furthermore corpuscular rays would hit but a very
minute fraction of the atoms contained in the space traversed by
them. This would explain, then, both the independence of the energy
of emission upon intensity and the smallness of the number of atoms
ionized.
In view, however, of the four sets of facts mentioned above,
Thomson found it altogether impossible to go back to the old and
exploded form of corpuscular theory for an explanation of the new
facts as to the emission of electrons under the influence of ether
waves. He accordingly attempted to reconcile these troublesome
new facts with the wave theory by assuming a fibrous structure in the
ether and picturing all electromagnetic energy as traveling along
Faraday lines of force conceived of as actual strings extending
through all space. Although this concept, which we shall call the
ether-string theory, is like the corpuscular theory in that the energy,
after it leaves the emitting body, remains localized in space, and,
when absorbed, is absorbed as a whole, yet it is after all essentially
an ether theory. For in it the speed of propagation is determined by
the properties of the medium—or of space, if one prefers a mere
change in name;—and has nothing to do with the nature or condition
of the source. Thus the last three of the fatal objections to a
corpuscular theory are not here encountered. As to the first one, no
one has yet shown that Thomson’s suggestion is reconcilable with
the facts of interference, though so far as I know neither has its
irreconcilability been as yet absolutely demonstrated.
But interference aside, all is not simple and easy for Thomson’s
theory. For one encounters serious difficulties when he attempts to
visualize the universe as an infinite cobweb whose threads never
become tangled or broken however swiftly the electrical charges to
which they are attached may be flying about.
Fig. 32
After this the freshly cut surface was turned around by another
electromagnet until it was opposite the point of Fig. 33 and a
beam of monochromatic light from a spectrometer was let in through
and allowed to fall on the new surface. The energy of the
electrons ejected by it was measured by applying to the surface a
positive potential just strong enough to prevent any of the discharged
electrons from reaching the gauze cylinder opposite (shown in dotted
lines) and thus communicating an observable negative charge to the
quadrant electrometer which was attached to this gauze cylinder.
Fig. 33