nkholski

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.

screenshot.png.0e283e375297b8baf617a24a304471ba.png

DEMOhttp://metroid.niklasberg.se/gridPhysics/
Githubhttps://github.com/nkholski/phaser-grid-physics

 

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.

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

WOW! That's fantastic. Thank you so much. I'm just sorry I can't like your post more than once. I'll be alone with two feverish children today, but hope to be able to do some updates and then merge it with your version during this weekend. :-)

Share this post


Link to post
Share on other sites

I just updated the repository with the contribution from @samme.

I also added the possibility to block bodies from leaving tiles in certain directions. I updated the demo and screenshot in the first post of this thread to demonstrate this feature that makes the hill in the right side of the demo screen possible.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.