Preface
Scratch offers a fun way of getting introduced to programming and interactive media design. Within minutes of starting the program, you can see the first results of your work. Visual feedback comes early and often, making high-level, abstract concepts a lot easier to understand.
Even without a specific plan in mind, it's fun to play and experiment with the software. You are always discovering and learning something new, and even failed projects can have funny or spectacular results.
Since Version 2.0, Scratch has moved from a desktop application to an online interface. Scratch 2.0 also includes many new and exciting features, which makes creating more advanced games possible.
This book presents a series of fully-realized interactive projects to work on. It will teach you how to build great games with lots of depth. The final results will be close to production level games. This book not only introduces you to the new features of Scratch 2.0, but also introduces you to interactive media design in general. You can take the lessons learned here and apply them to create games with tool sets other than Scratch.
We hope you enjoy working on the projects in this book. May they inspire you to create even better games!
What this book covers
Project 1, Blowing Things Up!, builds a simple game involving a cannon and some targets. You will learn about placing sprites, building scripts, and setting the game in motion.
Project 2, Beating Back the Horde, teaches you how to create multiple enemies and how to move them along a predefined path. You will also learn about drag-and-drop and click mouse controls.
Project 3, Start Your Engines, shows you how to build a keyboard controlled game. The game will showcase simple collisions between objects and how to handle them. You will also learn to create and use a timer.
Project 4, Space Age, shows you how to build a game that is extensive and configurable in terms of level of difficulty. This game comes complete with spaceship, shield, scoreboard, enemy, and an ample supply of ammunition.
Project 5, Shoot 'Em Up, shows you how to build a fast-paced action game with waves of enemies to defeat. You will learn about setting up movement patterns and speeds for both the player character and enemies.
Project 6, Building a Worthy Boss, shows you how to finish your side-scrolling shooter with a memorable boss encounter. You will learn to design an epic finish for a game level.
Project 7, Creating a Level Editor, teaches you how to create a tile editor and automatically build tile-based maps with it.
Project 8, Dungeon Crawl, involves you using the tile editor from the previous project to build an action RPG. You will also learn how to create multiple levels and different enemies.
Project 9, Hunger Run, shows you how to build a fast-paced auto-scrolling platform game. This project explains how horizontal and vertical scrolling work.
Project 10, Sprites with Characters, will dive into creating complex sprites using Scratch 2.0's vector editor. Piece by piece, we will build a robot and add animation scripts. The finished sprite can be imported to other Scratch projects.
Appendix, The New Scratch Interface, will give you an overview of the new Scratch 2.0 interface and will show you some of the new features you can play with.
What you need for this book
To complete the projects in this book, you will need one or more of the following tools:
You will at least need the Scratch 2.0 online editor (www.scratch.mit.edu).
Or alternatively the Scratch 2.0 offline editor (http://scratch.mit.edu/scratch2download/).
To use the Scratch editors, you'll need Flash Player installed on your computer (http://get.adobe.com/flashplayer/).
An image editor will come in handy when creating sprites. We can recommend a few different ones, but you can use any digital drawing tool you are comfortable with:
Photoshop Elements (http://www.adobe.com/products/photoshop-elements.html) or GIMP (http://www.gimp.org/).
Who this book is for
You are interested in video games. You enjoy playing games and are curious to know how games work. You have dreamed about creating your own game for some time but are not sure where to start. If you would like to become a game designer or programmer, but are not yet sure if it is the proper career for you, then this book can help you get started. With practical examples, we teach you how to build your own games. Along the way, you will learn how to design and build a video game. You will be introduced to basic programming principles and you will learn how to make digital drawings. All the steps to build the projects described are explained in detail. You will need to be somewhat comfortable with using a computer, but no expert knowledge is required.
Conventions
In this book, you will find several headings that appear frequently.
To give clear instructions of how to complete a procedure or task, we use:
Mission briefing
This section explains what you will build, with a screenshot of the completed project.
Why is it awesome?
This section explains why the project is cool, unique, exciting, and interesting. It describes what advantage the project will give you.
Your Hotshot objectives
This section explains the eight major tasks required to complete your project.
Task 1
Task 2
Task 3
Task 4
Task 5
Task 6
Task 7
Task 8
Mission checklist
This section explains any prerequisites for the project, such as resources or libraries that need to be downloaded, and so on.
Task 1
This section explains the task that you will perform.
Prepare for lift off
This section explains any preliminary work that you may need to do before beginning work on the task.
Engage thrusters
This section lists the steps required in order to complete the task.
Objective complete – mini debriefing
This section explains how the steps performed in the previous section allow us to complete the task. This section is mandatory.
Classified intel
This section provides some extra information relevant to the task.
You will also find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.
Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "It should be obvious that the scoreRed
variable is meant for a red starfish."
A block of code is set as follows:
New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "We start the program with the when <green flag> clicked block."
We have indicated the green flag icon that appears on the screen as a <green flag> tag in the entire book.
Note
Warnings or important notes appear in a box like this.
Tip
Tips and tricks appear like this.
Reader feedback
Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.
To send us general feedback, simply send an e-mail to <feedback@packtpub.com>
, and mention the book title via the subject of your message.
If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.
Customer support
Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.
Downloading the example code
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.
Downloading the color images of this book
We also provide you a PDF file that has color images of the screenshots/diagrams used in this book. The color images will help you better understand the changes in the output. You can download this file from https://www.packtpub.com/sites/default/files/downloads/7569OT_Graphics.pdf
Errata
Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.
Piracy
Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.
Please contact us at <copyright@packtpub.com>
with a link to the suspected pirated material.
We appreciate your help in protecting our authors, and our ability to bring you valuable content.
Questions
You can contact us at <questions@packtpub.com>
if you are having a problem with any aspect of the book, and we will do our best to address it.