<<

7 reword by reword MIT Media Lab Media MIT Fo k Resnic Mitchel covers Scratch 2.0 and Scratch 1.4 2.0 and Scratch covers Scratch

g Programmin

TED OR OW

USTRA

cratch Y ILL

IN FULL COL

Sean McManus Sean S

PLAIN ENGLISH EASY TO FOLL FULL

SCRATCH PROGRAMMING

175

in to it use but too. the adjust start different can for sprite to a me, same make

several player ” them them, appropriate. . to you the ag Their as fl the hit the used have of harder aliens to them on and for it hitting sprite can script of green size you’ve ou there’s any avoid missile make the this Smaller easier the sprite, alien Y scripts If dangers. , Space Steps reference in een make our gr y paths of e when something aliens

siz the guides. shows 2) ratch the know the Look inside Sc Easy above dd using in

easy set A picture

Chapter to e ag List. designing. block settings t-right, (see

hen In still

block rite lef icons pen: the fl W ight tage. a e . Sp S to potential but shooting t-r

the use

you instead and their yle the the lef oving or st fundamentals and fundamentals and in 1.4, of 50% it and with block. yle m easier t hidden, is of alette block st er

P s lef

and

and alien t’ our ratch ways racket rawn a on the make y then

i by position blocks rotation our pixelate al Sc the d right forev y Mine the of r b in moving to the a to licked . is random a put c the In and makes ve the the Blocks screen tage a

dead, rotation in the hes

direction, ect ect S

dd

It uses e direction, ’s pattern ix ag

colors, in

position e the sprite 2.0. set keeps the use e appear it sprite random on Click Inside fore add that alien eight reac the from it these alien rent F A right.

icons e t-facing 1 2 3 4 zig-zag e di lef making movements, changing until pointing across a random the pixelate materializ Moving even quick with learning, it Let several away these , and in schools and colleges. and colleges. and in schools your .ineasysteps.com bar s happy r’ of that programming re ye space provide you

pla fi the ngers, such as Spiral Rider ngers, such as Spiral e the receives

up r

it to nished, you’ll be impressing your nished, you’ll be impressing to fi List ezine presses

er rite fi when I’m missile script one Sp a play List the the dd move the a rite

see in to ll to

so ward y player

e’ e Sp rap to er purchased y,

ts, our is w block when and then w want

y missile

right from e, the sprite t the sprite if e” loop sprite play when e” and r we

star spice the n’ to

 this. r behind r script in spacebar and the slightl is e” an “ see

e “ so do not the it the to for the to

r screen it for it

www e comes in continuousl “ missile the

last it, or er  ship missile game position, tutorials script hide missile

and W o ’s for the ’s script script extremely when to head. that moves play pressed, the the that the

when , it when our lowers a this a e ’s checks Raspberry Pi Raspberry position ything to been h ship missile ship ship broadcast r

broadcasts the er bmaster dd dd dd

tell until pilot moves the the then the that script broadcasts waits the ev being and has to checks when sprite sprite the received. Click Click Click ll have that e’ A A A you enable

1 2 3 4 5 6 broadcast: and w sprite Enabling To for tip highly visual interface and drag-and-drop interface and highly visual We was

If - is a programming language that is widely language is a programming a the done” the I be a stop the makes to screen. rst and missile fi

inside to being for script, screen. space when again. the while anything second the the broadcast “broadcast” back “ “broadcast on a it game. on wouldn’t block from block a steps start the re than the move time, fi was while movement the jump still pressed 20 instead, put to to and wait” wait” is in movement use player player used

remember we faster

second would ship player block missile we able our the and If one missile able the and We Using missile it else handy

174 Space Swarm Space material “get series Lowter “ to Wherever a Scratch the used on Scratch’s ages to try language for all make it an ideal commands easy steps in With Scratch Programming to program. programming will be a breeze. at hand, learning you to Scratch This primer introduces the commands to create games then walks you through skill, to create games that require and animations. Learn knowledge or quick Swarm, or the classic Hangman game. Add music and Hangman game. Add music and Swarm, or the classic your games, and of course keep score. special effects to By the time you’ve with your own computer games! friends and family book? CN it 9 we we 9 , it, this this eye. 4 5 make make 1 do English worry the 5 to to value on more? US / $16.95 Don’t how color 5 plain forward. . in any easier instructions you 612 in follow how 8 say color and jargon? tell 78-1-84078-612- to illustrated to fantastic straight printed 07 choose choose use the just full simple. to by need it’s UK / $14.99 step-by-step written written in easy fully things , show you book’s off don’t 78184 we

ISBN-13:9 9 learning also This simpler And Do It’s Put It’s keep It’s Clear It’s We £10.99 Why Why

red! red! rsion Coversnew Ve

MIT In Easy Steps

) entor - no coding requi coding no - entor

llow us

using App Inv App using

g

h

OR OR

