How to add Box2D via Planck.js to your Phaser 3 games.

Posted on 3rd Mar 2021. Follow @phaser_ and get the Phaser World newsletter.

image

Emanuele Feronato writes: "I am a long time fan of Box2D physics engine, with almost 200 tutorials on this blog, most using old AS3, about 10 Flash games and five star book on Amazon.

Unfortunately Phaser 3 does not include any Box2D native wrapper as it does with Matter physics. This does not mean we cannot use Box2D in our projects, it’s just we don’t have dedicated Phaser method to handle Box2D.

And, above all, we do not even have a native JavaScript version of Box2D.

There are some JavaScript ports of Box2D around the web, and the one I like the most is Planck.js by Ali Shakiba. Planck.js is a JavaScript rewrite of Box2D physics engine while other JavaScript libraries are direct portings of the original C++ engine.

In this first example, something like a “Hello World”, I will show you these concepts ..."

Read More

Learn to code and lead your intrepid crew on a mission to save The Cloud in TwilioQuest, a PC role-playing game inspired by classics of the 16-bit era. Free forever, and available now for Windows, Mac, and Linux.

The first book on the creation of HTML5 cross platform games using Phaser 3 and other free software.
  • By Emanuele Feronato
  • 155 Pages
  • 28 Source Code Examples
  • Build a complete game from start to finish
  • Cross Platform
  • Scaling for devices
Buy Now
$19