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

Checking collisions in the Box2D world


The Box2D physics library calculates all collisions automatically. Imagine now that we set up a ground body as the destination. Players win when they successfully move the car to hit the destination. As Box2D already calculates all collisions, all we have to do is get the detected collision list and determine whether our car has hit the destination ground.