//=============================================================================
// BustBreathStable.js
//=============================================================================
/*:
* @plugindesc 【稳定版立绘呼吸】任意时刻显示立绘并自动呼吸效果,不依赖对话框。
* @author ChatGPT
*
* @param breathSpeed
* @text 呼吸速度
* @type number
* @decimals 2
* @default 0.03
*
* @param breathScale
* @text 呼吸缩放幅度
* @type number
* @decimals 2
* @default 0.02
*
* @help
*
* ◆ 用法:
* 图片放 img/pictures/
* 插件指令:
*
* ShowBustBreath 图片名 X Y
* - 显示带呼吸的立绘(坐标X Y为左上角位置)
* - 例:ShowBustBreath Actor1 200 0
*
* HideBustBreath
* - 隐藏立绘
*/
(function() {
var parameters = PluginManager.parameters('BustBreathStable');
var breathSpeed = Number(parameters['breathSpeed'] || 0.03);
var breathScale = Number(parameters['breathScale'] || 0.02);
var BustBreathSprite = null;
function createBustSprite(name, x, y) {
if (BustBreathSprite) SceneManager._scene.removeChild(BustBreathSprite);
var sprite = new Sprite(ImageManager.loadPicture(name));
sprite.x = x;
sprite.y = y;
sprite._breathPhase = 0;
sprite.update = function() {
Sprite.prototype.update.call(this);
this._breathPhase += breathSpeed;
var scale = 1 + Math.sin(this._breathPhase) * breathScale;
this.scale.x = scale;
this.scale.y = scale;
};
SceneManager._scene.addChild(sprite);
BustBreathSprite = sprite;
}
function removeBustSprite() {
if (BustBreathSprite && SceneManager._scene) {
SceneManager._scene.removeChild(BustBreathSprite);
BustBreathSprite = null;
}
}
var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
Game_Interpreter.prototype.pluginCommand = function(command, args) {
_Game_Interpreter_pluginCommand.call(this, command, args);
if (command === 'ShowBustBreath') {
var name = args[0];
var x = Number(args[1] || 0);
var y = Number(args[2] || 0);
createBustSprite(name, x, y);
}
if (command === 'HideBustBreath') {
removeBustSprite();
}
};
})();
* ◆ 用法:
* 图片放 img/pictures/
* 插件指令:
*
* ShowBustBreath 图片名 X Y
* – 显示带呼吸的立绘(坐标X Y为左上角位置)
* – 例:ShowBustBreath Actor1 200 0
*
* HideBustBreath
* – 隐藏立绘