镜像动画修复
默认镜像动画算法奇葩,导致使用旋转的动画会出现异常,现上插件修复:JAVASCRIPT 代码下载
//=============================================================================
// Fix Mirrored Animation
// MirrorAnimationFix.js
// Version: 1.00
//=============================================================================
var Imported = Imported || {};
Imported.Kien_MirrorAnimationFix = true;
var Kien = Kien || {};
Kien.MirroredAnimation = {};
//=============================================================================
/*:
* @plugindesc Fix A bug that animatio will show wrong when used mirror in script.
* @author Kien
*
*/
Kien.MirroredAnimation.Sprite_Animation_setup = Sprite_Animation.prototype.setup;
Sprite_Animation.prototype.setup = function(target, animation, mirror, delay) {
Kien.MirroredAnimation.Sprite_Animation_setup.apply(this,arguments);
if (this._animation && this._mirror){
this.scale.x = -1;
}
};
Sprite_Animation.prototype.updateCellSprite = function(sprite, cell) {
var pattern = cell;
if (pattern >= 0) {
var sx = pattern % 5 * 192;
var sy = Math.floor(pattern % 100 / 5) * 192;
var mirror = this._mirror;
sprite.bitmap = pattern < 100 ? this._bitmap1 : this._bitmap2;
sprite.setFrame(sx, sy, 192, 192);
sprite.x = cell;
sprite.y = cell;
sprite.rotation = cell * Math.PI / 180;
sprite.scale.x = cell / 100;
if (cell) {
sprite.scale.x *= -1;
}
sprite.scale.y = cell / 100;
sprite.opacity = cell;
sprite.blendMode = cell;
sprite.visible = this._target.visible;
} else {
sprite.visible = false;
}
};
本帖来自P1论坛作者feizhaodan,因Project1站服务器在国外有时候访问缓慢不方便作者交流学习,经联系P1站长fux2同意署名转载一起分享游戏制作经验,共同为国内独立游戏作者共同创造良好交流环境,原文地址:https://rpg.blue/forum.php?mod=viewthread&tid=388814若有侵权,发帖作者可联系底部站长QQ在线咨询功能删除,谢谢。
页:
[1]