Closed mktcode closed 4 years ago
Howdy. Glad you found it helpful. The idea with objects as parameters is that it is easier to omit the optional parameters. objectB and context are optional, so rather than writing the confusing line to detect when any other object hits the player:
addOnCollideStart(player, undefined, () => console.log("Something collided with player"))
You get the more explicit:
addOnCollideStart({ objectA: player, callback: () => console.log("Something collided with player") })
addOnCollide
is private and not really intended to be used outside of the library's internal code.
Re: Phaser's methods. Many of them use objects as arguments, e.g. every method under the GameObjectCreator. The methods here different from the arcade physics collider API because the functionality is different - you can't have an A vs everything collider there.
You can easily patch in your preferred way of consuming the plugin, e.g. something like:
// Not tested, should be approximately right
matterCollision.addOnCollideStartCustom = function (objectA, objectB, callback, context) {
this.addOnCollideStart({ objectA, objectB, callback, context });
}
Thanks for you reply. In the end I guess... it's not that much of a deal! :smiley: Thanks again for the plugin! Very useful! Same as https://github.com/mikewesthad/dungeon btw. I'm using that as well. You can see a very early prototype of my game here: https://mktcode.itch.io/infinite-dungeons I will now investigate the code to see if I can make some changes to allow me to determine a few fixtures for rooms like "at least one room with only one door".
Cool! Stanley parable vibes.
A little bit, yes. A mix between that and a diablo-like dungeon crawler is what I have in mind.
Hey... do you have discord or something and a minute or two? I could really need a little help with matter.js. It's confusing the shit out of me and feel a bit stuck.
Hey! Thanks for this handy little plugin!
Juuuuust one thing.... Can't you make all functions take parameters like the
addOnCollide
instead of an object with key-value pairs?I just prefer this
over this
It's also more like everything else in Phase.