Android Apps Android (P & P extra

TED TED

Fo

A A

OW OW

L CO L

TRA

H a t

USTRA FOLL

.scratch.ineasysteps.com

Y ILL Y

L CO FULL IN

TCH” coupon code at checkout

FULL

m c g r

EASY TO TO EASY

H ENGLIS PLAIN

Buildin m i k e and to leave feedback. “SCRA @InEasySteps Get 20% off any In Easy Steps book Go to www titles, free chapters, offers, user forum Visit our website for information on our s & quote titles titles Steps

b cks & Shortcut i oint Tr ord owerP

PMENT m Easy Easy More More

LO b Design indows 8 indows 8 for Seniors VA In indows 8 Tips, ad W W W iP iPhone Samsung Galaxy Ta JA JavaScript PHP & MySQL SQL We Laptops for Seniors Laptops for Mac Basics MacBook a PC Upgrading and Fixing Photoshop Photoshop Elements Microsoft P Microsoft Project Microsoft W S book? book? CS Ahead Ahead .ineasysteps.com this this , tablet and smartphone fro ce ING SYSTEM In Easy Steps ebooks L LIFESTYLE ricks & Shortcuts ablets AT www

Stay Stay now available to download onto your PER computer FFICE & ACCOUNTING ENERAL indows 7 PROGRAMMING & WEB DEVE O DIGITA O G DESIGN & GRAPHI Cloud Computing Digital SLR Photography Building Android Apps C++ Programming Dreamweaver Get to No.1 on HTML5 Liked Liked Basics Computer Computing for Seniors iMac Internet for Seniors Android T Illustrator InDesign Accounts & Bookkeeping Microsoft Excel Microsoft Offi Linux Mac Tips, T W to

7 Scratch with with

no art the the to book and as can and your of this It’s video With you’ll this PicoBoard 1.4, create guide software lot word you tunes a loops, music Pi. ideas a share With to programming program program arcade on operators programming and -generated own lists, animations, animations, life. and webcam web-based easy needed, Scratch means great away bugs scratch in-depth and learn to it to to favourite companion, your applications. applications. Raspberry an and sensors to with new build That quizzes and addictive takes to: sophisticated or . is common games, from computer having them programs the it your your the the variables, makes 2.0, way art on

you as how knowledge on own book pitfalls Avoid Interact and Use broadcasts Make Play Design, Create games, create compose own games

both Scratcher!

your • • • • • • •

Scratch music, Learn Learn complexity because perfect This Scratch focus to used bringing book prior takes to learn Contents

Foreword by Mitchel Resnick 7

1 Introducing Scratch 9 What is Scratch? 10 Which version of Scratch? 11 Starting on the Raspberry Pi 12 Creating a Scratch account 13 Using the Scratch screen 14 Exploring the blocks 16 Changing the backdrop 18 Creating your first program 20 Saving your project 23 Opening projects 25 Opening shared projects 26

2 Drawing with Scratch 27 Understanding coordinates 28 Changing a sprite’s position 30 Using the pen 31 Drawing a house in Scratch 33 Using directions to move 35 Keeping sprites upright 36 Drawing using directions 38 Making shapes using Repeat 39 Putting loops inside loops 40 Creating Rainbow Painter 41

3 Spiral Rider 43 Introducing Spiral Rider 44 Using the green flag 45 Creating variables 46 Drawing a spiral 48 Changing the background 51 Adding sprites 52 Animating the crab 54 Enabling keyboard control 56 Making the fish move 58 Adding Game Over 61 4 Super Dodgeball 63 Introducing Super Dodgeball 64 Setting up the variables 65 Preparing for the game start 67 Using coordinates to move 68 Adding more images 70 Renaming sprites 71 Making random numbers 72 Moving the ball 73 Copying and deleting sprites 75 Adding the energy meter 78 Painting in Scratch 80 Using Paint tools 82 Using colors 84 Using vectors in Scratch 2.0 85 Making the ice cream appear 86 Enabling the player to score 88 Tweaking the gameplay 90

5 Cosmic Chorus 91 Introducing Cosmic Chorus 92 Adding sprites and costumes 93 Preparing Cosmic Chorus 96 Adding sounds to a sprite 97 Sounds in Scratch 1.4 99 Recording in Scratch 1.4 100 Playing sounds 101 Making Gobo sing 102 Using broadcasts 103 Conducting the Gobo 104 Adding more Gobos 105 Playing music in Scratch 107 Adding the singing soloist 108 Adding a title screen 110 Enabling the title screen 111 Making your own tunes 112 London Bridge 114 6 Quiz Break 115 Introducing Quiz Break 116 Preparing for Quiz Break 117 Drawing the timer 119 Moving the clock hand 121 Adding a rising sound effect 124 Asking questions 125 Joining text to greet players 126 Preparing the quiz 127 Making the questions 128 Checking the answers 130 Reporting the scores 132 Adding the victory dance 133

7 Hangman 135 Introducing Hangman 136 Importing the images 137 Making the gallows 138 Making the alphabet sprite 140 Creating the variables 141 Setting up the gallows 142 Losing the game 143 Adding graphic effects 144 Creating the main script 146 Creating lists 149 Using lists 150 Setting up the variables 152 Showing the game board 155 Testing the game board 158 Asking for the player’s guess 159 Checking the letter 161 Game over 164

8 Space Swarm 165 Introducing Space Swarm 166 Preparing the images 167 Adding sound effects 169 Creating the variables 170 Programming the hero 171 Enabling the player to fire 174 Moving and shooting aliens 175 Finishing touches 177 Adding the high score 178 9 Scratch hardware projects 179 Using a webcam 180 Using video direction 181 Going Batty 182 Using a PicoBoard 184 Making a clap-o-meter 185 Making Night Flight 186 Using the Raspberry Pi GPIO 189

10 Seven shorties 191 Keepy-Uppy 192 Shop Cat 194 Penguin Patter 197 Ransom Writer 198 Maze Mania 201 Abstract Artist 202 Photo Safari 203

11 Making and sharing projects 205 Making your own programs 206 Common bugs 208 Sharing your projects 209 Resources 210 Acknowledgements 210

Acknowledgements 210

Index 211 19

In Chapter 5, you get to conduct the Cosmic Chorus. You’ll You’ll the Cosmic Chorus. to conduct get you In Chapter 5, to get how notes, sounds and musical to use recorded see how to make a title screen. and how another, spriteone to control In Chapter 4, the Dodgeball game shows you how to build a how you the Dodgeball game shows In Chapter 4, to learn how You’ll game with lots of sprites moving at once. to clone how them in Scratch 2.0, sprites, own design your to keep score. and how random numbers, to make how In Chapter 3, Spiral Rider is your first game. You’ll learn Spiral first game. Rider is your In Chapter 3, to detect how and of a sprite, to enable keyboardhow control and you’ll character else, touches something when the player’s information in a program. to remember how discover In Chapter 1, you’ll learn the basics of Scratch. Sprites you’ll are learn the basics of Scratch. In Chapter 1, and you’ll meet the cat games, can use in your objects you goes it for a quick walk. first program, In your sprite here. to how you’ll to draw learn how with Scratch, In Chapter 2, to make bits of your and how sprites the Stage, move around project is programThe final art Rainbow repeat. program mouse. a colorful which leaves line behind your Painter,

How to use this book this use to How •

• •

• • Here’s what’s in store: what’s Here’s If you need advice on something that hasn’t been covered yet, or yet, covered been that hasn’t something on need advice If you the index consult earlier, read you want to revise something you information.for more Feel free to experiment as you go, though: there are lots of things are there though: freeFeel go, to experiment as you can the examples in this book, do to customizeyou and improve a big partand that’s of what Scratch is all about. The book has been The book written you so that each chapter teaches that For the previous chapters. and builds on new, something the through is to work book to use this the best way reason, chapters the right in order. This book will show you some of the great projects you you can build projects of the great some you will show This book need you skills the knowledge and you will and give with Scratch, projects. to start own designing your Welcome to the wonderful world the wonderful to of Scratch! Welcome 20 How to use this book Downloading theexamples • • • • • • users/seanmcmanus/ website.the Scratch You find itathttp://scratch.mit.edu/ can To 2.0,Scratch for findtheexamples visittheauthor’s profile on the publisher’s website atwww.ineasysteps.com bedownloadedcan attheauthor’s website atwww.sean.co.uk and shortcut, you download can them. 1.4 Scratch for The examples If you can’t get theexamplestowork, orifyou wanttotakea the examplesasyou go. more aboutprogramming, have tocustomize achance andyou’ll inorder,chapters creating theexamplesasyou go. You’ll learn The bestway tousethisbook isto work your way through the ...cont’d

and resources you usetohelpyou can get started. Chapter 11gives you advice on creating your own programs, Cat, Mania, Maze andBreakthrough. Safari Photo withandcustomize,experiment thegamesShop including programs you Chapter 10contains short seven can Scratch. from Pi how tocontrol alightconnected totheRaspberry Picoboard tocontrol awitch’s nightflight. alsosee You’ll your handsatthescreen towave away thebatsanduseyour device. Flap sensorsinonecombines Scratch-friendly several webcam, microphone andthePicoBoardadd-on which In Chapter9, withyour how learn touseScratch you’ll in your game. toinclude effects fireto makeone sprite on another, andhow tomakespecial In Chapter8, create anarcadehow gameandlearn you’ll complexstructure programs, on theStage. and how towrite lists inScratch, how toasktheplayer information, for how to In Chapter7, thegameHangmanteachesyou how touse maths, for operators andhow tojointexttogether. the clock. You’ll how learn tousethetimer, how tousethe In Chapter6, Break testsplayers’ Quiz against mathsskills 7 programming language and online community in an online and language programming

Scratch effort to make coding accessible and appealing to everyone. effortaccessible and appealing to to make coding everyone. Six years ago, my research group at the MITLab group Media launched research my Six ago, years the But I see much deeper and broader reasons for learning to code. for learning to code. reasons deeper and broader But I see much people learn other things. many of learning to code, In the process In coding to learn. they are not just learning to code, They are to learning ideas (such mathematical addition and computational also learning they strategies are for as variables and conditionals), ideas. and communicating designing projects, solving problems, useful not just scientists but for computer for These skills are or occupation. interests, background, of age, regardless everyone, The recent surge of interest in learning to code, reflected in sites in learning to code, of interest recent surge The has focused especially job on and code.org, like codecademy.com the number It is easy to understand why: and career opportunities. is growing scientists of jobs for and computer programmers with demand far outpacing supply. rapidly, programming) as an extension of writing. of writing. as an extension programming) I see coding (computer new types of things – “write” The abilityyou to to code allows as And, and simulations. animations, games, stories, interactive for everyone reasons powerful are to there writing, with traditional learn to code. Of course, such questions seem silly. People use writing in all People seem silly. such questions Of course, to jot to send birthday to friends, messages parts of their lives: act The feelings in diaries. personal to record shopping lists, down As people of writing people in new also engages ways of thinking. It’s on their ideas. reflect and refine, they learn to organize, write, for everyone reasons powerful clear are to learn to write. that there Is it important for allchildren to learn how to write? After all, very few children grow up to novelists, become journalists, Soor professional writers. why should everyone learn to write? Foreword by Mitchel Resnick Mitchel by Foreword Resnick is ProfessorMitchel of Learningat the MIT Research Media Lab. 8 Foreword order. the chaptersinright book istoworkthrough the bestwaytousethis chapters. For thatreason, builds ontheprevious something new, and chapter teaches you written sothateach The bookhasbeen Edsurge (www.edsurge.com). published at This isanedited thatwasoriginally anarticle of version Resnick Mitchel context learning. for pathway togood jobs, ofexpression form andanew butasanew in mindsets, asa sothatpeoplebegintoseecodingnotonly andeducational.but cultural Ultimately, whatisneeded isashift enough. for thefutureThe biggestchallenges are nottechnological But we are are aware features andcapabilities not thatnew and collaboration. creativity for opportunities browser. versionfeaturesThe new also adds manytoenhance new program, save, share, projects inaweb directly andremix Scratch intothecloud,community moves Scratch enablingpeopleto programming language andonline version new oftheScratch withScratch.and learning Butthisisjustthebeginning. The It hasbeenexciting whatyoung towatch peopleare creating much more.” This has gone from toasters, systems,car electrical andsoooo mind.’ That iswhere I think abouthowisprogrammed. anything have made many projects. Now a Ihave whatIcall ‘Programmer’s love Scratch. Wait, ismylife. letmerephrase that–Scratch I ways. wroteon apublicblog: Asone 11-year-old Scratcher “I innew community membersalsobegintoseetheworld Scratch readcan digitalmedia, digitalmedia. write can Scratchers media, notjustbrowse, chat, andplay games. many people While creators anddesigners, makethingswithdigital aspeoplewhocan differently.think ofthemselves as begintoseethemselves They We to community start Scratch findthat active membersofthe editors, andnewsletters. interactive andeven tutorials announcements, projects, multimedia art dress-up games, paint animated stories, tours, virtual sciencesimulations, public-service projects. Take find website andyou’ll alook attheScratch We’ve ofthe andcreativity withthediversity beenamazed ...cont’d 1 Introducing Scratch

10 What is Scratch? In this chapter, you’ll 11 Which version of Scratch? get started with Scratch, 12 Starting on the Raspberry Pi including learning about 13 Creating a Scratch account the different versions, 14 Using the Scratch screen meeting some of the blocks 16 Exploring the blocks used to give instructions, 18 Changing the backdrop and creating your first 20 Creating your first program program. You also learn how 23 Saving your project to save your work, and load 25 Opening projects example projects by others. 26 Opening shared projects 10 Introducing Scratch commands lock together. how thecolor-coded program, showing Above: AsimpleScratch computers. MacandLinux Windows, anything anditworkson Scratch doesn’tcost them, designingthem, themwith friends. andsharing programs,dreaming new up ideasfor working out how tobuild instead on the funstuff:focus That means can your energy you abouthow you usethem. rules can and strict doesn’t. Scratch other programming languages require you textcommands, tolearn now. right and soundsyou usesoyou get started can can Many see results fromquickly your work, graphics includes andeven In short, your isdesigned for success. Scratch Itenablesyou to • • • • • for anumberofreasons:for is easiertousethanmostotherprogramming languages Scratch thatprogrammers thetime. doall solving introduction tothe kindofcreative problemprovided afriendly School.Summer I’ve ledworkshops adults for where Scratch atits hasalsouseditinhighereducation University Harvard ages.people ofall andcolleges, usedinschools It’s widely but programs. Itprovides agreat introduction toprogramming for games, animations, rich andothervisually interactive stories making for is aprogramming language thatisperfect Scratch language, andthere are from. thousandstochoose inwhat’s are known asaprogramminginstructions written what todo. aprogram. iscalled Asetofinstructions The acomputer totell instructions Programming ofwriting istheart What isScratch?

things thatwork, thannaggingyou rather don’t. whenthey don’t dowhatyou expected, guidesyou towrite butScratch errors programs with logical in, write possible tostill ifthey together, makesome kindofsense. programs always Itis Error messages are rare. commands lock Scratch Because visual hintsabouthow you combine them. can Commands fittogether likejigsawpieces, sothere are strong onall screen, anddrop soyou justdrag them. can You don’t any commands: have toremember ortype they’re (collision detection), orrotating on acharacter screen. games, astestingwhetheramissilehashitanalien such simplifycommonScratch activities in The commands in findacommand when easily you needit. The commands arecategorized, color-codedand so can you 11

If you have a weak Internet connection, or none at all, you might prefer to use the downloadable version of Scratch to the browser- based version. If you’re using the If you’re I website, Scratch 2.0 using the recommend browser I experienced with it. some bugs using which Internet Explorer, I disappeared when started using Chrome. can download You Chrome for free at www.google.com/ chrome Members of the Scratch have said that they team an iPad hope to make but version of Scratch, that it might be more 2.0. than Scratch limited version of Scratch? of version Which Which Scratch 1.4 is the previous version of Scratch, and it is software Scratch of Scratch, version 1.4 is the previous Windows, it for can download You computer. your install on you and Linux at http://scratch.mit.edu/scratch_1.4/Mac of version This Scratch a whole newfound audience with the meteoric the stripped-down Linux-based rise of the Raspberry Pi, for and education hobbyists computer (see photo). Scratch 1.4 There is also a version of Scratch 2.0 that you can download from of version is also a from you ScratchThere can download 2.0 that can use so you the Scratch computer, your and install on website no official plans to are There it without an Internet connection. bring Scratch 2.0 though (correct to the Raspberry at the time Pi, of printing). You don’t need to install any software need to install any it runs to use Scratch 2.0: don’t You Scratch 2.0 Internet using an connection. browser, inside your so though, that canneeds a computer run Flash the Adobe Player, mobile devices some (including on work the iPhone and it doesn’t devices (including the Raspberry lower-powered and some iPad) run computers Most other Scratch 2.0 fine. Pi). Scratch Scratch 2.0 which was introduced Scratch of Scratch, is the latest version 2.0 This use Scratchyou can. if you 2.0 I recommend 2013. in May a take their projects, makes it easier for to share people version them). “remix” them (or and adapt projects, at each other’s look There are two versions of Scratch that are in popular use. In this of versions in popular use. Scratch two are that are There I’ll about both. tell you book, 12 Introducing Scratch is alreadyinstalled. latest version,ifScratch update Scratchtothe That command will also scratch && sudoapt-get install sudo apt-get update in, enter the command: install it. After logging Raspberry Pi,youcan Scratch installedonyour If youdon’thave example. (with acapitalS), for work ifyoutypeinStartx sensitive, soitwon’t Raspberry Piarecase- The commands on the l l l l l connected upandworking Pi already: Raspberry system,operating Raspbian. assume you’ve called got your I’ll withtherecommended version isincluded oftheLinux Scratch Starting ontheRaspberry Pi 5 4 3 2 1

click Scratch click open themenu, theProgramming folder, click andfinally, to thebutton inthebottom-left also shown below: click You usingthePrograms Scratch Menu, alsostart can as ofthescreencorner on it.a cat Inthescreenshot below, it’s inthetop-left icon, theScratch Double-click hasapicture which of something different. You mightalsoseedifferent icons isjustabackground image,Raspberry soyou mightsee The LXDEdesktopappears(seepicture). Thelarge startx ~$, you seetheprompt pi@raspberrypi When enter is andlogin. Pi on your Raspberry Switch The defaultlogin pi, andthedefaultpassword israspberry and press key theEnterorReturn 13 When you return to the you can time, site next “Sign in” in the just click top right to get to all your projects. You can try Scratch You 2.0 by just going to the website and at the Create clicking If top of the screen. you use an account, though, the website will automatically save your work for you. The design of websites The design to from time can change so don’t worry if time, in the you see variations sign-up process when you do it. button button on the navigation bar at the top of the the navigation on and you will be logged in. Simply in. will be logged OK Let’s Go! and you Join Scratch in the top-right Create Create

screen, and you’re ready to start programming! ready and you’re screen, click password and enter it twice. The second time is The second Pick and enter it twice. a password of a mixture Use typed it correctly. you’ve to make sure numbers and symbols to make it case, upper and lower Click the Next secure. more country and email gender, date of birth, Enter your you information is used to help This personal address. the and is used by forget it, if you password your recover It doesn’t Scratch team to understand who uses Scratch. Click the Next anywhere. the website appear on browser, such as Google Chrome browser, Open a web http://scratch.mit.edu/ address in your Enter the website usually the screen at the top of bar, address Scratch people young used by is Make up a username. members to protect advises so the site others), (among change can’t You names. their privacy not using real by so choose wisely username later, your

Click

Click

7 6 5 3 4 1 2 l

l l l l l l Before you begin to program with Scratch 2.0, I recommend you you I recommend with Scratch to program begin you Before 2.0, how: Here’s forthe Scratch an account create website. Creating a Scratch account Scratch a Creating 14 Introducing Scratch Scratch 2.0. a browser, you’reusing you’re usingScratchin using Scratch 1.4. If Raspberry Pi,you’re If you’reusinga use theselater! learn allabouthowto sounds onasprite. You’ll scripts, costumesand to switchbetween the Area (inScratch1.4) 2.0) or abovetheScripts Blocks Palette (in Scratch Use thetabsabove Right: Scratch 2.0 Blocks Palette Scripts Area Sprite List Backpack Stage Tabs • • ofthescreen are:The mainparts 1.4. layout inScratch screen 2.0, layout inScratch andthefacing page shows thescreen 2.0too.colors have beenlightenedinScratch This page shows the are there, beenjuggledaround abit. but they’ve The background 2.0), feature inScratch (anew Backpack thesameelements all is theway thescreen islaidout. theexception ofthe With difference Scratch The mostobvious between the two versions of 1.4,using Scratch itsicon on your desktop. double-click Create atthetopofscreen.web browser andclick To start To 2.0, usingScratch start visit Using the Scratch screen Using theScratch

versions ofScratch, theStage. Listisunderneath theSprite project, between them. themtoswitch andclick Inboth List,In theSprite thatare thesprites inyour you seeall can astheplayer’ssuch spaceship, invading aliensandamissile. object inagame. Your lotsofsprites, project mightinclude List:Sprite The left, 1.4, whereas inScratch ison theright. theStage oftheStage.the middle 2.0, InScratch ison the theStage in action. starts, Scratch there’sWhen in alarge orangecat Stage: This iswhere can see you your animations andgames cat isa cat ‘ sprite’, or islikeacharacter which inyour http://scratch.mit.edu/ 15 Tabs Blocks Palette Scripts Area Stage Sprite List You’ll see all these see all these You’ll soon, in action elements so don’t worry about memorizing the screen is layout. This section your just to help you get that bearings. Remember to these pages are here refer to at any time. Left: Scratch 1.4 The Backpack is a new feature in Scratch 2.0, The Backpack is a new in feature Scratch 2.0,

copy scripts and dragging or spritescopy them there to it by

Backpack: Backpack: and Palette canwhichScripts find underneath you the Blocks You a bit like a clipboard. It works Click to open it. it Area. can just drag them from want to use them, If you them. dropping Backpack works Your the Backpack project. back your into sprites or to copy way a great so it’s projects, all your across projects. different between bits of program The Scripts Area is where you make your you make Scripts The Scripts is where Area Area: This area assembling blocks there. by in Scratch, programs you use a larger so if available, space expands to fill the screen the Scripts will be bigger. Area monitor, In Scratch, you give the computer commands commands the computer give you In Scratch, Blocks Palette: instructions like which that fit together are using blocks, by you with all the Palette presents The Blocks pieces. can the see you When start you Scratch, canblocks use. you and are blue, color-coded in dark which are blocks, Motion a can browse You used for movingStage. sprites the around by Palette clicking set of blocksone of different in the Blocks such as the Looks or the Sound button it, above the buttons button.

• • • ...cont’d 16 Introducing Scratch Clockwise 15 Degrees. Stage, after Iclicked Turn Above: Thecat on the the edge of thescreen. big, the spritewillstayat numbers thataretoo completely. Ifyouuse disappear offthescreen Scratch won’tletthecat Scratch 1.4. or bottom, will be The oneontheright, top, will beScratch picture on theleft,or and Scratch 1.4. The like in bothScratch 2.0 what somethinglooks Sometimes I’ll show you 2.0. l l l do: toseewhatthey blocks makingaprogram,Before we start withafew experimenting try l Exploring theblocks 3 2 1 4

hole inablock, you change what’s can init moves five timesasfar.the cat Whenever you seeawhite it tosomething else. Try theblock, 50 andwhenyou click the number10andchange tomove.want thecat Click far across thescreen you The numberofstepsishow won’t seeitslegsmove cat’schanges theposition, only This block though: you right. theblock, Eachtimeyou click moves once. thecat direction it’s facing, tothe moves inthe on theStage cat the Palette,In theBlocks click Scratch first start show theMotion blocks. This button isselectedwhen you Palette button theMotion above theBlocks Click to in its new directionin itsnew nexttime, 10stepsblock themove you click walks thecat turn. makethecat toactually the block to click When the number. Remember angle oftheturn, change block. To change the 15degrees clockwise theturn clicking byRotate thecat block. 10steps move The 17 In Scratch 1.4, the cat 1.4, In Scratch only has one costume, but I’ll show you how to add additional costumes in Chapter 5. All these blocks are All these blocks are explained later in the now it’s but for book, few worth spending a some minutes exploring you of the commands can give the cat. button above above button button above the Blocks above button Palette block to see the cat’s

If you’re using Scratch 2.0, click the Looks using Scratch 2.0, If you’re the Blocks Palette In Scratch 2.0, click the next In Scratch 2.0, costume so it appears to run legs move, just Costumes are the spot. on and the cat has two a sprite pictures different can have, (see below) positions its legs in different that show block. Now, if Now, Click the pen downblock. clickyou and click button the Motion it the blocks the cat to move around, it a line behind it wherever will leave is also a pen up block you There goes. can use to turn this effect off again If the cat gets to the edge of the Stage, drag it back again of the Stage, If the cat to the edge gets mouse hold the Click the cat, pointer. mouse with your mouse the then release and the cat, move down, button it in place to drop button Click the Pen

8 9 7 6 5 ...cont’d l l l

l l 18 Introducing Scratch the topofscreen. click Create instead at can’t see theFile menu, Scratch 2.0andyou New. If you’reusing menu andthenclick project. Click theFile idea tostartanew in thisbook, it’s agood building eachprogram Before youbegin background. Scratch 1.4, it’s calleda called abackdrop. In picture on theStageis In Scratch 2.0, the l l Choosing abackdropinScratch2.0 1.4. Scratch 2.0and Scratch different in tosomething moreof theStage inspiring. The way you dothisis Before we makeourfirstprogram, let’schange thebackground l l Changing thebackdrop 2 1 4 3

more designs. theNature Click theme use thescrollbar tosee on theright different backdropsview available, and to on theleft themes andcategories opens, thelibrary the click When totakeaphotowebcam from your computer, oruseyour to paintabackdrop, upload apicture the library. The othericons enable you first iconchooseabackdrop tofrom the heading NewBackdrop, the click theStage.is apanelfor Underneath To List, oftheSprites theleft there in Chapter4 background ifyou wantto. We’ll look at thePaint Editor the Your backdrop isadded tothe Stage, behindthe cat, and image, thehill Click theOKbutton andthenclick Paint soyou editthe Editoropenson theright can

19 You can You also use the file 1.4 browser in Scratch to find your own on to use your computer as backgrounds. In the left of the file browser, your Computer, Click username or Desktop to start browsing your to get back To computer. backgrounds the Scratch Backgrounds. again, click Previous folder

Your background is added to the Stage, behind the cat to the Stage, is added background Your Go into the Nature folder and use the scrollbar on the on folder and use the scrollbar Go into the Nature Click it and then click OK righthill to find the picture. Click the Backgrounds tab then the Scriptsabove Area, click the Import button to the file browser Use the backgrounds explore Double-click a available. back to the go To inside that folder. to look folder icon click the up arrow indicated below previous folder, To the left of the Sprite that white icon List is a To Click it to start blank Stage. your represents

5 4 2 3 1 ...cont’d

Choosing a background in Scratch 1.4 in Scratch a background Choosing l

l l

l l 20 Introducing Scratch they’ll bedeleted. into theBlocksPalette, but ifyoudragthem around theScriptsArea, You canmoveblocks close enough. together, they’re not script. If they don’tsnap they won’tworkasone snap together, otherwise Make suretheblocks with it. the blocksunderneathit from them, and carryall Area, it willbreak away other blocksintheScript block that’s joinedto If youclick and draga l l l l l program,Scratch let’swalkdown thehill: makethecat outlater. thatyou storeinstructions can uptocarry For ourfirst makingaprogram.useful for Aprogram isasetofrepeatable immediately, do, sothisisgood testingwhatblocks for butnot Palette, intheBlocks blocks you click When moves thecat Creating your first your Creating 4 3 5 2 1

sprites with several scripts withseveral sprites lotsof program might include more than one script, and a a “ as makewhat’sthis they known are blocks joinedlike When block. 15degrees clockwise turn snap together. will They Area anddrop the itunderneath itintotheScripts drag Palette, intheBlocks 10stepsblock themove Click ready itswalk for mouse button. cat downhill, pointour will This firstblock Area andthenrelease the mouse pointerintotheScripts Palette,Blocks holdthemouse button down, move the inthe block 15degrees block, clockwise theturn click Area from Palette. theBlocks To your dothisfor first You makeaprogram intotheScripts by blocks dragging theMotion Click Area above theScripts Palette. tabisabove theBlocks Scripts 1.4, InScratch it’s sounds instead, theScripts click Area isempty, you’re ready. Ifitshows costumesor Next, Area isopen. thattheScripts check IftheScripts List in theSprite We’re thecat so click aprogram thecat for going towrite sprite can have script”. can Asprite button above the Blocks Palettebutton above theBlocks tab. 2.0, InScratch the program 21 right-clicking doesn’t right-clicking If work for you (or your mouse doesn’t have a hold second button), down the Control key on your keyboard and click, or try holding down the Shift key and clicking. This tip applies anywhere you’re asked to right- later in the book. click I wouldn’t usually I wouldn’t you add the recommend repeatedly, same blocks the right at but we’re beginning of learning is There Scratch here. and readable a more elegant solution you’ll 2. discover in Chapter button above the Blocks Palette. the Blocks above button Palette. blocks. Move the copy to the copy Move and the wait blocks.

It’s a long walk for a long a tiny It’s him finish make so let’s cat, his walk with a exclamation in a speech ‘Phew!’ of Click the Looks bubble. the Blocks above button and drag the say Palette, Hello! for 2 secs block into the Scripts and join Area Click program. it to your Hello! to edit what the cat says to Phew! block, and when the menu Right-click the move 10 steps block, This copies the block plus any choose Duplicate . opens, it In our example, blocks script. underneath in your it copies the move the bottom of the bottom program, your and click to the blocksplace can You there. this step repeat several times to make the cat walk further ClickControl the should decide when things used to blocks are Control Drag block the wait 1 secs the Scripts into Area happen. This block and snap it underneath blocks. the other two our cat will so move Without it, delay. a 1 second adds it’llfast, the start his walk to of jump from appear to just Slowing him down the end. what’s enables us to see can make You on. going by him walk a bit faster 1 from changing the delay to 0.5 seconds second

8 7 6

...cont’d l

l l 22 Introducing Scratch here’s your first program. first your here’s one exhausted catlater, Right: Afewblocks and hill again? walk backwards up the if youcanmake the cat backwards. Why notsee block, the spritemoves in the“move 10 steps” negative numberofsteps Experiment! If youusea button. place, release themouse When it’sintheright block will bedropped. will showyouwherethe over itandawhiteline script, drag yourblock block at theendofyour Instead ofdroppinga into anexistingscript. You caninsertblocks l l ...cont’d 10 9

working itsway down theblocks inorder,joined-up instructions atthetopand starting Area. intheScripts the blocks outall carries Scratch the script. To your script, run any ofthejoined-up click ascript’s commands, you start When it’s called “ the topofyour script it, editthembothtomakezero. Addto theseblocks blocks.x:0 y:0 hasdifferent Ifthego numbersin toblock 90 in thepointdirection PaletteBlocks anddrag buttonMotion above the position. the Click starting it intheright add toput some blocks walking on itshead. Let’s time. Eventually, be it’ll where itfinishedlast again andwalksfrom it again? cat turns The torun thescript click happensifyou What block andthego to block running” 23 In the downloadable version of Scratch your work isn’t 2.0, automatically saved for you. Use the Save option menu to in the File Use the save your work. Save As option to save your project with a new filename, so you don’t overwrite the previous version. You can’t use projects can’t You 2.0 using Scratch made can You in Scratch 1.4. projects 1.4 use Scratch though. in 2.0,

Untitled plus a number. You You Untitled plus a number. : This throws away all the changes you’ve made to the made you’ve all the away changes throws This Revert: it this time. opened since you project Upload from your your from Upload If you computer: previously downloaded a Scratch to project or used a PC, your of version downloadable use Scratch it, to create it to to upload this option the Scratch 2.0 website. : This enables you to save your you to save This enables computer: Download to your You open it using can your computer. on as a file project Internet If your of Scratch version the downloadable 2.0. use this fails, connection to straight away option work! your save : This makes a copy of your project with a your project of This makes a copy as a copySave : is your project of version The previously saved new name. want to experiment with your this if you Use left untouched. of it. version without losing a working program

• •

• • There are additional options for options additional are There see the Stage, also above in the File work menu, saving your These include: below. can choose a more useful name by can useful name by choose a more the Stage. above editing the box Your project is saved with the with the is saved project Your name In Scratch 2.0 (web version), your work is automatically work for saved your In Scratch version), 2.0 (web In the top-right corner project. make changes to your as you you been changes have latest can see whether your you of the screen, will there If they haven’t, saved. . Now to Save be a link here Scratch 2.0 projects in Scratch Saving A Scratch project includes all the sprites, scripts and backgrounds A Scratch includes project all sprites, the can you so projects your idea to save a good It’s used in it. that are them. them or modify back reuse to them later to come Saving your project your Saving 24 Introducing Scratch of yourwork. sure youdon’tloseany to saveregularlymake Scratch 1.4, remember If youareusing find some demo projects. demo some find to browser file the of left Click in the file browser.file the in in theboxesonright description oftheproject author nameandashort You canaddtheproject Examples on the Scratch 1.4 Saving andopeningyourprojectinScratch Type OK. click thefilenameinbox atthebottom and orfolder,drive theuparrow besideittogo upafolder. andclick Projectsthe top(Scratch inthescreenshot) another tochoose whereused tochoose tosave your file. nameat thefolder Click browser opens, asshown below. areThe buttons down theleft you projectcopy save anew or ofaproject,When thefile • • • • • screen. This menu’s options include: Palette menuabove theBlocks theFile atthetopof Click ...cont’d

saved project, replace theoldsaved version. you’ll versiona new of a editing. Ifyou’re saving old project you’ve been project,a new oran costumes inChapter5. a costumeyou useinotherprojects. can You’ll about learn : Sprite Export This option enables as you tosave asprite that’s open. currently combine itssprites, andbackgrounds withtheproject scripts ProjectImport : This enables you toopenaproject, and project, andleave theprevious fileuntouched. project, usethisoption. filecontaining save Itwill anew your :Save asacopy Ifyou wanttokeepthepreviousversion ofa Save saved file.previously Open: Opensa : Use thistosave 25 1.4, you open 1.4, In Scratch projects by clicking to menu at open the File the top of the screen and then choosing Open. If you click the Share If you click a project, button on for it will be available and use anyone to see, 11 See Chapter reuse. sharing your on for more projects. links on the right. If you delete If you the right. links on

a project by mistake, click the Trash folder on the left, and then the left, folder on Trash click the mistake, by a project click the project. the Put to recover back button Because projects are saved automatically, your My Stuff your area automatically, saved are Because projects delete unwanted To tidy up, quickly fills up with Untitled projects. clicking by projects their Delete Use the scrollbar at the right edge of your browser window to find window browser at the right of your the scrollbar edge Use and click projects to get more when you the Load button More click when you load projects the If no more of the list. the bottom click its See inside open a project, To all of them. that’s button, button.

In the downloadable version of Scratch 2.0, you open projects open projects you Scratch of version In the downloadable 2.0, website is The the File through top of the screen. menu at the your click there, your projects find To complicated. a bit more username in the top-right of click and then the screen My in “Sign in” If it says Stuff. click username, of your place My The Stuff it to sign in first. projects, all your shows section most recently with those you Take the top. edited nearer in the at my projects a look below:screen Opening projects projects Opening 26 Introducing Scratch adaptations ofthem. from them, and create that otherscanlearn on theunderstanding website areshared projects ontheScratch version ofit. All the to create your own button inthetopright can click the Remix in theeditor, you somebody else’sproject When youopen to useinScratch 1.4. projects fromthewebsite download shared there isn’tawayto At thetime of writing, backgrounds thatmakeitwork. togo intothe editorandseethescripts,the topright and sprites you wanttoknow how itwasdone, insidebutton in theSee click oftheplayer it. torun the middle Ifyou likewhatyou see, and you how tousetheproject, thegreen flagbutton in andyou click aprojectClick togo toitspage. right tell on the The instructions the projects tobe. most remixed andmostrecent, you how andtochoose new want right enable The menusinthetop by themostloved,you tosort acategory. tochoose left Explore and click Scratch You opentheprojects can thatotherpeoplehave shared on the Opening website too. thewebsite athttp://scratch.mit.edu Visit at thetopofscreen. Use theoptions on the shared projects 211 56 86 42 35 30 30 35 47 47 185 203 203 143 127 134 200 150 151 111 199 73, 86 21, 62 30, 69 37, 175 73, 203 30, 202 150, 162 103, 173 144, 172 144, 171 151, 197 151, 160 45, 48, 51 30, 55, 69 15, 17, 21 47, 67, 154 134, 142, 183 54, 67, 79, 90 151, 153, 156 15, 16, 30, 38 41, 48, 77, 203 41, 48, Index 16, 20, 35, 38–39 16, 20, 35, 22, 28, 29, 33, 72 22, 28, 29, 194 73, 183, 193, 22, 35, 72, 123, 173 22, 35, 72, 123, 51, 78, 144, 167, 172 51, 78, 144, 167, 103, 108, 111, 142, 152 142, 111, 108, 103, 103–104, 106, 146, 174 16, 20, 22, 35, 38–39, 50, 90, 174 90, 50, 38–39, 35, 22, 20, 16, name] go to [mouse-pointer] go to [Sprite1] go to x:0 y:0 if on edge, bounce steps 10 move point in direction 90 point towards set rotation style set x to 0 set y to 0 turn anti-clockwise 15 degrees turn clockwise 15 degrees broadcast [message] wait broadcast [message] and to [backdrop when backdrop switches when green flag clicked [message] receive I when when loudness > 10 when space key pressed when this sprite clicked change color effect by 25 clear graphic effects costume # go back 1 layers go to front hide next costume say Hello! say Hello! for 2 secs set color effect to 0 set size to 100% show switch costume to [costume name] define change x by 10 change y by 10 glide 1 secs to x:0 y:0 hide variable [variable name] hide variable at 1 of [list name] insert thing name] item 1 of [list name] length of [list thing [list name] contains with thing replace item 1 of [list name] set [variable name] to 0 show list [list name] name] show variable [variable Looks making More Blocks Motion Events 56 76 76 61 88 41 19 15 164 207 203 151 207 140 125 132 182 201 184 76–77 52, 85 15, 16 11, 180 169, 177 150, 152 103, 173 110, 111 52–53, 93 45, 48, 51 150, 152, 154 18–19, 51, 110 47, 50, 88, 162 47, 50, 68, 89, 106, 143 68, 89, 106, 79, 164, 177, 207 79, 164, 177, 41, 55, 88–89, 175 41, 55, 88–89, 30, 54–55, 95, 134 61–62, 130–131, 164 103, 108, 111, 142, 152 142, 111, 108, 103, 21, 33, 55, 73, 87, 204 21, 33, 55, 73, 103–104, 106, 146, 174 58–60, 121–123, 147, 156, 159–160 backgrounds 39–40, 49, 114, 127, 155, 161, 208 See hide list [list name] when I receive [message] receive I when when I start as a clone when space key pressed when Sprite1 clicked add thing to [list name] change [variable name] by 1 delete 1 of [list name] repeat until say Hello! for 2 secs stop all stop script wait 1 secs wait until when green flag clicked delete this clone forever forever if if else if... then... else if... repeat 10 broadcast [message] broadcast [message] and wait create clone of myself Data 47 color of 21 Control changing B A bats bitmaps blocking paths blocks backgrounds Backgrounds tab Backpack backdrops. background music average Adobe Flash Player alphabet sprite animation asking questions A,sockets B, C, D adding sprites 212 Index Sound Sensing Pen Operators rest for0.2beats play sound[soundname] untildone play sound[soundname] play sound[soundname] play note60for0.5beats play drum1for0.2beats change volumeby-10 change tempoby20 y positionofSprite1 x positionof[spritename] x positionofSprite1 video motiononthissprite username 178 turn videoon touching color? touching? timer slider sensorvalue set videotransparencyto50% sensor buttonpressed? reset timer loudness key spacepressed? ask [What’syourname?]andwait answer 125–126 stamp set pensizeto1 set penshadeto50 set pencolorto[color] set pencolorto0 pen up pen down clear change pensizeby1 change penshadeby10 change pencolorby10 pick random1to10 or not 198 letter 1ofworld length ofworld join helloworld and 59 > = < + 187 / 132 * - 188 17, 31–33,38,48,192–193, 202 107–108, 112–114,124 143, 156,159,162 119, 121–123,132 126, 128–129,178 125–126, 129,197 60–62, 193,201 32, 40, 42, 202 185, 187–188 15, 101,107 32, 157,198 60, 74,193 32, 33,193 31, 33,193 31, 33,146 72, 86,128 17, 31,33 101, 105 180, 183 180, 183 185, 187 180, 183 180, 185 153, 159 123, 188 121–123 68, 127 32, 202 59, 147 89, 178 78, 195 31, 33 107 101 177 107 101 107 185 195 185 162 32 32 32 copying sprites. copying scripts. copying costumes. copying blocks. coordinates Control. community comments color collision detection cloud variables Cloud DataLog cloning sprites. clipboard cleanup checking input checking formovement chat program cat cars, moving button 184 bugs 206–208 browser broadcasts brightness bracket bouncing Blocks Palette C Variables 47 in Paint Editor graphic effect hide variable[variablename] hide list[listname] delete 1of[listname] change [variablename]by1 add thingto[listname] volume 101 tempo stop allsounds set volumeto100% set tempoto60bpm set instrumentto1 show variable[variablename] show list[listname] set [variablename]to0 replace item1of[listname]withthing [list name]containsthing length of[listname] item 1of[listname] insert thingat1of[listname] See blocks, Control See See See See See sprites, cloning duplicating scripts duplicating scripts duplicating sprites duplicating costumes 62, 74,88,176,194 103, 146,198–199 14–15, 20–21,41 47, 50, 88, 162 150, 152,154 151, 153,156 47, 170,178 47, 67,154 28, 30,68 14, 17,33 150, 152 101, 177 151, 160 151, 197 206, 209 8, 11,13 144, 186 150, 162 73, 193 47, 67 8, 209 170 206 159 183 197 194 144 151 107 101 107 107 151 150 31 15 62 84 47 213 44 24 44 20 24 23 92 33 40 24 114 201 186 197 203 116 198 102 108 166 172 133 202 189 185 181 182 144 207 147 209 209 41–42 46, 48 19, 24 73, 194 64, 194 174, 176 183, 187 19, 24, 53 Scratch 2.0 192 Keepy-Uppy London Bridge Maze Mania Night Flight on Scratch website opening in Scratch 1.4 Patter Penguin Photo Safari Quiz Break Rainbow Painter Ransom Writer Shop Cat singing Gobo singing sprite Space Swarm Spiral Rider Super Dodgeball teleport victory dance walking cat Scratch 1.4 Abstract Artist blinking LED clap-o-meter Cosmic Chorus Donut Chaser 44 downloading drawing a house drawing a spiral Going Batty 136 Hangman hexagons pattern F firing fisheye Flash blocks flying folder football 192–193 excited dinosaur Explore Export Sprite feedback file browser File menu examples 86 33 34 31 38 25 78 26 23 20 195 189 133 173 39–40 35, 71 13, 14 57, 68 119–120 138, 168 80, 93–95 34, 38–39 93–95, 138 17, 20, 198 10, 206–208 90, 171, 204 15, 75, 76, 105 15, 21, 61, 69, 106 69, 15, 21, 61, duplicating costumes duplicating See blocks, Events blocks, Data See See between sprites using directions backgrounds 110 costumes scripts sprites a clock a hexagon a house a square a triangle on the Stage 40 patterns sprite position walls 201 149 lists projects 69 scripts 75 sprites variables 149 93–95 adding copying. 138–139 drawing E D Events. electronics energy meter errors duplicating Download to your computer dragging blocks drawing difficulty, adjusting difficulty, direction 132 division download shared projects detecting death sequence 206–208 debugging deleting dance Data. Create cursor keys Costumes Area Costumes tab costumes 214 Index hide asprite hat blocks grid reference green flag gravity 188 graphic effects GPIO Google Chrome ghost effect General PurposeInput/Output Game Over Looks. lives 171 lists limiting variables light sensor light emittingdiode(LED) left-right LED 189 keyboard control jump Join Scratch joining text iPad 11 Internet insert blocks information (ofsprites) importing high score L K J I H G deleting projects costumes backgrounds See blocks, Looks 56–57, 68–69,172,192–193,195 51, 78,144–145,173 79, 164,177,204 45, 56,76,108 26, 45,50,78 184, 187,188 149–150, 197 170, 178 189–190 189–190 95, 140 19, 110 51, 144 36, 175 11, 13 189 187 126 149 41 28 89 13 11 22 37 24 maze maximum value Make aVariable Make aList Make aBlock lower case loudness 203 loops Paint Editor Operators. opening projects Open obstacles 194 number1 new sprite nested loop My Stuff music multiplication moving sprites. mouse pointer Motion. mosaic effect Morse code More Blocks MIT MediaLab missile microphone menus inblocks Maze Generator M P O N different verses vectors 85 tools 82–83 sheet music scale 109 rests 113 notes 112 beats 113 background See also See See See blocks, Motion blocks, MoreBlocks blocks, Operators See blocks, Motion 168, 174,176 107, 112–114 18, 80–85,95 39, 40,49 23–25, 26 199 169, 177 149, 151 123, 128 144, 172 180, 185 25, 209 7, 210 52–53 201 199 156 200 190 201 114 112 89 46 24 40 42 47

215 8 20 20 10 97 14 25 80 75 198 180 184 186 209 209 207 23, 24 98, 99 25, 26 13, 25 97, 100 98, 100 192–193 190, 210 184, 188 170, 178 97–99, 169 26, 45, 170 20, 33, 51, 95 52–53, 95, 140 15, 20, 22, 33, 95 169, 174, 175, 177 cloud variables 11, 14–15, 23, 24, 37, 81, 99 11, 14–15, 23, 24, 37, duplicating scripts See 11, 14–15, 18, 23, 25, 37, 76, 80 11, 14–15, 18, 23, 25, deleting scripts See 65, 67, 88, 132, 170, 176, 195, 204 65, 67, 88, 132, 170, 176, blocks, Sensing See blocks, Sound See See rising 124 typewriter adding detecting playing 101 recording 7–8 history 11 versions cloud variables. 97 sounds 85 vectors creating defined deleting. duplicating. as a copy 110 backgrounds 23–24 projects high score definition S Sound Library sounds 20 Sounds Area sound sensor Sounds tab Sprite Library Scratch 1.4 Scratch 2.0 Scratchboard Watcher Scratcher ScratchGPIO screen layout scripts Scripts Area Scripts tab See inside Sensing. Share shared projects Share This Project Online sharing projects Sign in Single Stepping slider Small stage layout soccer Sound. sound effects 24 saving scissors icon score Scratch 7 25 71 66 75 23 21 22 25 69 20 25 31 197 202 184 204 125 144 8, 26 7, 10 7, 10 36–37 80–81 10, 20 13, 209 87, 203 72, 74, 86 72, 128, 167 184–188, 210 170, 178, 180 36–37, 71, 175 11, 12, 66, 67, 79, 72, 74, 176, 183, 193 blocks, Pen 101, 107, 166, 169, 177, 186, 189–190, 210 189–190, 177, 186, 169, 107, 166, 101, See pattern pause screen position size 183 pins 189–190 direction list items numbers 23–24 saving 209 sharing 146–148 structuring deleting in Scratch 2.0 24–25 opening R Q right-clicking rotating sprites rotation style running a script resizing sprites Resnick, Mitchel Revert renaming sprites reporting boxes resistance 189 resistors recovering deleted projects remix removing scripts Raspberry Pi random questions, asking Put back programming programming language project Print Screen key privacy program 52 photo PicoBoard pipette pixelate paint new sprite paint password Pen. 216 Index Stage sprites Sprite List uploading Untitled projects undeleting Turbo mode transparency title screen timing timer text length text, joining testing teleport effect tags 209 surprise sprite structuring programs strings, joining string1 200 string 199 strength Stop button stop aprogram starting ascript. stamp U T See also See projects backgrounds 110 scripts 106 projects video 180–183 random reporting boxes uploading 52 revealing 86 resizing 75 renaming random hiding 203 detecting position deleting. defined customizing 80 costumes. cloning adding blocks, Pen See See deleting sprites See costumes running ascript 14, 18–19,28,31,51,123 51, 78,84,145 14, 20,60,71 65, 78,88–89 52–53, 93–95 20, 74,158 76–77, 182 119, 203 110–111 146–148 42, 121 207 153 126 172 126 195 20 23 90 53 42 75 23 25 87 66 71 53 14 variables validating input username upper case zig-zag 175 y x writing ontheStage whirl 144 website webcam web browser. walls 201 wait, random volume video motion video direction video 180–183 vehicles vectors Variables. V Z Y X W deleting cloud sprites 52 reporting boxes naming 47 limiting 89 in soundeffects hiding 118 48–49, 65,114,125,141,152,170,206 See blocks, Variables See browser 8, 14,26,178,209,210 52, 97,180–183 13, 178,209 47, 170,178 28, 30,68 28, 30,68 140, 198 46–47, 52, 85 66, 74 159 156 101 203 181 194 149 124 87 reword by reword MIT Media Lab Media MIT Fo k Resnic Mitchel covers Scratch 2.0 and Scratch 1.4 2.0 and Scratch covers Scratch g Programmin TED OR OW USTRA cratch Y ILL IN FULL COL Sean McManus Sean S PLAIN ENGLISH EASY TO FOLL FULL

SCRATCH PROGRAMMING 7

175

in to it use but too. the adjust start different can for sprite to a me, same make several player ” them them, appropriate. . to you the ag Their as the fl hit the used have of harder aliens to them on and for it hitting sprite can script of green size you’ve ou there’s make avoid missile this easier any Smaller alien sprite, the the Y scripts If dangers. , Space Steps reference in een make our gr y paths of e when something aliens

siz the guides. shows 2) ratch the know the Look inside Sc Easy above dd using in

