Playground Scripts
Playground scripts let you experiment with JavaScript programing without having to retype code, hunt down missing pieces, or create your own graphics. Each asset you need to run the script in your browser (the latest Google Chrome is recommended) is included with the example.
The scripts on this page are described in the book The Gamer's Guide to Coding, many with step-by-step explanations of what's going on in the code, and how it works. The downloads are organized by chapter for your convienence. All code is open source and provided under the Creative Commons 4.0 Sharealike license.
Downloading
All code is provided in zip archive file format for easy downloading. Each zip may contain one or more constituent files inside it. To use these files, the archive must be unzipped to a new folder. Modern operating systems, including Windows and Macintosh OS X, provide their own built-in means for unzipping archive files. Refer to the online help for your operating system for the exact details. Be sure to unzip the files to a folder where you have full user access rights. Otherwise you may not be able to save the files or make changes to them.
PART ONE: GETTING STARTED
- Chapter 1 > Starting at Square One: Setting Up Shop
- Chapter 2 > A Closer Look at HTML Script Pages
- Chapter 3 > Writing Your First Game Script
- Chapter 4 > Common HTML Elements and What They Do
PART TWO: LEARNING THE ROPES
- Chapter 5 > Getting Started with JavaScript—Part 1
- Chapter 6 > Getting Started with JavaScript—Part 2
- Chapter 7 > Controlling the Look of Your Games with Styles
- Chapter 8 > Responding to Events—Part 1
- Chapter 9 > Using Graphics
- Chapter 10 > Writing Code That Thinks
- Chapter 11 > Working with the Document Object Model (DOM)
- Chapter 12 > Responding to Events—Part 2
- Chapter 13 > Making Your Game Move: An Overview of Animation Techniques
PART THREE: STEPPING UP YOUR GAME
- Chapter 14 > Creating Motion with CSS Transitions
- Chapter 15 > Creating Motion with CSS Animations
- Chapter 16 > Adding Clocks and Timers
- Chapter 17 > Extended Animation Techniques
- Chapter 18 > Using Numbers and Math in Games
- Chapter 19 > Adding Sound
- Chapter 20 > Fixing Errors: Troubleshooting and Debugging