The title says it all. I'm looking for a simple way to make actor sprites have the same "blink" effect that enemies do when taking damage. I know the code that makes the enemy sprite effect, but I'm not sure how to have actor sprites do the same thing.
MV Actor sprite blink when damaged
JS Plugin RequestsJust give them a passive state that changes their opacity down and up when taking damage with notetags LOL
Edit: hmmm though I guess the timing doesn't work for that
Edit: hmmm though I guess the timing doesn't work for that
Hmmm, I tried checking how to do this, this seems to work, but test it more if you need additional changes:
Sprite_Actor.prototype.updateBlink = function() { if (this._actor._blinkDuration > 0) { this._actor._blinkDuration--; this.opacity = (this._actor._blinkDuration % 10 < 5) ? 255 : 0; }};Sprite_Actor.prototype.update = function() { Sprite_Battler.prototype.update.call(this); this.updateShadow(); if (this._actor) { this.updateMotion(); this.updateBlink(); }};Game_Actor.prototype.performDamage = function() { Game_Battler.prototype.performDamage.call(this); if (this.isSpriteVisible()) { this.requestMotion('damage'); this._blinkDuration = 20; } else { $gameScreen.startShake(5, 5, 10); } SoundManager.playActorDamage();};That's perfect, thank you so much!
Original thread: https://forums.rpgmakerweb.com/threads/actor-sprite-blink-when-damaged.178051/