-
Notifications
You must be signed in to change notification settings - Fork 66
/
Copy pathMrTS_SetCharacterFrame.js
40 lines (37 loc) · 1.46 KB
/
MrTS_SetCharacterFrame.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
//=============================================================================
// MrTS_SetCharacterFrame.js
//=============================================================================
/*:
* @plugindesc Adds extra method to Game_CharacterBase: setCharacterFrame(index)
* @author Mr. Trivel
*
* @help
* --------------------------------------------------------------------------------
* Terms of Use
* --------------------------------------------------------------------------------
* Don't remove the header or claim that you wrote this plugin.
* Credit Mr. Trivel if using this plugin in your project.
* Free for commercial and non-commercial projects.
* --------------------------------------------------------------------------------
* Version 1.0
* --------------------------------------------------------------------------------
*
* --------------------------------------------------------------------------------
* Version History
* --------------------------------------------------------------------------------
* 1.0 - Release
*/
(function() {
var _Game_CharacterBase_initMembers = Game_CharacterBase.prototype.initMembers;
Game_CharacterBase.prototype.initMembers = function() {
_Game_CharacterBase_initMembers.call(this);
this._frame = 0;
};
Game_CharacterBase.prototype.setCharacterFrame = function(index) {
var pattern = index % 3;
var dir = ((index - pattern) / 3 + 1) * 2;
this._frame = index;
this._pattern = pattern;
this._direction = dir;
};
})();