Book Image

HTML5 Game Development by Example: Beginner's Guide

By : Seng Hin Mak
Book Image

HTML5 Game Development by Example: Beginner's Guide

By: Seng Hin Mak

Overview of this book

Table of Contents (18 chapters)
HTML5 Game Development by Example Beginner's Guide Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
9
Building a Physics Car Game with Box2D and Canvas
Index

Summary


You learned a lot in this chapter about using the Box2D physics engine to create a car adventure game in canvas.

Specifically, we set up the game with the JavaScript physics engine. Then, we created static and dynamic bodies in the physics world. We set up the car by using joints to constrain bodies and wheels. We controlled the car with keyboard inputs by adding force to it. At last, we determined game-over and level-up by adding collisions in the physics world. We have now learned how to use the Box2D physics library to create a canvas-based physics game.

In the next chapter, we are going to discuss different distribution channels and put our game into a native Mac application.