https://github.com/hexus/phaser-sat-example
An experiment that uses sat-js with Phaser.
https://github.com/hexus/phaser-sat-example
demo example phaser sat separating-axis-theorem
Last synced: 5 months ago
JSON representation
An experiment that uses sat-js with Phaser.
- Host: GitHub
- URL: https://github.com/hexus/phaser-sat-example
- Owner: hexus
- Created: 2016-04-19T00:35:14.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-05-06T02:01:16.000Z (over 9 years ago)
- Last Synced: 2025-02-28T21:02:46.777Z (11 months ago)
- Topics: demo, example, phaser, sat, separating-axis-theorem
- Language: JavaScript
- Size: 31.3 KB
- Stars: 17
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Phaser SAT Example
An example of using the Separating Axis Theorem for collision handling with
[Phaser](https://github.com/photonstorm/phaser).
Check it out for yourself [here](http://hexus.github.io/phaser-sat-example/)!
**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](http://www.metanetsoftware.com/technique/diagrams/tutA_demo.html)
from a [fantastic tutorial](http://www.metanetsoftware.com/technique/tutorialA.html)
by [Metanet](http://www.metanetsoftware.com/).
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](https://github.com/jriecken/sat-js) library and this
[very handy tutorial](http://elancev.name/oliver/2D%20polygon.htm#tut4).
## Installation
Install NPM, install Bower, and then install the Bower dependencies.
```bash
npm install -g bower
bower install
```
Open up `index.html` in your browser!
## Controls
**WASD** to move.