laying video games is fun, but programming your own video games is a creative, challenging skill that will let you make your own fun. The free Scratch programming environment gives everyone an easy way to learn programming skills. While Scratch is primarily designed for 8- to 16-year-olds, it’s used by people of all ages, including younger children with their parents and college students learning their first programming language.
There’s so much that you can do with Scratch, it’s hard to know where to start. That’s where this book comes in. This book guides you through creating several video games in Scratch. By building the projects in this book, you’ll get a good idea of which blocks are commonly used to create video games in Scratch. These projects provide a solid foundation for you to build upon when creating your own original programs.
No previous programming experience is necessary to read this book. The only mathematics skills required are basic arithmetic: addition, subtraction, multiplication, and division. Don’t let math phobia prevent you from learning to program. And don’t forget that the computer will perform calculations for you!
Each program in the book is easy to make by following the step-by-step instructions. You’ll learn about the code blocks and programming concepts as you make games that use them. No matter your skill level, there’s no reason you can’t start reading this book now.
Kids can follow along with the activities on their own, but this book is also for parents, teachers, and volunteers who want to introduce their children or students to the world of programming. The projects are ideal for a weekend activity or afterschool computer club. Adults don’t have to be software engineers to use this book to help others learn.
If you want a thorough guide to all of Scratch’s features, you can watch video tutorials online at https://scratch.mit.edu/help/videos/ and https://inventwithscratch.com/. I also recommend the book 25 Scratch 3 Games by Max Wainewright (No Starch Press, 2019) at https://nostarch.com/25scratchgames/.
But programming is a hands-on skill like karate or guitar: you can’t learn it by reading alone. Make sure you’re following along and creating the games—you’ll learn a lot more that way.
Each chapter walks you through programming a single game, and programming concepts are explained as they come up. You’ll start by sketching out what the final game will look like and planning the main parts of the parts of the program. The sections that follow will cover how to code each of these parts step-by-step until you’ve built the full game. After building the main game, you’ll have the option of adding special features and cheat modes. Review questions at the end of each chapter help you check whether you understand the topics covered.
All of the book’s projects start with a sketch of the game we’ll make. The labels on the sketch point to features that we’ll add to the game with code.
To keep things manageable, we’ll tackle each game one part at a time. The blue ABC headings in the book correspond to these features in the sketch.
Splitting a big problem into a bunch of little problems can really help organize your thinking and make a big problem feel approachable. After we get a simple version of the game up and running, we’ll add new features, cheat codes, and more. When you’re ready to start creating games yourself, I recommend starting with a simple sketch.
Although the Scratch environment includes many images, you’ll need some extra files to make the projects in this book. These files are in the resources ZIP file, which you can download from https://www.nostarch.com/scratch-playground2e/. You’ll need to unzip the files to your hard drive to access them.
The resources ZIP file contains the image files used in the book’s projects and the skeleton project files for each of the programs. These skeleton project files have all the setup steps already completed and require you only to add the code blocks. If you are having trouble finishing your program, you can try starting from the skeleton project file instead of a new, blank project. Using the skeleton project files may be a good idea if you are a teacher who is coaching several students and time is limited, because they’ll only have to add the code blocks to complete the program.
While we’ve done our best to keep this book error-free, corrections and updates for this book will be listed at https://nostarch.com/scratch3playground/.