分层动画 Layered Animation

插件简介:

RMMV默认的动画全部属于屏幕的child sprite,即动画会在高层统一播放,使得动画缺乏层次感。这个插件会将每组动画归为其目标的child sprite。全屏动画不受影响。

食用方法:

直接安装启用插件即可,无需设置

使用条款:

非商业·商业皆可,请credit AndrewX

更新履历:

Version 0.10:
  • 完成插件原型

插件内容:

插件内容AndrewX_LayeredAnimation.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
//=============================================================================
// AndrewX - Layered Animation
// AndrewX_LayeredAnimation.js
//=============================================================================
var AndrewX = AndrewX || {};
AndrewX.LA = AndrewX.LA || {};
//=============================================================================
/*:
* @plugindesc v0.10 Enable animations to be displayed on the same layers as its target. (except for Screen Animations)
* @author AndrewX
*
* @help
* ============================================================================
* Introduction and Instructions
* ============================================================================
*
* No need for any configuration.
*
* ============================================================================
* Changelog
* ============================================================================
*
* Version 0.10:
* - Finished prototype
*
* ============================================================================
* Term of Use
* ============================================================================
*
* Free for use in non-commercial or commercial RMMV projects
* Please credit AndrewX
*
*/

//=============================================================================

AndrewX.LA.startAnimation = Sprite_Base.prototype.startAnimation;
Sprite_Base.prototype.startAnimation = function(animation, mirror, delay) {
var sprite = new Sprite_Animation();
sprite.setup(this._effectTarget, animation, mirror, delay);
//this.parent.addChild(sprite); Changed to:
if(animation.position === 3){
this.parent.addChild(sprite);
} else {
this.addChild(sprite);
}
//modification done
this._animationSprites.push(sprite);
};

AndrewX.LA.updatePosition = Sprite_Animation.prototype.updatePosition
Sprite_Animation.prototype.updatePosition = function() {
if (this._animation.position === 3) {
this.x = this.parent.width / 2;
this.y = this.parent.height / 2;
} else {
var parent = this._target.parent;
var grandparent = parent ? parent.parent : null;
this.x = 0; //original: this.x = this._target.x
this.y = 0; //original: this.y = this._target.y
if (this.parent === grandparent) {
this.x += parent.x;
this.y += parent.y;
}
if (this._animation.position === 0) {
this.y -= this._target.height;
} else if (this._animation.position === 1) {
this.y -= this._target.height / 2;
}
}
};