You are previewing Scratch Programming Playground.
O'Reilly logo
Scratch Programming Playground

Book Description

Scratch Programming Playground is a kid-friendly introduction to coding where readers use Scratch to make their own computer games.

Table of Contents

    1. Who This Book Is For
    2. About This Book
    3. How to Use This Book
    4. Online Resources
    5. Errata and Updates
    1. Running Scratch
    2. The Offline Editor
    3. The Scratch Editor and Sprites
    4. The Paint Editor
    5. Working with Code Blocks
      1. Adding Blocks
      2. Deleting Blocks
      3. Running Programs
    6. Showing Off Your Programs
    7. Getting Help
      1. The Tips Window
      2. The See Inside Button
    8. Summary
    1. Sketch Out the Design
    2. A. Create the Space Backdrop
      1. 1. Clean Up and Set the Stage
    3. B. Create Three Bouncing Dots
      1. 2. Paint the Dot
      2. 3. Add Code for the Dot 1 Sprite
      3. Explore: Directions and Degrees
      4. 4. Duplicate the Dot 1 Sprite
    4. C. Draw the Rainbow Lines
      1. 5. Add the Code for the Drawing Dot Sprite
    5. The Complete Program
    6. Turbo Mode
    7. Version 2.0: Rainbow Triangles
    8. Version 3.0: Two Rainbow Lines
    9. Version 4.0: You Decide!
    10. Summary
    11. Review Questions
    1. Sketch Out the Design
    2. A. Make the Cat Walk Around
      1. Explore: X- and Y-Coordinates
      2. 1. Add Movement Code to the Player Sprite
      3. 2. Duplicate the Movement Code for the Cat Sprite
    3. B. Make the Maze Levels
      1. 3. Download the Maze Images
      2. 4. Change the Backdrop
      3. 5. Start at the First Maze
    4. C. Keep the Cat from Walking Through Walls
      1. 6. Check Whether the Cat Is Touching the Walls
    5. D. Make a Goal at the End of the Maze
      1. 7. Create the Apple Sprite
      2. 8. Detect When the Player Reaches the Apple
      3. 9. Add the Broadcast Handling Code to the Maze Sprite
    6. The Complete Program
    7. Version 2.0: Two-Player Mode
      1. Duplicate the Apple Sprite
      2. Modify the Apple2 Sprite’s Code
      3. Duplicate the Orange Cat Sprite
      4. Modify the Code for the Blue Cat Sprite
      5. Go Back to the Starting Position
    8. Version 3.0: Traps
      1. Draw a New Sprite for the Traps
      2. Create a Second Costume for the Traps
      3. Add Cloning Code for the Traps
      4. Modify the Orange Cat Code
      5. Copy the Code from Orange Cat to Blue Cat
    9. Cheat Mode: Walk Through Walls
      1. Add the Walk-Through-Walls Code to Orange Cat
      2. Add the Walk-Through-Walls Code to Blue Cat
    10. Summary
    11. Review Questions
    1. Sketch Out the Design
    2. A. Make the Cat Jump and Fall
      1. 1. Add the Gravity Code to the Cat Sprite
      2. Explore: For All Sprites vs. For This Sprite Only
      3. 2. Add the Ground Level Code
      4. 3. Add the Jumping Code to the Cat Sprite
    3. B. Make the Cat Move Left and Right
      1. 4. Add the Walking Code to the Cat Sprite
    4. C. Make a Hovering Basketball Hoop
      1. 5. Create the Hoop Sprite
      2. 6. Create the Hitbox Sprite
    5. D. Make the Cat Shoot Hoops
      1. 7. Create the Basketball Sprite
      2. 8. Add the Code for the Basketball Sprite
      3. 9. Detect Whether a Basket Is Made
      4. 10. Fix the Scoring Bug
    6. The Complete Program
    7. Version 2.0: Two-Player Mode
      1. Duplicate the Cat and Basketball Sprites
      2. Modify the Code for the Cat2 Sprite
      3. Modify the Code for the Basketball2 Sprite
    8. Cheat Mode: Freeze the Hoop
    9. Summary
    10. Review Questions
    1. Sketch Out the Design
    2. A. Make a Paddle That Moves Left and Right
      1. 1. Create the Paddle Sprite
      2. Explore: Rotation Styles
    3. B. Make a Ball That Bounces Off the Walls
      1. 2. Create the Tennis Ball Sprite
    4. C. Make the Ball Bounce Off the Paddle
      1. 3. Add the Bounce Code to the Tennis Ball Sprite
      2. Explore: Cloning
    5. D. Make Clones of the Brick
      1. 4. Add the Brick Sprite
      2. 5. Clone the Brick Sprite
    6. E. Make the Ball Bounce Off Bricks
      1. 6. Add the Bounce Code to the Brick Sprite
    7. F. Make “You Win” and “Game Over” Messages
      1. 7. Modify the Tennis Ball Sprite’s Code
      2. 8. Create the Game Over Sprite
      3. 9. Create the You Win Sprite
    8. The Complete Program
    9. Version 2.0: Polishing Time
      1. Draw a Cool Backdrop
      2. Add Music
      3. Make the Paddle Flash When Hit
      4. Add an Animated Entrance and Exit to the Bricks
      5. Add a Sound Effect to the Brick Exit
      6. Add a Sound Effect to the Tennis Ball
      7. Add a Trail Behind the Tennis Ball
      8. Add an Animated Entrance for the Game Over Sprite
      9. Add an Animated Entrance for the You Win Sprite
    10. Summary
    11. Review Questions
    1. Sketch Out the Design
    2. A. Make a Snake Head That Moves Around
      1. 1. Create the Head Sprite
      2. Explore: when key pressed vs. if key pressed? then
    3. B. Make Apples Appear
      1. 2. Add the Apple Sprite
    4. C. Make a Body That Appears Behind the Snake Head
      1. 3. Create the Body Sprite
      2. 4. Create the Body Sprite’s Second Costume
      3. 5. Add the Code for the Body Sprite
      4. 6. Detect Whether the Snake Crashes into Itself or a Wall
    5. The Complete Program
    6. Version 2.0: Add Bonus Fruit
    7. Cheat Mode: Invincibility
      1. Modify the Head
      2. Modify the Body Code
    8. Cheat Mode: Chop Off Your Tail!
    9. Summary
    10. Review Questions
    1. Sketch Out the Design
    2. A. Make the Start Screen Backdrop
      1. 1. Draw the Backdrops
      2. 2. Add the Code for the Stage
    3. B. Make the Slice Trail
      1. 3. Draw the Slice Sprite
      2. Explore: Making Lists
      3. 4. Create Lists and Variables for the Slice Sprite
      4. 5. Record the Mouse Movements
      5. 6. Make a Custom Block to Draw the Slice
    4. C. Make the Begin Button
      1. 7. Create the Begin Button Sprite
    5. D. Make the Fruit and Bombs Throw Themselves
      1. 8. Create the Fruit Sprite
      2. 9. Make the Sliced Fruit Costumes
      3. 10. Add the Code to the Fruit Sprite
      4. 11. Add the Code for the Fruit Sprite’s Clones
    6. E. Make the Health Sprites
      1. 12. Create the Health Sprite
    7. F. Make the Game’s Ending
      1. 13. Create the White Fade Out Sprite
    8. Version 2.0: High Score
    9. Cheat Mode: Recover Health
    10. Summary
    11. Review Questions
    1. Sketch Out the Design
    2. A. Make a Spaceship That Is Pushed Around
      1. 1. Create the Spaceship Sprite
    3. B. Make the Spaceship Wrap Around the Edges
      1. 2. Add the Wrap-Around Code to the Spaceship Sprite
      2. 3. Add the Random-Push Code to the Spaceship Sprite
    4. C. Aim with the Mouse and Fire with the Spacebar
      1. 4. Create the Energy Blast Sprite
    5. D. Make Asteroids That Float Around
      1. 5. Create the Asteroid Sprite
    6. E. Make Asteroids Split in Two When Hit
      1. 6. Add the Asteroid’s Splitting Code
      2. 7. Add the Asteroid Blasted Message Code to the Energy Blast Sprite
    7. F. Keep Score and Make a Timer
      1. 8. Create the Out of Time Sprite
    8. G. Make the Spaceship Explode If It Is Hit
      1. 9. Upload the Explosion Sprite
      2. 10. Add the Code for the Explosion Sprite
      3. 11. Add the Explode Code to the Spaceship Sprite
    9. Version 2.0: Limited Ammo
    10. Cheat Mode: Starburst Bomb
    11. Summary
    12. Review Questions
    1. Sketch Out the Design
    2. A. Create Gravity, Falling, and Landing
      1. 1. Create the Ground Sprite
      2. 2. Add the Gravity and Landing Code
      3. 3. Make the Cat Walk and Wrap Around the Stage
      4. 4. Remove the Ground Lift Delay
    3. B. Handle Steep Slopes and Walls
      1. 5. Add the Steep Slope Code
    4. C. Make the Cat Jump High and Low
      1. 6. Add the Jumping Code
    5. D. Add Ceiling Detection
      1. 7. Add a Low Platform to the Ground Sprite
      2. 8. Add the Ceiling Detection Code
    6. E. Use a Hitbox for the Cat Sprite
      1. 9. Add a Hitbox Costume to the Cat Sprite
      2. 10. Add the Hitbox Code
    7. F. Add a Better Walking Animation
      1. 11. Add the New Costumes to the Cat Sprite
      2. 12. Create the Set Correct Costume Block
    8. G. Create the Level
      1. 13. Download and Add the Stage Backdrop
      2. 14. Create a Hitbox Costume for the Ground Sprite
      3. 15. Add the Ground Sprite’s Code
      4. 16. Add More Wrap-Around Code to the Cat Sprite
    9. H. Add Crab Enemies and Apples
      1. 17. Add the Apple Sprite and Code
      2. 18. Create the Crab Sprite
      3. 19. Create the Enemy Artificial Intelligence
      4. 20. Add the Time’s Up Sprite
    10. Summary
    11. Review Questions