exorcist-evangeline/www/js/plugins/T_dashMotion.js
2025-10-08 13:42:52 -05:00

60 lines
No EOL
2.8 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//=============================================================================
// T_dashMotion.js
//=============================================================================
//Copyright (c) 2016 Trb
// This software is released under the MIT License.
// http://opensource.org/licenses/mit-license.php
//
//twitter https://twitter.com/Trb_surasura
/*:
* @plugindesc 簡易的なダッシュモーションを実装します
* @author Trb
* @version 1.00 2016/6/3 初版
* 1.1 2016/6/4 フォロワーがダッシュモーションにならない不具合を修正
* また、構造を少し改変しやすい形に変更
*
* @help キャラクターが走っている時、画像を少し傾け上下させることで
* 簡易的にダッシュモーションのようにします。
* 上下の動きや傾きの角度を調整したい場合はプラグイン内を直接編集して下さい。
*/
(function () {
var SC_uo = Sprite_Character.prototype.updateOther;
Sprite_Character.prototype.updateOther = function() {
SC_uo.call(this);
this.updateDashMotion();//ダッシュモーション用の処理を追加
};
//ダッシュモーションの計算
Sprite_Character.prototype.updateDashMotion = function() {
var chara = this._character;
//フォロワーだったらダッシュ判定をプレイヤーと同じにする処理を追加(ver1.1)
var isDashing = chara._memberIndex ? $gamePlayer.isDashing() : chara.isDashing();
if(isDashing && (chara.isMoving() || this.T_lastMoving)){//キャラクターが走っている時
this.y -= chara.pattern() % 2 * 2;//y座標に補正をかける画像を上下させる
switch(chara.direction()){//キャラの向きで分岐
case 2://上下を向いてる時
case 8:
this.scale.y = 0.92;//少し潰す
this.rotation = 0;
break;
case 4://左を向いてる時
this.rotation = -0.14;//少し左に傾ける
break;
case 6://右を向いてる時
this.rotation = 0.14;//少し右に傾ける
break;
}
}else{//走ってない時角度と潰れをリセット
this.rotation = 0;
this.scale.y = 1;
}
this.T_lastMoving = chara.isMoving();
};
/* T_lastMoving という値について
このプラグインではキャラクターがダッシュ中かつ移動中にダッシュモーションになるようにしていますが、
デフォルトではキャラクターが1マス移動し終わった時に一瞬だけ移動判定がfalseになってしまいます。
なので移動判定を「今の移動判定」と「前回の移動判定」の2重にチェックする形にしました。
*/
})();