easy set A picture

Chapter to e ag List. designing. block settings t-right, (see

hen In still

block rite lef icons pen: the fl W ight tage. a e . Sp S to potential but shooting t-r

the use

you instead and their yle the the lef oving or st fundamentals and fundamentals and in 1.4, of 50% it and with block. yle m easier t hidden, is of alette block st er

P s lef

and

and alien t’ our ratch ways racket rawn a on the make y then

i by position blocks rotation our pixelate al Sc the d right forev y Mine the of r b in moving to the a to licked . is random a put c the and In makes ve the Blocks the screen tage a

dead, rotation in the hes direction,

ect ect S

dd

It uses e direction, ’s pattern ix ag

colors, in

position e the sprite 2.0. keeps set it the use e appear alien add that sprite random on Click Inside fore eight reac the from it these alien rent F A right.

icons e t-facing 1 2 3 4 zig-zag e di making movements, changing until lef pointing across a the pixelate materializ random Moving even quick with learning, it Let several away these , and in schools and colleges. and colleges. and in schools your .ineasysteps.com bar s happy r’ of that programming re ye space provide you

pla fi the ngers, such as Spiral Rider ngers, such as Spiral e the receives

up r

it to nished, you’ll be impressing your nished, you’ll be impressing to fi List ezine presses

er rite fi when I’m missile script one Sp a play List the the dd move the a rite

see in to ll to

so ward y player

e’ e Sp rap to er purchased y,

ts, our is w block when and then w want

y missile

right from e, the sprite t the sprite if e” loop sprite play when e” and r we

star spice the n’ to

 this. r behind r script in spacebar and the slightl is e” an “ see

e “ so do not the it to for the the to

r screen it for it

www e comes in continuousl “ missile the

last it, or er  ship missile game position, tutorials script hide missile

and W o ’s for the ’s script script extremely when to head. that moves play pressed, the the that the

when , it when our lowers a this a e checks ’s Raspberry Pi Raspberry position ything to been h ship missile ship ship broadcast r

broadcasts the bmaster er dd dd dd

tell until pilot moves the the then the script that ev broadcasts waits the being and has to checks when received. sprite sprite the Click Click Click ll have that e’ A A A you enable

1 2 3 4 5 6 broadcast: and w sprite Enabling To for tip highly visual interface and drag-and-drop interface and highly visual We was

If - is a programming language that is widely language is a programming a the done” the I be a stop the makes to screen. rst and missile fi

inside to being for script, screen. space when again. the while anything second the the broadcast “broadcast” back “ “broadcast on a it game. on wouldn’t block from block a steps start the re than the move time, fi was while movement the jump still pressed 20 instead, put to to and wait” wait” is in movement use player player used

remember we faster

second would ship player block missile we able our the and If one missile able the else and it We Using missile handy

174 Space Swarm Space material “get series Lowter “ to Wherever a Scratch used on the used on Scratch’s ages to try language for all make it an ideal commands easy steps in With Scratch Programming to program. programming will be a breeze. at hand, learning you to Scratch This primer introduces the commands to create games then walks you through skill, to create games that require and animations. Learn knowledge or quick Swarm, or the classic Hangman game. Add music and Hangman game. Add music and Swarm, or the classic your games, and of course keep score. special effects to By the time you’ve with your own computer games! friends and family book? CN it 9 we we 9 , it, this this eye. 4 5 make make 1 do English worry the 5 to to value on more? US / $16.95 Don’t how color 5 plain forward. . in any easier instructions you 612 in follow how 8 say color and jargon? tell 78-1-84078-612- to illustrated to fantastic straight printed 07 choose choose use the just full simple. to by need it’s UK / $14.99 step-by-step in written written fully easy things , show you

book’s off don’t 78184 we

ISBN-13:9

9 learning also simpler And Do It’s This It’s Put keep It’s We It’s Clear

£10.99 Why Why