You are previewing Scratch 2.0 Beginner's Guide Second Edition.
O'Reilly logo
Scratch 2.0 Beginner's Guide Second Edition

Book Description

Create digital stories, games, art, and animations through six unique project

In Detail

As 21st century people, we live a digital life, but computer scientists around the world warn of a declining pool of digitally literate computer science students. The Scratch environment makes it fun for students of any age to think, create, and collaborate digitally.

Scratch 2.0 Beginner's Guide Second Edition will teach you how to become a Scratch programmer and lay the foundation for programming in any computer language. Whether you are creating a birthday card or cloning bricks for a game of Breakout, projects are approached in a step-by-step way to help you design, create, and reflect on each programming exercise.

What You Will Learn

  • Program in Scratch including universal programming concepts such as loops, conditional statements, variables, arrays, Boolean logic, dynamic interaction, coordination, synchronization, threads, event handling, and procedures
  • Design user interfaces including sequence, characters, and controls
  • Translate a storyline or plot into an online game, animation, or story
  • Debug problems and revise projects to fix problems and add functionality
  • Think critically to solve problems based on need, program limitations, and knowledge levels
  • Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.

    Table of Contents

    1. Scratch 2.0 Beginner's Guide Second Edition
      1. Table of Contents
      2. Scratch 2.0 Beginner's Guide Second Edition
      3. Credits
      4. About the Author
      5. About the Reviewers
      6. www.PacktPub.com
        1. Support files, eBooks, discount offers, and more
          1. Why Subscribe?
          2. Free Access for Packt account holders
      7. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Conventions
        5. Time for action – heading
          1. What just happened?
          2. Pop quiz – heading
          3. Have a go hero – heading
        6. Reader feedback
        7. Customer support
          1. Downloading the example code
          2. Downloading the color images of this book
          3. Errata
          4. Piracy
          5. Questions
      8. 1. Welcome to Scratch 2.0
        1. About Scratch
          1. Encouraging everyone to think programmatically
          2. Sample Scratch uses
          3. Computational thinking
        2. Finding a project for you
          1. Making animations
          2. Telling stories
          3. Building games
          4. Programming games of chance
          5. Creating art projects
          6. Sensing the real world
          7. Programming concepts
        3. Using Scratch 2.0
          1. Looking inside a Scratch project
            1. The stage area
            2. The sprites pane
            3. The scripts area
            4. The built-in image editor
          2. Using Scratch 2.0 offline
          3. Encountering Scratch 1.4
          4. Tinkering encouraged
        4. Summary
      9. 2. A Quick Start Guide to Scratch
        1. Joining the Scratch community
        2. Time for action – creating an account on the Scratch website
          1. What just happened?
        3. Time for action – understanding the key features of your account
          1. What just happened?
          2. Abiding by the terms of use
          3. Creating projects under Creative Commons licenses
            1. Finding free media online
        4. Taking our first steps in Scratch
        5. Time for action – moving the cat across the stage
          1. What just happened?
          2. Using events to trigger an action
          3. Have a go hero – testing the move block
        6. Time for action – animating a walking motion with the cat
          1. What just happened?
          2. Understanding the basics of a Scratch Project
          3. Saving early, often, and automatically
        7. Time for action – saving our work
          1. What just happened?
          2. Undoing a deletion
        8. Introducing forever loops
        9. Time for action – setting the cat in motion, forever
          1. What just happened?
          2. Controlling a sprite with loops
        10. Time for action – flipping the cat right-side up
          1. What just happened?
          2. Clicking on a block runs the command
          3. Have a go hero – exploring sprite rotation
        11. Adding sprites to the project
        12. Time for action – adding a second sprite and script
          1. What just happened?
        13. Reviewing a video-sensing project
        14. Time for action – reviewing pop the balloon - video starter
          1. What just happened?
          2. Sensing video
          3. Have a go hero – remixing ideas with our starter project
          4. Pop quiz – getting started with Scratch
        15. Summary
      10. 3. Creating an Animated Birthday Card
        1. Introducing the paint editor
        2. Time for action – painting a happy birthday sprite
          1. What just happened?
          2. Changing the size of a bitmap image
          3. Choosing bitmap or vector images
        3. Time for action – drawing a vector image
          1. What just happened?
          2. Changing the size of the vector image
          3. Reviewing the image editing tools
            1. Erasing in the vector mode
          4. Filling the stage with color
        4. Time for action – using the fill with color tool to paint the stage
          1. What just happened?
        5. Adding gradients
        6. Time for action – applying a gradient
          1. What just happened?
        7. Time for action – adding more sprites to address the card
          1. What just happened?
        8. Initializing a sprite's starting values
        9. Time for action – hiding all sprites when the flag is clicked
          1. What just happened?
        10. Time for action – displaying happy birthday
          1. What just happened?
        11. Specifying memorable names and comments
        12. Time for action – renaming sprites
          1. What just happened?
        13. Inserting comments into our code
        14. Time for action – adding comments to a script
          1. What just happened?
        15. Transforming sprites with graphical effects
        16. Time for action – transforming sprites
          1. What just happened?
          2. Graphical transformations
            1. Comparing the repeat and forever blocks
        17. Time for action – turning m in a circle
          1. What just happened?
          2. Have a go hero – cleaning up the animations
        18. Time for action – making a sprite fade in with the ghost effect
          1. What just happened?
          2. Two ways to control timing
          3. Have a go hero – animating the butterfly
          4. Pop quiz – reviewing the chapter
        19. Summary
      11. 4. Creating a Scratch Story Book
        1. Designing the outline of a barnyard joke book
        2. Time for action – designing a clickable table of contents
          1. What just happened?
        3. Time for action – adding pages to the book
          1. What just happened?
        4. Time for action – adding a sprite to the Backpack
          1. What just happened?
          2. Using the Backpack to store sprites and scripts
        5. Building a joke with say blocks and sounds
        6. Time for action – making a horse talk with the say block
          1. What just happened?
        7. Time for action – synchronizing and animating the horse
          1. What just happened?
        8. Time for action – importing a horse sound
          1. What just happened?
          2. Playing supported sound formats
        9. Positioning a sprite by its coordinates
        10. Time for action – moving the dog based on x and y coordinates
          1. What just happened?
          2. Locating sprites with x and y coordinates
          3. Creating a new costume
        11. Time for action – duplicating, flipping, and switching a sprite's costume
          1. What just happened?
          2. Comparing costumes to sprites
        12. Composing custom sound effects
        13. Time for action – creating drum sound effects
          1. What just happened?
          2. Creating sound effects and music
          3. Have a go hero – writing a joke sequence for the dog
        14. Time for action – integrating the dog's joke sequence
          1. What just happened?
          2. Have a go hero – adding context to the dog's scene
        15. Navigating the story and coordinating scenes
        16. Time for action – hiding the table of contents
          1. What just happened?
        17. Time for action – displaying the dog scene
          1. What just happened?
          2. Coordinating scenes by backdrop name
        18. Time for action – navigating back to the table of contents
          1. What just happened?
          2. Have a go hero – finishing the sequence and initializing the project
          3. Pop quiz – checking chapter concepts
        19. Summary
      12. 5. Creating a Multimedia Slideshow
        1. Importing photos as backdrops
        2. Time for action – importing photos from files
          1. What just happened?
        3. Working with images
          1. Resizing images
          2. Using caution while resizing images
          3. Have a go hero – importing an animated GIF or vector graphic
        4. Adding slideshow controls to display images
        5. Time for action – flipping through the photos
          1. What just happened?
          2. Related backdrop blocks
        6. Playing and recording sounds
        7. Time for action – adding a sound from Scratch's library
          1. What just happened?
        8. Time for action – recording sounds in the sound editor
          1. What just happened?
          2. Understanding sound related blocks
        9. Editing sounds
        10. Time for action – editing a recorded sound
          1. What just happened?
        11. Time for action – appending a sound
          1. What just happened?
        12. Time for action – adding sound effects to recordings
          1. What just happened?
          2. Reviewing available sound effects
          3. Have a go hero – narrating additional images
        13. Using x and y coordinates to find the position of the mouse's pointer
        14. Time for action – using mouse location to hide arrows
          1. What just happened?
          2. Have a go hero – redefining the hot zone
        15. Time for action – providing user instructions
          1. What just happened?
        16. Displaying a project in presentation mode
        17. Time for action – presenting a fullscreen slideshow
          1. What just happened?
          2. Have a go hero – personalizing the slideshow with graphic effects
          3. Pop quiz – reviewing the chapter's concepts
        18. Summary
      13. 6. Making an Arcade Game – Breakout (Part I)
        1. Learning about the Breakout game
          1. Discovering Pong
        2. Time for action – importing and playing the Pong starter project
          1. What just happened?
          2. Remixing a legacy Scratch project
          3. Moving a sprite with the mouse or arrows
          4. Using reporter blocks to set values
          5. Customizing the gameplay of the Pong project
        3. Time for action – adding the left and right arrow controls
          1. What just happened?
          2. Evaluating the y position of the ball to end the game
        4. Time for action – determining if the ball is below the paddle
          1. What just happened?
        5. Time for action – adjusting the center of a sprite costume
          1. What just happened?
          2. Have a go hero – using the costume center in projects
        6. Cloning to create identical sprites
        7. Time for action – drawing bricks
          1. What just happened?
        8. Time for action – cloning bricks
          1. What just happened?
          2. Dealing with the cloned sprite
        9. Time for action – breaking bricks when I start as a clone
          1. What just happened?
          2. Cloning explained
          3. Rapid fire shooting with cloning
          4. Cloning related blocks
        10. Ricocheting with the point in direction block
        11. Time for action – changing a sprite's direction
          1. What just happened?
          2. Figuring out the direction
        12. Time for action – setting the starting position and the direction
          1. What just happened?
        13. Time for action – ricocheting off bricks
          1. What just happened?
          2. Conditional statements
            1. Conditional statements in real life
        14. Defining a variable to keep score
        15. Time for action – adding a score variable
          1. What just happened?
          2. Setting variables For all sprites
          3. Setting variables For this sprite only
          4. Have a go hero – creating a graphical effect for the bricks
          5. Pop quiz – reviewing the chapter
        16. Summary
      14. 7. Programming a Challenging Gameplay – Breakout (Part II)
        1. Implementing lives
        2. Time for action – adding a variable to track lives
          1. What just happened?
        3. Time for action – checking for game over
          1. What just happened?
          2. Evaluating multiple programming solutions
          3. Have a go hero – programming a character's health
        4. Adding more bricks to the level with a custom block
        5. Time for action – creating a second brick
          1. What just happened?
        6. Time for action – drawing rows of bricks with custom blocks
          1. What just happened?
          2. Introducing procedures by way of custom blocks
          3. Setting custom block inputs
          4. Have a go hero – creating a custom block with options
        7. Time for action – coordinating the ball play
          1. What just happened?
        8. Increasing ball speed and difficulty
        9. Time for action – increasing ball speed
          1. What just happened?
          2. Using Boolean evaluations
          3. Keeping score based on a clone's costume
        10. Time for action – decreasing the paddle size based on the clones' costume
          1. What just happened?
          2. Considering alternative solutions
        11. Time for action – detecting when we clear the level
          1. What just happened?
        12. Keeping the score using cloud variables
        13. Time for action – keeping a global scoreboard
          1. What just happened?
          2. Understanding cloud variables in Scratch 2.0
          3. Viewing the cloud data log
          4. Pop quiz – reviewing the chapter's concepts
          5. Have a go hero – extending Breakout
        14. Summary
      15. 8. Chatting with a Fortune Teller
        1. Creating, importing, and exporting lists
        2. Time for action – creating lists to store multiple values
          1. What just happened?
          2. Working with an item in a list
          3. Importing a list
        3. Time for action – importing fortunes to a list
          1. What just happened?
          2. Exporting a list from Scratch
        4. Prompting the player for a question
        5. Time for action – asking a question
          1. What just happened?
          2. Using stored questions
        6. Time for action – validating the seeker's question
          1. What just happened?
          2. Deleting the list values
          3. Have a go hero – finding and using the player's username
          4. Selecting a random fortune
        7. Time for action – selecting a random fortune
          1. What just happened?
        8. Time for action – counting our fortunes with mod
          1. What just happened?
          2. Using magic numbers
          3. Creating a custom say fortune block
        9. Time for action – creating a custom say fortune block
          1. What just happened?
          2. Using the if () then else block
            1. Manipulating the text
        10. Time for action – ensuring grammatically correct questions
          1. What just happened?
          2. Testing your project
        11. Creating a keyword scanner
        12. Time for action – scanning a text string to build a list of words
          1. What just happened?
          2. Have a go hero – creating a more intelligent chat bot
          3. Pop quiz – understanding how to work with text
        13. Summary
      16. 9. Turning Geometric Patterns into Art Using the Pen Tool
        1. Drawing basic shapes
        2. Time for action – drawing our first square
          1. What just happened?
          2. Have a go hero – exploring squares
        3. Time for action – building on the square
          1. What just happened?
          2. Drawing user-defined shapes
        4. Time for action – enabling the user to create custom shapes
          1. What just happened?
        5. Time for action – turning triangles into pinwheels
          1. What just happened?
          2. Have a go hero – adding a stem to the flower
          3. Defining procedures for home and shapes
        6. Time for action – creating a custom shapes procedure
          1. What just happened?
          2. Plotting the coordinates of shapes
        7. Time for action – plotting x,y coordinates to draw a square
          1. What just happened?
        8. Understanding and using color
        9. Time for action – coloring our shapes
          1. What just happened?
          2. Understanding color shades
          3. Working with the set pen color to () block
        10. Time for action – finding a color picker workaround
          1. What just happened?
          2. Finding a color to use by its number
        11. Time for action – creating a color palette
          1. What just happened?
          2. Have a go hero – finding all shades for a color
          3. Adding color slider inputs to the shapes project
        12. Time for action – limiting color values with a slider
          1. What just happened?
          2. Have a go hero – expanding the shapes application
        13. Creating asymmetrical patterns
        14. Time for action – creating an explosion
          1. What just happened?
        15. Turning straight lines into string art
        16. Time for action – animating a radar screen
          1. What just happened?
        17. Time for action – breaking out of the circle
          1. What just happened?
          2. Have a go hero – twisting your perspective
          3. Pop quiz – getting into shape
        18. Summary
      17. A. Connecting a PicoBoard to Scratch 1.4
        1. Using Scratch 1.4, the PicoBoard, and Raspberry Pi
          1. Finding Scratch 1.4
        2. Purchasing the PicoBoard
        3. Time for action – enabling and testing the PicoBoard support in Scratch 1.4
          1. What just happened?
          2. Adding the PicoBoard support to Scratch 2.0
        4. Animating webcam images by detecting sound
        5. Time for action – creating a talking head
          1. What just happened?
          2. Have a go hero – using sound to move a sprite forward and backward
          3. Sharing Scratch 1.4 projects online
          4. Sensing the environment with the PicoBoard
        6. Measuring resistance
        7. Time for action – recording the resistance of a thermistor over time
          1. What just happened?
          2. Completing a circuit
        8. Time for action – charting our measurements
          1. What just happened?
          2. Interpreting the graph
        9. Time for action – revising the graph
          1. What just happened?
          2. Have a go hero – brainstorming data collection topics
          3. Pop quiz – connecting to the real world
        10. Summary
      18. B. Pop Quiz Answers
        1. Chapter 2, A Quick Start Guide to Scratch
          1. Pop quiz – getting started with scratch
        2. Chapter 3, Creating an Animated Birthday Card
          1. Pop quiz – reviewing the chapter
        3. Chapter 4, Creating a Scratch Story Book
          1. Pop quiz – reviewing the chapter
        4. Chapter 5, Creating a Multimedia Slideshow
          1. Pop quiz – reviewing the chapter
        5. Chapter 6, Making an Arcade Game – Breakout (Part I)
          1. Pop quiz – reviewing the chapter
        6. Chapter 9, Turning Geometric Patterns into Art Using the Pen Tool
          1. Pop quiz – getting into shape
        7. Appendix A, Connecting a PicoBoard to Scratch 1.4
          1. Pop quiz – connecting to the real world
      19. Index