Setting up LibGDX with Box2D

Right, we need a LibGDX project that has Box2D support. The question is, how do we go ahead and create that? Well, the eagle-eyed among you will have noticed that Box2D was a selectable option in the project setup application we used previously and in fact it will have been already preselected!

Setting up LibGDX with Box2D

The preceding partial screenshot of the setup application shows what you see when you rerun the application.

Set up the application like we have done so previously, but with Box2D ticked, and then we are good to go!

Code reuse

Next, before we dive into Box2D, let's reuse some code from our previous projects.

Firstly, we should update ...

Get LibGDX Game Development By Example 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.