Hey y'all,
I'm trying to create an effect when enemies pulse red when they're at low HP.
I based this on the updateSelectionEffect function in rpg_sprites.js, but so far, I'm not getting any results with this. Any help would be appreciated.
I'm trying to create an effect when enemies pulse red when they're at low HP.
JavaScript:
Sprite_Enemy.prototype.update = function() {
Sprite_Battler.prototype.update.call(this);
if (this._enemy) {
this.updateEffect();
this.updateStateSprite();
this.updateDangerEffect();
}
};
Sprite_Enemy.prototype.updateDangerEffect = function() {
var target = this._effectTarget;
var opacity = 0;
if (this._battler.hp <= Math.floor(this._battler.mhp * 0.3)){
this._dangerEffectCounter += 10;
if (this._dangerEffectCounter % 80 < 80){
opacity = this._dangerEffectCounter;
}
else if (this._dangerEffectCounter % 160 < 160){
opacity = -(this._dangerEffectCounter - 160);
}
target.setBlendColor([255, 0, 0, opacity]);
}
else if (opacity > 0){
opacity = 0;
target.setBlendColor([255, 0, 0, 0]);
}
}
I based this on the updateSelectionEffect function in rpg_sprites.js, but so far, I'm not getting any results with this. Any help would be appreciated.