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.

Get HTML5 Game Development by Example : Beginner's Guide - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.