Jump to content

MatterJS, Help with composites


jurbank
 Share

Recommended Posts

I'm trying to make a game where the user can drag parts to attach to the Ship.

The main challenge I'm running into is attaching the bodies into a single, fixed group so when the player thrusts around with the arrow keys, the other bodies stay in-place. I was looking into composites but I'm not sure how to use them in Phaser, looks pretty straight forward in standard MatterJS. I was also playing with constraints and joints but those seem to attach at one point between both bodies. I also tried adding two constrains, one at each edge but it seemed like the 2nd overwrote the 1st.

Any thoughts?

Here's my code playground - https://codepen.io/jurbank/pen/Mqqyow?editors=0011

Link to comment
Share on other sites

Thanks!

I actually was starting down that route....found this example the other night - http://labs.phaser.io/edit.html?src=src\game objects\container\matter physics body test.js

Seems to work fine with creating image objects using the Factory class (this.add.image(...))

However, when I extend a new MatterImage and instantiate it, the x,y context appear agnostic to the parent container context and results in duplicate boxes. Here's a short animation - https://www.useloom.com/share/57dbd41477684e73b87201aec803fbce

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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