Home

Awesome

Phaser 3 + Matter.js example

GitHub package.json version GitHub Code style

Car on a curved terrain crosses a bridge

Build with Phaser 3 using the typescript phaser-project-template

Play

Play the game

screenshot gif

Features

About

To build this example I used Phaser 3 with the physics engine Matter.js. To make Matter work, it needs two additional libraries, poly-decomp and pathseg.

Reading the source code of some classes (especially Body, Bodies and Composites) of Matter and the Phaser3-docs helped a lot.

The mainScene takes a while to start and to restart. This is because I use Matter.Svg.pathToVertices to transform a SVG Path to an array of vectors at runtime. In a production game, I probably would only include the array of vectors in the game.

Credits

https://opengameart.org/content/free-off-road-racing-truck https://opengameart.org/content/monstertruck https://opengameart.org/content/sky-backdrop

License

The MIT License (MIT) 2019 - Yannick Deubel. Please have a look at the LICENSE for more details.