//============================================================================== // Feng_MoveFrame.js //============================================================================== /*: * @plugindesc (v1.0)Define Character Sprites on your own. * 自定义行走图 * @author 风宥雪 * * @help This plugin does not provide plugin commands. * Version 1.0 * *功能:自定义人物移动帧数,如name[s6][m12].png,表示人物6帧图片 *为站立(stand)图,12帧图片为行走(move)图; * */ Sprite_Character.prototype.setCharacterBitmap = function() { //源代码 this.bitmap = ImageManager.loadCharacter(this._characterName); this._isBigCharacter = ImageManager.isBigCharacter(this._characterName); //以下为添加 this._character._total_frame = 0; this._character._change_frame = false; var sub_str = String(this._characterName).match(/\[s(\d+)\]/i); if (sub_str) { this._character._frame_s = Number(sub_str[1]); this._character._change_frame = true; this._character._total_frame += this._character._frame_s; } else this._character._frame_s = 0; sub_str = String(this._characterName).match(/\[m(\d+)\]/i); if (sub_str) { this._character._frame_m = Number(sub_str[1]); this._character._change_frame = true; this._character._total_frame += this._character._frame_m; } else this._character._frame_m = 0; if (this._character._total_frame == 0) //防错处理 this._character._total_frame = 4; }; Sprite_Character.prototype.characterBlockX = function() { if(this._character._change_frame) return 0; else { if (this._isBigCharacter) { return 0; } else { var index = this._character.characterIndex(); return index % 4 * 3; } } }; Sprite_Character.prototype.characterBlockY = function() { if(this._character._change_frame) return 0; else { if (this._isBigCharacter) { return 0; } else { var index = this._character.characterIndex(); return Math.floor(index / 4) * 4; } } }; Sprite_Character.prototype.patternWidth = function() { if (this._tileId > 0) { return $gameMap.tileWidth(); } else if(this._character._change_frame) { return this.bitmap.width / this._character._total_frame; } else { if (this._isBigCharacter) { return this.bitmap.width / 3; } else { return this.bitmap.width / 12; } } }; Sprite_Character.prototype.patternHeight = function() { if (this._tileId > 0) { return $gameMap.tileWidth(); } else if(this._character._change_frame) { return this.bitmap.height / 4; } else { if (this._isBigCharacter) { return this.bitmap.height / 4; } else { return this.bitmap.height / 8; } } }; var feng_char_base_initMembers = Game_CharacterBase.prototype.initMembers; Game_CharacterBase.prototype.initMembers = function() { feng_char_base_initMembers.call(this); this._moveSpeed = 4; //在这里可以更改角色移动速度 this._pattern = 0; this._total_frame = 0; this._change_frame = false; this._frame_s = 0; this._frame_m = 0; }; Game_CharacterBase.prototype.updateAnimationCount = function() { if (this.isMoving() && this.hasWalkAnime()) { this._animationCount += 2.0; //在这里可以更改跑步动画刷新速度(默认1.5) //静止有动态图时也要更新计数 } else if (this.hasStepAnime() || !this.isOriginalPattern() || this._frame_s > 1 || this.hasWalkAnime()) { this._animationCount++; } }; Game_CharacterBase.prototype.updatePattern = function() { if(this._change_frame) { if (!this.hasStepAnime() && this._stopCount > 0) { if (this._frame_s == 0) this._pattern = (this._pattern + 1) % this._frame_m; else this._pattern = (this._pattern + 1) % this._frame_s; } else { if (this._frame_m == 0) this._pattern = (this._pattern + 1) % this._frame_s; else//有行走图则采用行走图 { var temp = (this._pattern - this._frame_s + 1) % this._frame_m; this._pattern= this._frame_s + (temp > 0 ? temp : 0); } } } else { if (!this.hasStepAnime() && this._stopCount > 0) { this.resetPattern(); } else { this._pattern = (this._pattern + 1) % this.maxPattern(); } } }; Game_CharacterBase.prototype.maxPattern = function() { return this._total_frame; }; Game_CharacterBase.prototype.pattern = function() { if(this._change_frame) return this._pattern; else return this._pattern < 3 ? this._pattern : 1; }; Game_CharacterBase.prototype.setDirection = function(d) { if (!this.isDirectionFixed() && d) { this._direction = d; } };
1[s15].png (241.62 KB, 下载次数: 11)
NPC009[m4][s4].png (576.09 KB, 下载次数: 18)
草药-延年果[s4].png (30.28 KB, 下载次数: 8)
j296196585 发表于 2017-9-5 20:52
理论支持 无限幅
j296196585 发表于 2017-9-5 20:52
理论支持 无限幅
欢迎光临 Project1 (https://rpg.blue/) | Powered by Discuz! X3.1 |