VIPArcher_Character_Animations.zip
2.05 KB, 下载次数: 1712
js文件
//============================================================================= // VIPArcher_Character_Animations.js edited by doranikofu //============================================================================= /*: * @plugindesc 行走图动画扩展,八方向|奔跑|待机|多帧 * @author VIPArcher * * @param Dir8_Flag * @desc 素材使用该脚本的标志 * @default % * * @param Frames_Flag * @desc 设置帧数的标志 * @default # * * @param Stand_Wait * @desc 站立等待时长(帧) * @default 5 * * @param Idle_Wait * @desc 待机动画开始等待时长(帧) 从站立等待之后开始计算 * @default 120 * * @help 使用该脚本的行走图素材文件名前面添加一个标志:默认为 % * 文件名的名为规范(默认设置)如下: * %VIPArcher.png , 素材为2*4的标志素材 * 第一行:第一个格子是四方向,第二个格子是四方向奔跑,第三个是四方向待机;//doranikofu edit 顺序改成:待机-行走-奔跑 * 第二行:第一个格子是八方向,第二个格子是八方向奔跑,第三个是八方向待机; * * 使用多帧则名为(默认设置): 文件名#帧数,默认帧.png * 例如 %VIPArcher#6,3.png */ (function() { var parameters = PluginManager.parameters('VIPArcher_Character_Animations'); var dir8_flag = String(parameters['Dir8_Flag'] || '%'); var frame_flag = String(parameters['Frames_Flag'] || '#'); var stand_wait = String(parameters['Stand_Wait'] || '5'); var idle_wait = String(parameters['Idle_Wait'] || '120'); ImageManager.isDir8Character = function(filename) { var reg = new RegExp("^\[\\!\\$\\" + dir8_flag + ']+'); var sign = filename.match(reg); return sign && sign[0].contains(dir8_flag); }; var _Game_CharacterBaseinitMembers = Game_CharacterBase.prototype.initMembers; Game_CharacterBase.prototype.initMembers = function() { _Game_CharacterBaseinitMembers.call(this); this._standWait = 0; this._stepstop = false; //doranikofu stop cylcing idle anime flag //doranikofu this._isStand = false; this._isStand = true; this._isDir8Character = false; }; var _Game_CharacterBasesetImage = Game_CharacterBase.prototype.setImage; Game_CharacterBase.prototype.setImage = function(characterName, characterIndex) { _Game_CharacterBasesetImage.call(this, characterName, characterIndex); this.getCharacterMaxFrame(characterName); if (ImageManager.isDir8Character(characterName)) { this._characterIndex = 0; this._isDir8Character = true; }; }; var _Game_CharacterBaseupdate = Game_CharacterBase.prototype.update; Game_CharacterBase.prototype.update = function() { _Game_CharacterBaseupdate.call(this); if (this.isMoving()) { this._standWait = 0; this._isStand = false; if (this._isDir8Character) { this._stepAnime = false }; } else { this._standWait += 1; if (this._standWait == parseInt(stand_wait)) { //doranikofu this._isStand = true; // this._pattern = 0; //reset to default frame after switching to idle to avoid big pose jumps this._stepstop = false; // reset flag }; // if (this._standWait > parseInt(stand_wait)) { if ((this._isDir8Character) && (this._standWait > (parseInt(stand_wait) + parseInt(idle_wait)))) { //doranikofu add idle wait this._stepAnime = true; if (this._pattern == this._maxFrame - 1) this._stepstop = true; if (this._stepstop) this._pattern = this._maxFrame - 1; }; }; }; }; var _Game_CharacterBasemoveDiagonally = Game_CharacterBase.prototype.moveDiagonally; Game_CharacterBase.prototype.moveDiagonally = function(horz, vert) { _Game_CharacterBasemoveDiagonally.call(this, horz, vert); if (horz > 5) { vert > 5 ? this.setDirection(9) : this.setDirection(7); } else { vert > 5 ? this.setDirection(3) : this.setDirection(1); }; }; Game_CharacterBase.prototype.getCharacterMaxFrame = function(characterName) { var framedate = characterName.match(new RegExp(frame_flag + "(\\d+),(\\d+)")); if (framedate) { this._maxFrame = parseInt(framedate[1]); this._formerPattern = parseInt(framedate[2]); } else{ this._maxFrame = 3; this._formerPattern = 1; }; }; Game_CharacterBase.prototype.pattern = function() { return this._pattern < this.maxFrame() ? this._pattern : 1; }; Game_CharacterBase.prototype.maxFrame = function() { return this._maxFrame; }; Game_CharacterBase.prototype.maxPattern = function() { if (this._maxFrame === 3) { return 4; } else { return this._maxFrame; }; }; Game_CharacterBase.prototype.isOriginalPattern = function() { return this.pattern() === this._formerPattern; }; Game_CharacterBase.prototype.resetPattern = function() { this.setPattern(this._formerPattern); }; Game_CharacterBase.prototype.isFast = function() { return this._standWait < 2 && (this.isDashing() || this._moveSpeed > 4); }; Game_CharacterBase.prototype.isStand = function() { return this._isStand; }; Game_CharacterBase.prototype.setCharacterIndex = function(index) { this._characterIndex = index; }; Game_Player.prototype.moveByInput = function() { if (!this.isMoving() && this.canMove()) { var direction = Input.dir8; if (direction > 0) { $gameTemp.clearDestination(); } else if ($gameTemp.isDestinationValid()){ var x = $gameTemp.destinationX(); var y = $gameTemp.destinationY(); direction = this.findDirectionTo(x, y); } if (direction > 0) { if (direction % 2 == 0){ this.moveStraight(direction); return; } if (direction < 5){ this.moveDiagonally(direction + 3 , 2); } else { this.moveDiagonally(direction - 3 , 8); } } } }; var _Game_PlayermoveDiagonally = Game_Player.prototype.moveDiagonally; Game_Player.prototype.moveDiagonally = function(horz, vert) { if (!this.canPass(this._x, this._y, horz) && !this.canPass(this._x, this._y, vert)){ this.setMovementSuccess(false); return; } if (this.canPass(this._x, this._y, horz) && !this.canPass(this._x, this._y, vert)){ this.moveStraight(horz); return; } if (this.canPass(this._x, this._y, vert) && !this.canPass(this._x, this._y, horz)){ this.moveStraight(vert); return; } if (!this.canPassDiagonally(this._x, this._y, horz, vert)) { if (Math.random() > 0.5){ this.setDirection(vert); this.moveStraight(vert); } else { this.setDirection(horz); this.moveStraight(horz); } return; } _Game_PlayermoveDiagonally.call(this, horz, vert); }; Sprite_Character.prototype.characterPatternY = function() { if (this._character.direction() % 2 == 0){ if (this._character._isDir8Character){ this._character.setCharacterIndex(this._character.isFast() ? 2 : this._character.isStand() ? 0 : 1); //doranikofu changed index }; return (this._character.direction() - 2) / 2; } else { if (this._character._isDir8Character){ this._character.setCharacterIndex(this._character.isFast() ? 6 : this._character.isStand() ? 4 : 5); //doranikofu changed index }; return parseInt((this._character.direction() + 1) / 3); } }; Sprite_Character.prototype.patternWidth = function() { if (this._tileId > 0) { return $gameMap.tileWidth(); } else if (this._isBigCharacter) { return this.bitmap.width / this._character.maxFrame(); } else { return this.bitmap.width / (this._character.maxFrame() * 4); } }; Sprite_Character.prototype.characterBlockX = function() { if (this._isBigCharacter) { return 0; } else { var index = this._character.characterIndex(); return (index % 4) * this._character.maxFrame(); } }; })();
//===========================trigger action for diagonal Game_Map.prototype.roundXWithDirection = function(x, d) { return this.roundX(x + (d%3 === 0 ? 1 : (d+2)%3 === 0 ? -1 : 0)); }; Game_Map.prototype.roundYWithDirection = function(y, d) { return this.roundY(y + (d<4 ? 1 : d>6 ? -1 : 0)); }; Game_Character.prototype.turnTowardCharacter = function(character) { var sx = this.deltaXFrom(character.x); var sy = this.deltaYFrom(character.y); var radian = Math.atan2(sx,sy) + Math.PI; this.setDirection( radian < Math.PI / 8.0 * 1.0 ? 2 : radian < Math.PI / 8.0 * 3.0 ? 3 : radian < Math.PI / 8.0 * 5.0 ? 6 : radian < Math.PI / 8.0 * 7.0 ? 9 : radian < Math.PI / 8.0 * 9.0 ? 8 : radian < Math.PI / 8.0 * 11.0 ? 7 : radian < Math.PI / 8.0 * 13.0 ? 4 : radian < Math.PI / 8.0 * 15.0 ? 1 : 2 ); }; Game_Character.prototype.turnAwayFromCharacter = function(character) { var sx = this.deltaXFrom(character.x); var sy = this.deltaYFrom(character.y); var radian = Math.atan2(sx,sy) + Math.PI; this.setDirection( radian < Math.PI / 8.0 * 1.0 ? 8 : radian < Math.PI / 8.0 * 3.0 ? 7 : radian < Math.PI / 8.0 * 5.0 ? 4 : radian < Math.PI / 8.0 * 7.0 ? 1 : radian < Math.PI / 8.0 * 9.0 ? 2 : radian < Math.PI / 8.0 * 11.0 ? 3 : radian < Math.PI / 8.0 * 13.0 ? 6 : radian < Math.PI / 8.0 * 15.0 ? 9 : 8 ); };
未标题-1.png (315.79 KB, 下载次数: 48)
未标题-2.png (497.05 KB, 下载次数: 50)
ll879 发表于 2017-5-14 09:24
请教一个问题,在使用脚本的时候,人物走路发飘,人物动画走路是一格的话,实际走路将近三格,该如何解决, ...
ll879 发表于 2017-5-14 09:24
请教一个问题,在使用脚本的时候,人物走路发飘,人物动画走路是一格的话,实际走路将近三格,该如何解决, ...
360截图-15695806.jpg (4.58 KB, 下载次数: 69)
ziyingyie 发表于 2018-8-10 14:49
选用人物行走素材后是这样的 文件名是:%xie#10,0.png
这是什么情况呀?
doranikofu 发表于 2015-12-15 14:01
最近改了一些,往文件名里面塞参数判定是否需要全部3中动作还是只要一部分
不过貌似和npc对话的时候没有8 ...
%lan#8,0.png (977.22 KB, 下载次数: 58)
ashley_blade 发表于 2019-4-28 02:33
请问如何让人物在停止移动时立即切换至待机动画然后一直保持待机直到开始移动?
我发现走路姿势中间不加站 ...
12345678.PNG (4.59 KB, 下载次数: 46)
E十九R 发表于 2019-5-11 22:31
6帧的那个后缀我给图片加上后就成这样了
不明白是怎么回事
Soracyti 发表于 2019-9-15 17:51
请问这个8方向的动画是和哪个移动插件配套用的啊 原版只有4方向呀
左羊tgbt 发表于 2023-5-21 20:10
请问下待机动作可以设置成隔一段时间循环一次吗?现在是只要触发就开始无限循环,特别鬼畜 ...
KKsumu 发表于 2020-7-3 16:59
请问一下,我用了1.5版本插件之后,游戏无法存档,提示this._actors.map is not a function,该怎么办? ...
左羊tgbt 发表于 2023-5-21 22:22
请问你解决了吗,我也没办法存档
欢迎光临 Project1 (https://rpg.blue/) | Powered by Discuz! X3.1 |