| 
 
| 赞 | 19 |  
| VIP | 0 |  
| 好人卡 | 1 |  
| 积分 | 37 |  
| 经验 | 9653 |  
| 最后登录 | 2025-8-4 |  
| 在线时间 | 1133 小时 |  
 Lv3.寻梦者 
	梦石0 星屑3662 在线时间1133 小时注册时间2017-4-6帖子278 
 | 
| 复制代码//=============================================================================
// ★ Screen Shake Effects ★                                             1.0.0
//=============================================================================
/*:
 * @plugindesc ▶动画 动画中SE触发屏幕振动[2019/07/07] 作者:Aries
 * @author Aries
 * @param ▶▶插件信息
 * @type []
 * @default ["名称: Aries_ShakeEffects","作者: Aries","版本: 2019/07/07","更新: ariesofsheratan.itch.io/001l-screen-effects","主页: ariesofsheratan.itch.io"]
 * @param
 *
 * @help
 * @param Shake Type
 * @text 屏幕振动模式(全局)
 * @type select
 * @option 默认
 * @value Standard
 * @option 随机
 * @value Random
 * @option 水平
 * @value Horizontal
 * @option 垂直
 * @value Vertical
 * @default Random
 *
 * @param Shake SE
 * @text 触发屏幕振动的SE文件✚
 * @default Skill2
 *
 * @param 振动强度
 * @type number
 * @min 0
 * @default 20
 */
/*
〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓
============================================================================
--------------------------------------
〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓〓
 */
