O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

HTML5 Game Development with ImpactJS

Book Description

With basic knowledge of JavaScript, CSS, and HTML you could soon be designing and selling your own 2D games. This book takes you through the whole process using the ImpactJS engine. A fun, involving guide.

  • A practical hands-on approach to teach you how to build your own game from scratch.
  • Learn to incorporate game physics.
  • How to monetize and deploy to the web and mobile platforms.

In Detail

ImpactJS is a JavaScript library specially geared towards building 2-dimensional games. It is intuitive and versatile and allows the game developer to get results in no time while keeping an easy overview when games grow more complex. Games built with ImpactJS can be published on websites and even as an app on both Android and iOS.

With "HTML5 Game Development with ImpactJS", building games for the Web and app markets has never been so easy. Using the ImpactJS JavaScript engine, you only need this book and basic knowledge of JavaScript in order to build and publish your own game.

"HTML5 Game Development with ImpactJS" allows a single person to build a full game. Using only basic knowledge of JavaScript and this book, you will end up publishing a 2D game for the entire world to enjoy. You will learn to set up a working environment and gather all the necessary tools and resources your game needs. Develop both a top-down and a side scroller game, integrate physics such as gravity, and deploy your game as an app or to your website.

Table of Contents

  1. HTML5 Game Development with ImpactJS
    1. Table of Contents
    2. HTML5 Game Development with ImpactJS
    3. Credits
    4. Foreword
    5. About the Authors
    6. About the Reviewers
    7. www.PacktPub.com
      1. Support files, eBooks, discount offers and more
        1. Why Subscribe?
        2. Free Access for Packt account holders
    8. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Downloading the example code
        2. Errata
        3. Piracy
        4. Questions
    9. 1. Firing Up Your First Impact Game
      1. Installing a XAMPP server
      2. Installing the game engine: ImpactJS
      3. Choosing a script editor
      4. Running the premade game
      5. Debugging your game with the browser and ImpactJS
        1. Debugging with the browser
          1. Firebug – the Firefox debugger
          2. Chrome debugger
          3. Exercises in debugging with Chrome and Firebug
        2. Debugging with ImpactJS
      6. Which helpful tools are out there
        1. Ejecta
        2. AppMobi
        3. PhoneGap
        4. lawnchair
        5. Scoreoid
        6. Playtomic
        7. one.com webhost
      7. Summary
    10. 2. Introducing ImpactJS
      1. Building your own levels
        1. Creating, loading, and saving levels in Weltmeister
        2. Layers and the z axis
        3. Adding and removing entities and objects
        4. The collision layer
        5. Connecting two different levels
      2. Objects – playable and non-playable characters
        1. The ImpactJS entity
        2. Setting up player controls
        3. Position, acceleration, and speed
        4. The game's graphics: sprites and animation sheets
        5. Spawning, health, and death
      3. The camera view
        1. The game canvas
        2. Free to move camera
        3. Automatically following camera
      4. Adding music and sound effects
        1. Playing background music
        2. Introducing sound effects
      5. Game physics with Box2D
        1. Gravity and force
        2. Collision impact and bounciness
      6. Summary
    11. 3. Let's Build a Role Playing Game
      1. The RPG game setting
      2. Building an RPG level
      3. Adding a playable character
      4. Introducing a defeatable opponent
      5. Giving the player some weapons
        1. Spawning a projectile
        2. Causing harm with a projectile
      6. Bringing your NPCs to life with artificial intelligence
        1. The NPC's behavior
        2. The NPC's decision making process
      7. Pickup items to help out your player
        1. Healing your player with a potion
        2. Becoming rich with coins
      8. Keeping score for player feedback
      9. Transitioning from one area to another
      10. NPCs and conversation
        1. The speech balloon
        2. Adding a talking non-playable character
      11. The final battle
      12. Summary
    12. 4. Let's Build a Side Scroller Game
      1. The side scroller game setting
        1. Preparing the game for Box2D
      2. Building a side scroller level
      3. The playable character
      4. Adding a minor foe
      5. Introducing formidable weapons
        1. Shooting a projectile
        2. Building an actual bomb
      6. Artificial intelligence
      7. Pickup items
        1. Adding a normal crate
        2. Implementing a healing crate
      8. Keeping score
      9. Transitioning from one level to another
      10. The final battle
      11. Summary
    13. 5. Adding Some Advanced Features to Your Game
      1. The Start and Game-over screen
        1. The game's Start screen
        2. The Victory and Game-over screens
        3. More advanced debugging options
        4. Short introduction to unit testing
        5. Adding your own debug panel to the ImpactJS debugger
      2. Handling game data
        1. Adding data to your game
        2. Using cookies to store data on the player's computer
        3. Local storage
        4. Using lawnchair as a versatile way of storing data
      3. Extra functionalities for the RPG
        1. Moving the player with a mouse click
        2. Adding intelligent spawn locations
        3. Introducing basic conversation
        4. Adding a basic Head-Up Display
      4. Artificial intelligence: The hive mind
      5. Implementing Playtomic for game analytics
      6. Summary
    14. 6. Music and Sound Effects
      1. Making or buying the music
      2. Buying tunes and sound effects
      3. Making a basic tune using FL Studio
      4. Adding background music to your game
      5. Playing a sound when an action has happened
      6. Tips when using sound files in your game
      7. Summary
    15. 7. Graphics
      1. Making/buying the graphics
      2. Where to buy graphics
      3. Introduction to vector graphics
      4. Creating your own avatar using Adobe Photoshop
      5. Adding your creation to the RPG
      6. Hints for graphics in HTML5
      7. Summary
    16. 8. Adapting Your HTML5 Game to the Distribution Channels
      1. Preparing your game for the web browser
      2. Preparing our game for mobile web browsers
      3. Turning the game into a web app for the Google Chrome Web Store
      4. Pushing your game to Android's Google play store
      5. Making your game available on Facebook
      6. Direct canvas game acceleration with AppMobi
      7. Summary
    17. 9. Making Money with Your Game
      1. Your game development strategy
      2. Making money with game apps
        1. Google Play
        2. iOS App Store
        3. The Chrome Web Store
      3. In-game advertising
      4. Selling distribution rights with MarketJS
      5. Summary
    18. Index