Scratch 3 Programming Playground

Book description

Scratch, the colorful drag-and-drop programming language, is used by millions of first-time learners worldwide. Scratch 3 features an updated interface, new programming blocks, and the ability to run on tablets and smartphones, so you can learn to code on the go.

In Scratch 3 Programming Playground, you’ll learn to code by making cool games. Get ready to destroy asteroids, shoot hoops, and run mazes! Each game includes easy-to-follow instructions with full-color images, review questions, and creative coding challenges. Want to add more levels or a cheat code? No problem, just write some code.

You’ll learn to make games like:

•Maze Runner, a maze navigation challenge
•Rainbow Lines, a dazzling animation program
•Asteroid Breaker, a space adventure game
•Basketball, a gravity-based game of hoops
•Brick Breaker, a remake of Breakout, the brick-breaking classic
•Platformer, a game inspired by Super Mario Bros.

Learning how to program shouldn’t be dry and dreary. With Scratch 3 Programming Playground, you’ll make a game of it!

Uses Scratch 3

Table of contents

  1. Cover
  2. Titlepage
  3. PRAISE FOR SCRATCH PROGRAMMING PLAYGROUND
  4. Copyright
  5. Dedication
  6. About the Author
  7. About the Technical Reviewer
  8. Acknowledgments
  9. Introduction
    1. Who This Book Is For
    2. About This Book
    3. How to Use This Book
    4. Online Resources
    5. Errata and Updates
  10. Chapter 1: Getting Started with Scratch
    1. Running Scratch
    2. Scratch Desktop: The Offline Editor
    3. The Scratch Editor and Sprites
    4. The Paint Editor
    5. Working with Code Blocks
      1. Adding Blocks
      2. Deleting Blocks
    6. Running Programs
    7. Showing Off Your Programs
    8. Getting Help
      1. The Tutorials Window
      2. The See Inside Button
    9. Summary
  11. Chapter 2: Rainbow Lines . . . in Space!
    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. 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. Summary
  12. Chapter 3: Maze Runner
    1. Sketch Out the Design
    2. A. Make the Cat Walk Around
      1. 1. Add Movement Code to the Player Sprite
      2. 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. 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
    9. Summary
  13. Chapter 4: Shooting Hoops with Gravity
    1. Sketch Out the Design
    2. A. Make the Cat Jump and Fall
      1. 1. Add the Gravity Code to the Cat Sprite
      2. 2. Add the Ground-Level Code
      3. 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. Cheat Mode: Freeze the Hoop
    8. Summary
  14. Chapter 5: A Polished Brick Breaker Game
    1. Sketch Out the Design
    2. A. Make a Paddle That Moves Left and Right
      1. 1. Create the Paddle Sprite
    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
    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
  15. Chapter 6: Asteroid Breaker . . . in Space!
    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
  16. Chapter 7: Making an Advanced Platformer
    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
  17. Where to Go From Here
  18. Index

Product information

  • Title: Scratch 3 Programming Playground
  • Author(s): Al Sweigart
  • Release date: January 2021
  • Publisher(s): No Starch Press
  • ISBN: 9781718500211