Jump to content

Grid physics plugin


Recommended Posts

Phaser Grid Physics plugin adds support for grid/tile based movement and physics to Phaser. It's still in early stages and the code is kind of messy but I want to release it to check interest and get feedback. I plan to update this post whenever I do an update.




UPDATE 2017-02-04 

  • Now using brunch for building the plugin thanks to @samme
  • Added possibility to block bodies from leaving tiles in certain directions.
  • New issue: Tiles with internal blocks isn't compatible with current pathfinding implementation.

Current features

  • Any grid size  (not necessarily squares, i.e. 8x16 is possible, and not restricted to sprite or tile sizes).
  • Turn-based or real-time.
  • Visual debugging
  • Tile dimensions may differ from grid dimensions (but needs to be multiple of the grid dimensions, like 16x16 tiles on an 8x8 grid).
  • Collision detection against tile layers
  • Tile collisions on specified directions only
  • Body size is not restricted to grid-size, and different body sizes may co-exist (but must be equal or a multiple of grid dimensions. The sprite graphics may differ from body size.)
  • Path finding (easystar.js dependency)
  • Moveable objects (can be chained, i.e. the player push one crate against another crate that will also move).
  • Mass (and strength that limit total mass that can be pushed by the power of one sprite)
  • Velocity, ("struggle" property that can slow down a body based on mass pushed)
  • Populated properties like isMoving.x (boolean) or isBlocked.top (boolean).

Planned features include conjoined bodies, collision callbacks, movement tweaks and other stuff.

Link to comment
Share on other sites

On 1/28/2017 at 1:09 PM, nkholski said:

Help wanted! I know some of you are experts on build configuration (don't even know what to call it). I still struggle to create something that builds files for distribution ("gridPhysics.min.js") and would really appreciate some assistance.

Highly recommend Brunch.

Link to comment
Share on other sites


  • Recently Browsing   0 members

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