mafcho Posted March 27, 2015 Share Posted March 27, 2015 Hello, I'd like to add the Health component back to my Sprite subclass now that I've upgraded to 2.3.0. Looking at Sprite's source, it uses Phaser.Component.Core.install to do that. But according to the docs for the install method, it's internal and shouldn't be used directly... so what is the intended way to add a component in 2.3.0? Thanks,Matt Link to comment Share on other sites More sharing options...
rich Posted March 27, 2015 Share Posted March 27, 2015 Health is already part of Sprite. You don't need to add it in, as long as your Sprite extends Phaser.Sprite, it will have it. Link to comment Share on other sites More sharing options...
mafcho Posted March 28, 2015 Author Share Posted March 28, 2015 Hi Rich, Maybe health got left out by mistake then? Even on a normal sprite object I can't use damage(). When I look at sprite's src in https://github.com/photonstorm/phaser/blob/master/src/gameobjects/Sprite.js I'm not seeing the health component getting added: Phaser.Component.Core.install.call(Phaser.Sprite.prototype, [ 'Angle', 'Animation', 'AutoCull', 'Bounds', 'BringToTop', 'Crop', 'Delta', 'Destroy', 'FixedToCamera', 'InputEnabled', 'InWorld', 'LifeSpan', 'LoadTexture', 'Overlap', 'PhysicsBody', 'Reset', 'ScaleMinMax', 'Smoothed']);Thanks,Matt nkholski 1 Link to comment Share on other sites More sharing options...
rich Posted March 30, 2015 Share Posted March 30, 2015 Damn, I know what happened - Health used to be part of LifeSpan but was split out. I've fixed this in 2.3.1 in the dev branch. Will probably do a minor update release this week. Link to comment Share on other sites More sharing options...
Recommended Posts