Akshar Patel Posted April 5, 2015 Share Posted April 5, 2015 I noticed that with the 2.3 release, the health property and damage method have been moved to a separate Health Component. The problem is that I have no idea how to use it. Now, I know that it can easily be implemented manually, but I don't want to write code for things that are already implemented. Can anyone help me understand how components work in phaser? Link to comment Share on other sites More sharing options...
grumpygamer Posted April 7, 2015 Share Posted April 7, 2015 I second this Link to comment Share on other sites More sharing options...
drhayes Posted April 10, 2015 Share Posted April 10, 2015 Hey, just to make sure this gets answered: you don't really have to "use it", per se. Check out this code. It iterates over the components and mixes in their prototypes via Phaser.Utils#mixinPrototype. That means that Phaser.Components.Core.update becomes the update method for whatever you install the component into. So, literally, Sprite's "update" method *is* the "update" method from the prototype of Phaser.Components.Core. Does that make sense? Does that answer your question? Link to comment Share on other sites More sharing options...
rich Posted April 14, 2015 Share Posted April 14, 2015 Here: https://github.com/photonstorm/phaser/issues/1739 Link to comment Share on other sites More sharing options...
Recommended Posts