赞 | 160 |
VIP | 0 |
好人卡 | 3 |
积分 | 161 |
经验 | 39823 |
最后登录 | 2025-1-12 |
在线时间 | 3998 小时 |
Lv4.逐梦者
- 梦石
- 0
- 星屑
- 16134
- 在线时间
- 3998 小时
- 注册时间
- 2015-9-14
- 帖子
- 1337
|
比較簡單允許超過3幀(踏步圖)
(RM官方論壇) 作者: Shaz
- //=============================================================================
- // More Character Frames
- // by Shaz
- // Last Updated: 2015.09.21
- //=============================================================================
- /*:
- * @plugindesc 允許超過3幀(踏步圖)
- Allows more than 3 Frames
- * @author Shaz
- *
- * @help This plugin does not provide plugin commands.
- * //此插件不提供插件命令。
- *
- * Add [D L R U] to your character sheet name (with $ prefix) to specify haw
- * many frames in each direction (Down, Left, Right, Up).
- * Spritesheets with this added to the file name will use a looping frame
- * animation rather than the back-and-forth default animation.
- *
- * //將[D L R U]添加到您的角色表名稱(帶有$前綴)
- * 每個方向上的多個幀(向下,向左,向右,向上)。
- * 添加到文件名的字符表將從左到右重複循環,
- * 而不是使用來回的默認模式。
- *
- * The first frame should be the idle/still pose.
- * //第一幀應該是空閒/靜止姿勢。
- *
- * eg. $Ralph [8 8 8 8].png
- * is a character sheet consisting of 4 rows with 8 frames per row.
- * Animation will go from frame 1 to 8 then start at 1 again.
- * //例如。 $Ralph [8 8 8 8] .png
- * 是一個由 $(任意名稱) 4行組成的字符表,每行8幀。
- * 動畫將從第1幀到第8幀再從1開始。
- * 又例如: $Ralph [6 6 6 6] .png
- * 是一個由 $(任意名稱) 4行組成的字符表,每行6幀。
- * 動畫將從第1幀到第6幀再從1開始。
- */
- (function() {
- ImageManager.isMultiFrameCharacter = function(filename) {
- var frames = filename.match(/\[(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\]/);
- return frames && frames.length === 5;
- };
- ImageManager.getCharacterFrameCount = function(filename) {
- var frames = filename.match(/\[(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\]/);
- if (!frames) {
- return [3, 3, 3, 3];
- } else {
- return frames.splice(1, 4);
- }
- };
- var _Game_CharacterBase_initMembers = Game_CharacterBase.prototype.initMembers;
- Game_CharacterBase.initMembers = function() {
- _Game_CharacterBase_initMembers.call(this);
- this._isMultiFrame = false;
- this._frames = [3, 3, 3, 3];
- };
- var _Game_CharacterBase_maxPattern = Game_CharacterBase.prototype.maxPattern;
- Game_CharacterBase.prototype.maxPattern = function() {
- if (!this._isMultiFrame) {
- return _Game_CharacterBase_maxPattern.call(this);
- } else {
- return this._frames[(this._direction / 2) - 1];
- }
- };
- var _Game_CharacterBase_pattern = Game_CharacterBase.prototype.pattern;
- Game_CharacterBase.prototype.pattern = function() {
- if (!this._isMultiFrame) {
- return _Game_CharacterBase_pattern.call(this);
- } else {
- return this._pattern < this._frames[this._direction / 2 - 1] ? this._pattern : 0;
- }
- };
- var _Game_CharacterBase_isOriginalPattern = Game_CharacterBase.prototype.isOriginalPattern;
- Game_CharacterBase.prototype.isOriginalPattern = function() {
- if (!this._isMultiFrame) {
- return _Game_CharacterBase_isOriginalPattern.call(this);
- } else {
- return this.pattern() === 0;
- }
- };
- var _Game_CharacterBase_resetPattern = Game_CharacterBase.prototype.resetPattern;
- Game_CharacterBase.prototype.resetPattern = function() {
- if (!this._isMultiFrame) {
- _Game_CharacterBase_resetPattern.call(this);
- } else {
- this.setPattern(0);
- }
- };
- var _Game_CharacterBase_setImage = Game_CharacterBase.prototype.setImage;
- Game_CharacterBase.prototype.setImage = function(characterName, characterIndex) {
- _Game_CharacterBase_setImage.call(this, characterName, characterIndex);
- this._isMultiFrame = ImageManager.isMultiFrameCharacter(characterName);
- this._frames = ImageManager.getCharacterFrameCount(characterName);
- };
- var _Game_CharacterBase_setTileImage = Game_CharacterBase.prototype.setTileImage;
- Game_CharacterBase.prototype.setTileImage = function(tileId) {
- _Game_CharacterBase_setTileImage.call(this, tileId);
- this._isMultiFrame = false;
- this._frames = [3, 3, 3, 3];
- };
- Game_CharacterBase.prototype.isMultiFrame = function() {
- return this._isMultiFrame;
- };
- Game_CharacterBase.prototype.getDirectionFrames = function() {
- return this._frames[this._direction / 2 - 1];
- };
- var _Game_Event_initMembers = Game_Event.prototype.initMembers;
- Game_Event.prototype.initMembers = function() {
- _Game_Event_initMembers.call(this);
- if (this._isMultiFrame) {
- this._originalPattern = 0;
- }
- };
- var _Sprite_Character_patternWidth = Sprite_Character.prototype.patternWidth;
- Sprite_Character.prototype.patternWidth = function() {
- if (!this._character.isMultiFrame()) {
- return _Sprite_Character_patternWidth.call(this);
- } else {
- return this.bitmap.width / this._character.getDirectionFrames();
- }
- };
- })();
复制代码 |
|