コラプス時間を延長したい

返信する
sibuchin
記事: 4
登録日時: 2019年6月05日(水) 17:39

コラプス時間を延長したい

投稿記事 by sibuchin »

ボスの消滅エフェクトを変えたくて、rpg_spritesの
if (this._effectType === 'bossCollapse') {の部分をコメントアウトし

Sprite_Enemy.prototype.updateBossCollapse = function(power, speed, duration) {
this._shake = Math.sin(this._effectDuration * 80) * 3;
this.opacity *= this._effectDuration / (this._effectDuration + 1);
this.setBlendColor([255, 0, 0, 255 - this.opacity]);
if (this._effectDuration % 20 === 0) {
SoundManager.playBossCollapse2();
}

};

とjsファイルに組み込んでみました。
ほぼ理想通りのコラプスになったのですが、時間が短く、1秒程度で消滅してしまいます。
これを10秒くらいかけて消滅するようにしたいのですが、どこをいじればいいのでしょうか。
延長したいのはボスの消滅エフェクトだけです。

どなたか詳しい方おられれば、ぜひご教示ください。
よろしくお願い致します。
アバター
Plasma Dark
記事: 731
登録日時: 2020年2月08日(土) 02:29
連絡する:

Re: コラプス時間を延長したい

投稿記事 by Plasma Dark »

updateFrame の分岐処理削除もプラグインに切り出しておくほうが無難です。

コード: 全て選択

(() => {
  'use strict';

  Sprite_Enemy.prototype.updateFrame = function () {
    Sprite_Battler.prototype.updateFrame.call(this);
    var frameHeight = this.bitmap.height;
    this.setFrame(0, 0, this.bitmap.width, frameHeight);
  };

  Sprite_Enemy.prototype.updateBossCollapse = function (power, speed, duration) {
    this._shake = Math.sin(this._effectDuration * 80) * 3;
    this.opacity *= this._effectDuration / (this._effectDuration + 1);
    this.setBlendColor([255, 0, 0, 255 - this.opacity]);
    if (this._effectDuration % 20 === 0) {
      SoundManager.playBossCollapse2();
    }
  };
})();
ボスの消滅エフェクトを左右に小刻みに振動する感じに変更したい、という意図でしょうか。
消滅エフェクトは _effectDuration に格納された残りフレーム数を減じながら再生されます。
エフェクトの開始時に設定される _effectDuration の値を変更することで、総再生時間をコントロールできます。

コード: 全て選択

  Sprite_Enemy.prototype.startBossCollapse = function() {
    this._effectDuration = 600; /** 600描画フレーム = 約10秒 */
    this._appeared = false;
  };
10秒はかなり長く、プレイヤーを萎えさせる可能性があるのでもう少し短くしたほうが良いとは思いますが……。
sibuchin
記事: 4
登録日時: 2019年6月05日(水) 17:39

Re: コラプス時間を延長したい

投稿記事 by sibuchin »

うまくできました!

たしかに10秒は長すぎますね……
effectDuration = 200くらいにすればちょうどいい感じになりました。

この度はお忙しいところありがとうございました!
返信する

“MV:質問”に戻る