// ★ Evaluate Parameters
var Aries = Aries || {};
Aries.P001L_SSE = {};
Aries.P001L_SSE.Param = PluginManager.parameters('Aries_ShakeEffects');
switch (String(Aries.P001L_SSE.Param["Shake Type"]).toUpperCase()) {
    case 'STANDARD': Aries.P001L_SSE.ShakeType = 0; break;
    case 'RANDOM': Aries.P001L_SSE.ShakeType = 1; break;
    case 'HORIZONTAL': Aries.P001L_SSE.ShakeType = 2; break;
    case 'VERTICAL': Aries.P001L_SSE.ShakeType = 3; break;
    default: Aries.P001L_SSE.ShakeType = 1; break;
}
Aries.P001L_SSE.ShakeSE = String(Aries.P001L_SSE.Param["Shake SE"]);
var _aries_p001l_pluginCommand = Game_Interpreter.prototype.pluginCommand;
Game_Interpreter.prototype.pluginCommand = function(command, args) {
    _aries_p001l_pluginCommand.call(this, command, args);
    if (command === 'AriesScreenShakeType') {
        switch (args[0].toUpperCase()) {
        case 'STANDARD':
            Aries.P001L_SSE.ShakeType = 0;
            break;
        case 'RANDOM':
            Aries.P001L_SSE.ShakeType = 1;
            break;
        case 'HORIZONTAL':
            Aries.P001L_SSE.ShakeType = 2;
            break;
        case 'VERTICAL':
            Aries.P001L_SSE.ShakeType = 3;
            break;
        default:
            ;
        }
    }
};
Aries.P001L_SSE.setScreenShakeType = function(type) {
    switch (type.toUpperCase()) {
    case 'STANDARD':
        Aries.P001L_SSE.ShakeType = 0;
        break;
    case 'RANDOM':
        Aries.P001L_SSE.ShakeType = 1;
        break;
    case 'HORIZONTAL':
        Aries.P001L_SSE.ShakeType = 2;
        break;
    case 'VERTICAL':
        Aries.P001L_SSE.ShakeType = 3;
        break;
    default:
        ;
    }
};
// ★ Sprite_Animation
// -----------------------------------------------------------------------------
var _aries_p001l_processTimingData = Sprite_Animation.prototype.processTimingData;
Sprite_Animation.prototype.processTimingData = function(timing) {
    if (timing.se != null && timing.se.name.toUpperCase() == Aries.P001L_SSE.ShakeSE.toUpperCase()) {
        var shakepwr = timing.flashColor[0] * 0.03529411764705882352941176470588;
        var shakespd = timing.flashColor[1] * 0.03529411764705882352941176470588;
        var shakedur = Number(Aries.P001L_SSE.Param["振动强度"]);
        $gameScreen.startShake(shakepwr, shakespd, shakedur);
    } else {
        _aries_p001l_processTimingData.call(this, timing);
    }
};
// ★ Game_Screen
// -----------------------------------------------------------------------------
var _aries_p001l_gameScreen_clearShake = Game_Screen.prototype.clearShake;
Game_Screen.prototype.clearShake = function() {
    _aries_p001l_gameScreen_clearShake.call(this);
    this._shakeVector = new Point(0, 0);
};
var _aries_p001l_gameScreen_startShake = Game_Screen.prototype.startShake;
Game_Screen.prototype.startShake = function(power, speed, duration) {
    _aries_p001l_gameScreen_startShake.call(this, power, speed, duration);
    this._shakeVector = new Point(0, 0);
};
Game_Screen.prototype.shakeVector = function() {
    return this._shakeVector;
};
var _aries_p001l_gameScreen_updateShake = Game_Screen.prototype.updateShake;
Game_Screen.prototype.updateShake = function() {
    switch (Aries.P001L_SSE.ShakeType) {
        case 0:
            _aries_p001l_gameScreen_updateShake.call(this);
            break;
        case 1:
            this.updateShakeRandom();
            break;
        case 2:
            this.updateShakeOscillate(1, 0);
            break;
        case 3:
            this.updateShakeOscillate(0, 1);
            break;
        default:
            _aries_p001l_gameScreen_updateShake.call(this);
    }
};
Game_Screen.prototype.updateShakeRandom = function() {
    if (this._shakeDuration > 0 || this._shake !== 0) {
        var shakeX = (Math.randomInt(this._shakePower) - Math.randomInt(this._shakePower)) * (Math.min(this._shakeDuration, 30) * 0.5);
        var shakeY = (Math.randomInt(this._shakePower) - Math.randomInt(this._shakePower)) * (Math.min(this._shakeDuration, 30) * 0.5);
        var delta = (this._shakePower * this._shakeSpeed * this._shakeDirection) / (11 - this._shakeSpeed);
        if (this._shakeDuration <= 1) {
            this._shake = 0;
            this._shakeVector.x = 0;
            this._shakeVector.y = 0;
        } else {
            this._shake = 0;
            this._shakeVector.x = shakeX;
            this._shakeVector.y = shakeY;
        }
        this._shakeDuration--;
    }
};
Game_Screen.prototype.updateShakeOscillate = function(h, v) {
    if (this._shakeDuration > 0 || this._shake !== 0) {
        var delta = (this._shakePower * (2 * this._shakeSpeed) * this._shakeDirection) / 5;
        if (this._shakeDuration <= 1 && this._shake * (this._shake + delta) < 0) {
            this._shake = 0;
        } else {
            this._shake += delta;
        }
        if (this._shake > this._shakePower * 2) {
            this._shakeDirection = -1;
        }
        if (this._shake < - this._shakePower * 2) {
            this._shakeDirection = 1;
        }
        this._shakePower *= 0.9;
        this._shakeDuration--;
    }
};
Spriteset_Base.prototype.updatePosition = function() {
    var screen = $gameScreen;
    var scale = screen.zoomScale();
    this.scale.x = scale;
    this.scale.y = scale;
    this.x = Math.round(-screen.zoomX() * (scale - 1));
    this.y = Math.round(-screen.zoomY() * (scale - 1));
    switch (Aries.P001L_SSE.ShakeType) {
        case 0: // default
            this.x += Math.round(screen.shake());
            break;
        case 1: // alldir
            this.x += Math.round(screen._shakeVector.x);
            this.y += Math.round(screen._shakeVector.y);
            break;
        case 2: // horiz
            this.x += Math.round(screen.shake());
            break;
        case 3: // vert
            this.y += Math.round(screen.shake());
            break;
        default: // default!
            this.x += Math.round(screen.shake());
    }
};
 | 
 |