I don’t quite get how Phaser.Component works, but I assume its a “Component” you can add to a class by will. The main character in my game has health which is covered with Phaser.Sprite class, but it also has shield, which also acts as additional health, except, the Sprite.health value would start to fall down only when shield is down, i.e 0% if we look at it like percentage.
How or can I add additional Phaser.Component.Health as shield to a Sprite class, or I should use Phaser.Utils.extend() method to extend Sprite class with shield component, or maybe just an integer value?
Phaser.Component.Shield = function () {};
Phaser.Component.Shield.prototype = {
shield: 1
// etc.
};
Phaser.Utils.mixinPrototype(
Phaser.Sprite.prototype,
Phaser.Component.Shield.prototype,
true // replace (override) properties of the same name
);