You are previewing The Web Game Developer’s Cookbook: Using JavaScript and HTML5 to Develop Games.

The Web Game Developer’s Cookbook: Using JavaScript and HTML5 to Develop Games

Cover of The Web Game Developer’s Cookbook: Using JavaScript and HTML5 to Develop Games by Evan Burchard Published by Addison-Wesley Professional
  1. Title Page
  2. Copyright Page
  3. Praise for The Web Game Developer’s Cookbook
  4. Dedication Page
  5. Contents
  6. Preface
  7. Acknowledgments
  8. About the Author
  9. Introduction
    1. Audience for This Book
    2. Coding Style Conventions Used In This Book
    3. How This Book Is Organized
    4. How To Use This Book
  10. Chapter 1. Quiz
    1. Recipe: Making the Questions
    2. Recipe: Hiding and Showing Your Quiz
    3. Recipe: Getting Your Questions Back
    4. Recipe: The Shopping List
    5. Recipe: Which Answers Are Correct?
    6. Summary
  11. Chapter 2. Interactive Fiction
    1. Recipe: Styled Pages
    2. Recipe: Goto Page
    3. Recipe: Adding an Inventory with Drag and Drop
    4. Recipe: Adding Complex Interactions
    5. Recipe: Breadcrumb Trail
    6. Recipe: A Dramatic Ending
    7. Summary
  12. Chapter 3. Party
    1. Recipe: Creating a Sample Game in atom.js
    2. Recipe: Drawing with Canvas
    3. Recipe: Drawing Holes
    4. Recipe: Drawing a Mole
    5. Recipe: Putting the Moles in the Holes
    6. Recipe: Dynamic Mole Peeking
    7. Recipe: Bopping Moles
    8. Wallowing in Despair with HTML5’s <audio> tag
    9. Summary
  13. Chapter 4. Puzzle
    1. Recipe: Rendering with easel.js
    2. Recipe: Rendering More Than One Thing
    3. Recipe: Creating Pairs
    4. Recipe: Matching and Removing Pairs
    5. Recipe: Hiding and Flipping the Pictures
    6. Recipe: Winning and Losing
    7. Recipe: Caching and Performance
    8. Recipe: Matching Pairs Instead of Duplicates
    9. Summary
  14. Chapter 5. Platformer
    1. Getting Started with melon.js
    2. Recipe: Creating a Tiled Map
    3. Recipe: Starting the Game
    4. Recipe: Adding a Character
    5. Recipe: Building a Collision Map
    6. Recipe: Walking and Jumping
    7. Recipe: Title Screen
    8. Recipe: Adding Collectables
    9. Recipe: Enemies
    10. Recipe: Powerups
    11. Recipe: Losing, Winning, and Information
    12. Summary
  15. Chapter 6. Fighting
    1. Recipe: Getting Started with game.js
    2. Recipe: Accessing Individual Sprites from a Spritesheet
    3. Recipe: Handling Input from Two Players
    4. Recipe: Moving and Changing Forms
    5. Recipe: Nonblocking Input
    6. Recipe: Implementing Bitmasks
    7. Recipe: Masking Collisions
    8. Recipe: Giving and Taking Damage
    9. Summary
  16. Chapter 7. Shooter
    1. Some Background Info on Rendering
    2. Recipe: Getting Started with gameQuery
    3. Recipe: Adding “Enemies”
    4. Recipe: Making Your Ship
    5. Recipe: Enemy Collisions
    6. Recipe: Shooting
    7. Recipe: Powerups
    8. Summary
  17. Chapter 8. FPS
    1. Recipe: Getting Started with Jaws
    2. Recipe: Creating a 2-D Map
    3. Recipe: Adding a Player
    4. Recipe: Raycasting Top View
    5. Recipe: Fake 3D with Raycasting
    6. Recipe: Adding a Camera
    7. Recipe: Making the World a More Photogenic Place
    8. Recipe: Adding a Friend or Foe
    9. Summary
  18. Chapter 9. RPG
    1. Recipe: Getting Started with enchant.js
    2. Recipe: Creating a Map
    3. Recipe: Adding the Player
    4. Recipe: Adding a Collision Layer
    5. Recipe: Status Screen
    6. Recipe: Talking to NPCs
    7. Recipe: Creating an Inventory
    8. Recipe: Creating a Shop
    9. Recipe: Creating a Battle Interface
    10. Recipe: Saving Your Game with HTML5’s Local Storage API
    11. Summary
  19. Chapter 10. RTS
    1. We Need a Server
    2. Recipe: Getting Node
    3. Recipe: Real Time with
    4. Recipe: Creating an Isometric Map with crafty.js
    5. Recipe: Drawing the Units
    6. Recipe: Moving Units
    7. Recipe: Player Specific Control and Visibility
    8. Recipe: Collisions for Destruction and Revelation
    9. Summary
  20. Chapter 11. Leveling Up
    1. What Happened?
    2. What’s Next?
  21. Appendix A. JavaScript Basics
    1. Main Types of APIs in JavaScript
    2. Statements
    3. Variables
    4. Strings
    5. Numbers
    6. Arrays
    7. Functions
    8. Objects
    9. Conditionals
    10. Loops
  22. Appendix B. Quality Control
    1. Browser Debugging Tools
    2. Testing
    3. Collaboration for Better Code
  23. Appendix C. Resources
    1. Game Engines
    2. Text Editors
    3. Browsers
    4. Assorted Tools
    5. Art Creation/Finding
    6. Demos and Tutorials
    7. Books
    8. Websites
  24. Index

Chapter 4. Puzzle

In games such as Bejeweled, Snood, and Tetris Attack, the player’s goal is to match up blocks of color as quickly as possible using simple mechanisms to add, remove, move, and switch blocks. This genre is a popular format for casual web games but appears in other places as well.

One unique feature of these games is that they are relatively easy to build. Beyond simplifying their development as standalone games, this also uniquely positions them as puzzles or embeddable minigames in larger form games. On the Super Nintendo console system, Lufia 2 is especially notable for making heavy use of dungeon puzzles involving pushing around colored blocks. A more familiar example might be the Legend of Zelda series, which consistently ...

The best content for your career. Discover unlimited learning on demand for around $1/day.