Jump to content
This forum will be closing down. Please move to the respective dedicated project forums.

Grid-based physics plugin


nkholski
 Share

Recommended Posts

UPDATE
After posting this I decided to create a repository on Github and I made a new "official" thread in the forum to post updates on the progress, and for anyone to drop questions, ideas and stuff.
Github: https://github.com/nkholski/phaser-grid-physics
Forum: http://www.html5gamedevs.com/topic/28051-grid-physics-plugin/

 

-----------------------------------------------------------------------------------------

 

Hi all,

I've been thinking of doing an old-school RPG for a while (haven't we all?), and decided to start with a plugin for grid-based "physics" for me to use. I reached a point where I got most of what I will need, and thought I could share a small demo. If there is interest I might improve the plugin and remove parts that are tied to my game so that others may use it (it would be really easy to make something like Sokoban with this).

The demo is here: http://metroid.niklasberg.se/gridPhysics/

The hero is controlled with the arrow keys. Use the controls in dat-gui in the upper right corner of the browser to change properties. Things to do: Push objects (even multiple objects in chains). Walk or push things into one-way directional tiles. Explore the Hero properties.

Code examples

//Init 8x8 grid physics
game.plugins.add(new GridPhysics(this.game));
game.physics.gridPhysics.gridSize = {
         x: 8,
         y: 8
};
//Enable grid collision on a tile map layer
game.physics.gridPhysics.enable(layer);
// Enable grid body on sprite:
game.physics.gridPhysics.enable(sprite);

ladda ned.png

Link to comment
Share on other sites

  • 5 weeks later...
  • 4 weeks later...

If you just want to check it out there is a demo online here: http://metroid.niklasberg.se/gridPhysics/

Otherwise, there are instructions at the end of the README.md-file ("brunch watch --server" to watch files and launch the server). Note that you need to navigate to http://localhost:3333/demo/ (not http://localhost:3333).

I have had an unexpectedly busy period with unrelated stuff and haven't had time to work on the plugin for a while. However, it's far from abandoned and I plan to pick up the development as soon as things calm down.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...