You are previewing HTML5 Game Programming with enchant.js.
O'Reilly logo
HTML5 Game Programming with enchant.js

Book Description

HTML5 Game Programming with enchant.js gives first-time programmers of all ages the tools to turn their video game ideas into reality. A step-by-step guide to the free, open-source HTML5 and JavaScript engine enchant.js, it is ideally suited for game fans who have always wanted to make their own game but didn't know how. It begins with the foundations of game programming and goes on to introduce advanced topics like 3D.

We live in an age where smartphones and tablets have made games more ubiquitous than ever. Based around HTML5, enchant.js is ideally suited for aspiring game programmers who have always been intimidated by code. Games written using enchant.js take only a few hours to write, and can be played in a browser, iOS, and Android devices, removing the stress of programming to focus on the fun. Discover the joy of game development with enchant.js.

  • Provides a comprehensive, easy guide to game programming through enchant.js

  • Gives aspiring game developers a tool to realize their ideas

  • Introduces readers to the basics of HTML5 and JavaScript programming

What you'll learn

  • Master the basics of HTML5 and JavaScript programming

  • Create a game that can be played on a desktop, iOS, or Android

  • Upload your game to, where you can share it easily

  • Program your own 3D games

  • Grasp the essential concepts of making a compelling and popular game

Who this book is for

HTML5 Game Programming with enchant.js is for aspiring game developers of all ages who have wanted to make their own games but didn't know how. It's for programmers interested in learning the potential of HTML5 through designing games.

Table of Contents

  1. Title Page
  2. Dedication
  3. Contents at a Glance
  4. Contents
  5. About the Authors
  6. About the Technical Reviewer
  7. Acknowledgments
  8. Introduction
  9. CHAPTER 1: Beginning enchant.js Development
    1. Visit the enchant.js Web Sites
    2. Compatibility and Releases
    3. Features of enchant.js
    4. JavaScript, HTML5, and CSS
    5. Making “Hello World!” Appear on the Screen
    6. Create a Skating Bear
    7. Executing on Devices and Uploading to
    8. Conclusion
  10. CHAPTER 2: JavaScript Basics
    1. Summary List
    2. Declare a Variable
    3. Assign a Value to a Variable
    4. Add Variables
    5. Check the Value of a Variable
    6. Manipulate a Variable Using Itself
    7. Manipulate a Variable Using Incrementation
    8. Compare a Variable
    9. See How Similar Two Values Can Be
    10. Manipulate a Comparison
    11. Implement Logic with the If Statement
    12. Create an Object
    13. Work Smarter with the While and For Loop Statements
    14. Interrupt a Loop with Break
    15. Skip a Loop Iteration with Continue
    16. Generate Random Numbers
    17. Define Scenarios with Switch
    18. Store Numbered Data in an Array
    19. Store Non-Numbered Data in an Associative Array
    20. Save Time with Functions
    21. See Where Variables Live
    22. Make Object Blueprints with Prototypes
    23. Conclusion
  11. CHAPTER 3: Basic Features of enchant.js
    1. Summary List
    2. Inheritance
    3. Seeing Elements of a Game
    4. Creating Labels
    5. Creating Sprites
    6. Drawing a Map with a Surface
    7. Using Touch to Interact
    8. Using D-Pads to Interact
    9. Conclusion
  12. CHAPTER 4: Advanced Features of enchant.js
    1. Summary List
    2. Transitioning Between Scenes
    3. Creating a Game with Screens, Time Limits, and Scores
    4. Using Collision Detection
    5. Creating an Interactive Map
    6. Implementing Sound
    7. Conclusion
  13. CHAPTER 5: Game Design
    1. Unbreakable Rules of Mini-Game Development
    2. Game Development Process
    3. Conclusion
  14. CHAPTER 6: Creating an Arcade Shooter
    1. Summary List
    2. Building the Arcade Shooter
    3. Beefing Up the Game
  15. CHAPTER 7: Creating a Stand-Alone 3-D Game
    1. Stand-Alone Games
    2. 3-D Games
    3. Conclusion
  16. APPENDIX A: Class Appendix
    1. Core Classes
    2. gl.enchant.js
    3. ui.enchant.js
  17. Index