An example of using the Separating Axis Theorem for collision handling with Phaser.
Check it out for yourself here!
PhaserSat.js is a heavily commented Phaser scene that puts all of this together.
I put this together because I'm terrible at maths and wanted to learn how to perform collision detection and response against sloped tiles. I wanted something like this from a fantastic tutorial by Metanet.
Even though Phaser has its Ninja Physics engine, which is ported from the very examples linked above, I wanted to see if it could be done more concisely.
In the end was able to achieve this thanks to the awesome SAT.js library and this very handy tutorial.
Install NPM, install Bower, and then install the Bower dependencies.
npm install -g bower
bower install
Open up index.html
in your browser!
WASD to move.