INTRODUCTION If you know the basics of Scratch and you want to go to the next level then this book is for you It contains tons of great programs and ideas so you can become a more advanced Scratch programmer Learn how to make games animate stories and write musical programs using a range of coding techniques such as loops variables and IF statements Once you’ve got things working you can customize the programs using your own ideas and graphics Here is a quick reminder of the different parts of Scratch and what they do T RY IT OUT Open your web browser type in scratch mit edu and select TRY IT OUT to get started New Upload from your computer Download to your computer Revert Save as a copy Go to my stuff Upload from your computer Download to your computer Record Export Video Revert Block Palette Choose commands from a list of categories Scripts Costumes Sounds costume 1 clear costume1 93x101 File Menu for logged-in users Create an account for free and save your work online New Save now File Menu for general users Upload and download to save and open work on your computer v305 Tips Edit File Untitled-4 by ihaveamac unshared The Stage Watch your program work here Sprites Objects that move around in Scratch are called sprites Sprites x 240 y 180 New sprite Stage 1 backdrop New backdrop Sprite1 Sprites Pane select which of your sprites you want to add code or sound to List of Commands Choose from a list of all the commands for each category Note Words in italics appear in the glossary on page 30 Scripts Costumes Sounds Scripts Looks Sound Pen Sound Events Control Sensing Operators More Blocks move 10 steps turn 10 degrees turn 15 degrees point in direction 90 point towards go to x 0 y 0 go to mouse-pointer glide 1 secs to x 0 y 0 change x by 10 set x to 0 change y by 10 set y to 0 if on edge bounce set rotation style left-right Scripts Area Add your commands or code here Drawing Tools Paint Editor Draw your own sprites or backdrops Sound Library Category All Animal Effects Electronic Human Instruments Music Loops Musical Notes Percussion Vocals afro string alien creak 1 alien creak 2 bass b bird birthday bells birthday bo chee chee cheer chomp ch Sound Library Add sounds to your program from here Costume Library All Animal Fantasy Letters People Things Transportation Theme Castle City Dance Dress-Up Flying Holiday avery-b avery walking-a ball-c ball-d ballerina-d balloon1-a Sprite Library Choose ready-made sprites for your programs 3
GHOST STORY In this program we will use an algorithm to make a story using Looks command blocks simple animation sound effects and loops The story will follow a cat in a scary building who gets frightened away by a ghost STEP 1 SET THE SCENE a Click the Stage icon in the Sprites pane a Click the Choose backdrop from library icon a Click the hallway outdoors image or choose your own backdrop a Click OK Sprites Sprite1 New backdrop STEP 2 ADD SOUND a Click the cat sprite in the Sprites pane a Click the Sounds tab a Click the Choose sound from library icon a Click bell toll a Click OK bell toll a You will need to repeat this to add three more sounds door creak scream-female and laugh-male2 AVOID THE BUGS Bugs are errors or mistakes in your code that stop your program from working properly Looking for those errors is called debugging Make sure you enter your code very carefully If things aren’t working properly use the tips on page 31 to help you 4 CUSTOMIZE Change what the cat and the ghost are saying Try adding another character or sprite to the story Try starting another story with different sprites What will your new story be about What will happen
STEP 3 SAY HI a In the Scripts Area build the following code 100 180 when clicked show go to x y say Hi I’m Scratch the cat for 2 secs play sound bell toll say I can hear someone coming for 2 secs play sound door creak wait 3 secs play sound scream-female until done say HELP repeat 80 When the green flag is clicked run this code Make sure the cat sprite is visible Go to the bottom-left of the screen Show a message for 2 seconds Play the sound effect of a bell Show a message for 2 seconds Play the sound effect of a door creaking Wait for 3 seconds don’t do anything Make the cat scream Show another message Start a loop that repeats the next two lines 80 times You’ll learn more about coordinates on page 8 Loops are a way to make several lines of code repeat You’ll find out more about them on pages 6 and 7 move 5 steps next costume hide Move the cat 5 steps forward Show its legs in different positions so it seems to walk Keep repeating Hide the cat it has run away STEP 4 ADD A GHOST a We need another sprite for our story Click Choose sprite from library a Click Ghost1 a Click OK key concepts ALGORITHM l To make a program work properly we need to figure out all the steps we need to take and put them in the right order l An algorithm is similar to a plan that helps us get all these steps correct STEP 5 MAKE IT SAY BOO 225 when clicked go to x y 32 hide set size to 100 wait 6 secs set ghost effect to 50 show say Boo for 3 secs repeat 100 move 2 steps change size by 1 play sound laugh-male2 When the green flag is clicked run this code Move the ghost to the top-left Hide the ghost for now Make sure the ghost is normal size 100 Wait for 6 seconds while the cat shows messages Make the ghost partly transparent Show the ghost Show a message for 3 seconds Start a loop that will repeat the next lines 100 times Move ghost 2 steps forward Make it 1 bigger Keep repeating Play a sound effect laugh-male2 Now press the green flag to check your code 5