加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 魏玉龙 于 2018-9-15 09:10 编辑
看到有人需要类似的功能就顺手写了一个插件!
冲刺过长时间,角色会减速。当取消冲刺状态或停止后下来会自动恢复耐力!
冲刺的加速度及减速度会均匀增加,陷入疲惫状态会有气泡提示!
/*: * Acceleration.js * @plugindesc 均匀加减速插件 * @author 魏玉龙 * @since 2018.09.15 * @version 1.0 * * @param speed * @desc 加速度 * @default 0.01 * * @param stamina * @desc 角色冲刺持续帧数,为0时可无限时冲刺。 * @default 600 * */ (function () { var parameters = PluginManager.parameters('Acceleration'); var speed = Number(parameters['speed'] || 0.01); var stamina = Number(parameters['stamina'] || 600); var Game_CharacterBase_prototype_initMembers = Game_CharacterBase.prototype.initMembers; Game_CharacterBase.prototype.initMembers = function () { Game_CharacterBase_prototype_initMembers.call(this); this._dashSpeed = 0; this._stamina = stamina; } Game_CharacterBase.prototype.realMoveSpeed = function () { return this._moveSpeed + this._dashSpeed; } var Game_CharacterBase_prototype_updateStop = Game_CharacterBase.prototype.updateStop; Game_CharacterBase.prototype.updateStop = function () { Game_CharacterBase_prototype_updateStop.call(this); if (this._dashSpeed != 0) { this._dashSpeed = 0; } if (this._stamina < stamina) { this._stamina++; } } var Game_CharacterBase_prototype_updateMove = Game_CharacterBase.prototype.updateMove; Game_CharacterBase.prototype.updateMove = function () { Game_CharacterBase_prototype_updateMove.call(this); this.updateDashSpeed(); } Game_CharacterBase.prototype.updateDashSpeed = function () { if (this.isDashing()) { if (this._stamina > 0 || stamina == 0) { this._dashSpeed = Math.min(this._dashSpeed + speed, 1); this._stamina > 0 && this._stamina--; } else { if (this._stamina == 0 && this._dashSpeed == 1) { this.requestBalloon(7); } this._dashSpeed = Math.max(this._dashSpeed - speed, -1); } } else { if (this._dashSpeed > 0) { this._dashSpeed = Math.max(this._dashSpeed - speed, 0); } else { this._dashSpeed = Math.min(this._dashSpeed + speed, 0); } if (this._stamina < stamina) { this._stamina++; } } } })();
/*:
* Acceleration.js
* @plugindesc 均匀加减速插件
* @author 魏玉龙
* @since 2018.09.15
* @version 1.0
*
* @param speed
* @desc 加速度
* @default 0.01
*
* @param stamina
* @desc 角色冲刺持续帧数,为0时可无限时冲刺。
* @default 600
*
*/
(function () {
var parameters = PluginManager.parameters('Acceleration');
var speed = Number(parameters['speed'] || 0.01);
var stamina = Number(parameters['stamina'] || 600);
var Game_CharacterBase_prototype_initMembers = Game_CharacterBase.prototype.initMembers;
Game_CharacterBase.prototype.initMembers = function () {
Game_CharacterBase_prototype_initMembers.call(this);
this._dashSpeed = 0;
this._stamina = stamina;
}
Game_CharacterBase.prototype.realMoveSpeed = function () {
return this._moveSpeed + this._dashSpeed;
}
var Game_CharacterBase_prototype_updateStop = Game_CharacterBase.prototype.updateStop;
Game_CharacterBase.prototype.updateStop = function () {
Game_CharacterBase_prototype_updateStop.call(this);
if (this._dashSpeed != 0) {
this._dashSpeed = 0;
}
if (this._stamina < stamina) {
this._stamina++;
}
}
var Game_CharacterBase_prototype_updateMove = Game_CharacterBase.prototype.updateMove;
Game_CharacterBase.prototype.updateMove = function () {
Game_CharacterBase_prototype_updateMove.call(this);
this.updateDashSpeed();
}
Game_CharacterBase.prototype.updateDashSpeed = function () {
if (this.isDashing()) {
if (this._stamina > 0 || stamina == 0) {
this._dashSpeed = Math.min(this._dashSpeed + speed, 1);
this._stamina > 0 && this._stamina--;
} else {
if (this._stamina == 0 && this._dashSpeed == 1) {
this.requestBalloon(7);
}
this._dashSpeed = Math.max(this._dashSpeed - speed, -1);
}
} else {
if (this._dashSpeed > 0) {
this._dashSpeed = Math.max(this._dashSpeed - speed, 0);
} else {
this._dashSpeed = Math.min(this._dashSpeed + speed, 0);
}
if (this._stamina < stamina) {
this._stamina++;
}
}
}
})();
|