Book Image

Libgdx Cross-platform Game Development Cookbook

Book Image

Libgdx Cross-platform Game Development Cookbook

Overview of this book

Table of Contents (20 chapters)
Libgdx Cross-platform Game Development Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Introducing Box2D


Box2D is a physics engine that simulates realistic physical interactions between the bodies in your scene and allows you to interact with the objects by applying forces too. It was originally written in C++, but the Libgdx team made a thin Java wrapper which makes calls to the underlying C++ code.

Box2D's strengths have not gone unnoticed and hence it has a favorable reputation within the industry. Important physics-based games such as Angry Birds make use of this framework. Its author is Erin Catto who has worked in projects as renowned as Diablo 3.

This recipe is necessary to avoid putting the cart before the horse, so foundations are laid and we can focus on useful real-life physics situations along with the upcoming recipes.

Getting ready

You must add Box2D to your project as an extension in order to make use of its API. The process is described in the Updating and managing project dependencies recipe from Chapter 1, Diving into Libgdx. In your root folder where your projects...