设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 34337|回复: 76
打印 上一主题 下一主题

[原创发布] 【行走图动画扩展】八方向|奔跑|待机|多帧

[复制链接]

Lv4.逐梦者 (版主)

无限の剣制

梦石
0
星屑
9951
在线时间
5019 小时
注册时间
2013-2-28
帖子
5030

开拓者贵宾

跳转到指定楼层
1
发表于 2015-11-30 01:25:18 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
本帖最后由 VIPArcher 于 2019-7-29 10:04 编辑
1.5新版本 (使用多文件以后缀名区分姿势)
1.0旧版本 (各姿势素材在同一张行走图上)

有啥问题就直接回帖子反馈吧,我没素材进行测试,理论上应该是可以玩了。
配一张瞎糊的测试用素材(1.0版本使用)

1.5版本素材规格参考这个帖子:
https://rpg.blue/thread-411249-1-1.html

VIPArcher_Character_Animations.zip

2.05 KB, 下载次数: 1688

js文件

点评

说版本太旧用不了了, 大大要不有空更新一下~~  发表于 2021-11-26 18:31
https://rpg.blue/forum.php?mod=redirect&goto=findpost&ptid=487885&pid=2936642&fromuid=2652223  发表于 2021-11-26 18:30

评分

参与人数 2星屑 +60 梦石 +2 收起 理由
余烬之中 + 2 图 书 馆
doranikofu + 60 塞糖

查看全部评分

Lv2.观梦者

梦石
0
星屑
676
在线时间
224 小时
注册时间
2006-12-7
帖子
839
2
发表于 2015-11-30 01:39:40 | 只看该作者
那啥文件名前缀特殊符号好像挺多内置设定的
用%前缀 貌似跟随人物关闭之后还是会显示而且显示出错 都改成数字前缀了不敢随便用特殊符号了

点评

用多帧的话需要细节改进,哥目前是待机-行走-跑步。待机动作默认第一帧不step,等待时间满了以后再step,而且只放一次,打算改一下这个  发表于 2015-11-30 02:02
汝这个没问题 之前不知道改了啥 死活找不到问题在哪 隐藏跟随的话就找到一个函数吧visible变量设置成false 不知道为啥读取错误 后来把前缀改了就好了  发表于 2015-11-30 01:59
显示啥出错?我测试貌似没啥问题【不过我也没怎么测试过  发表于 2015-11-30 01:42
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
676
在线时间
224 小时
注册时间
2006-12-7
帖子
839
3
发表于 2015-11-30 03:14:06 | 只看该作者
改了一下适应不同需求
改动:
1.图片顺序改成:待机-行走-跑步
2.增加待机动画播放等待时间。移动停止之后,插件原始变量等待时间到达之后会切换到待机动画默认帧(插件里frames flag变量)的那一帧。继续等待Idle_Wait之后才开始播放待机动画
3.待机动画播放到最大帧之后会停留在这一帧,不会循环播放(需要的话可以加变量设置是否需要循环)
4.微调整显示。从行走动作切换到待机动作之后,直接切换回待机动作的初始帧。

如果做多帧的话动作衔接细节要复杂一些,比如行走动画循环里面不能插入待机动作的帧,所以需要分开设置。共享两个10帧的行走图可以体验一下
已经测试了npc,跟随人物和主角都没有问题。唯一的麻烦点的就是目前跑步动作判定似乎是按照速度,这样如果主角行走速度低的话,跑起来跟随人物还是行走动作。因为跟随人物的数值基本都是主角抄过来的。

修改过的代码
JAVASCRIPT 代码复制
  1. //=============================================================================
  2. // VIPArcher_Character_Animations.js edited by doranikofu
  3. //=============================================================================
  4. /*:
  5.  * @plugindesc 行走图动画扩展,八方向|奔跑|待机|多帧
  6.  * @author VIPArcher
  7.  *
  8.  * @param Dir8_Flag
  9.  * @desc 素材使用该脚本的标志
  10.  * @default %
  11.  *
  12.  * @param Frames_Flag
  13.  * @desc 设置帧数的标志
  14.  * @default #
  15.  *
  16.  * @param Stand_Wait
  17.  * @desc 站立等待时长(帧)
  18.  * @default 5
  19.  *
  20.  * @param Idle_Wait
  21.  * @desc 待机动画开始等待时长(帧) 从站立等待之后开始计算
  22.  * @default 120
  23.  *
  24.  * @help 使用该脚本的行走图素材文件名前面添加一个标志:默认为 %
  25.  * 文件名的名为规范(默认设置)如下:
  26.  * %VIPArcher.png , 素材为2*4的标志素材
  27.  * 第一行:第一个格子是四方向,第二个格子是四方向奔跑,第三个是四方向待机;//doranikofu edit 顺序改成:待机-行走-奔跑
  28.  * 第二行:第一个格子是八方向,第二个格子是八方向奔跑,第三个是八方向待机;
  29.  *
  30.  * 使用多帧则名为(默认设置): 文件名#帧数,默认帧.png
  31.  * 例如 %VIPArcher#6,3.png
  32.  */
  33. (function() {
  34.     var parameters = PluginManager.parameters('VIPArcher_Character_Animations');
  35.     var dir8_flag  = String(parameters['Dir8_Flag']   || '%');
  36.     var frame_flag = String(parameters['Frames_Flag'] || '#');
  37.     var stand_wait = String(parameters['Stand_Wait']  || '5');
  38.     var idle_wait = String(parameters['Idle_Wait']  || '120');
  39.     ImageManager.isDir8Character = function(filename) {
  40.         var reg = new RegExp("^\[\\!\\$\\" + dir8_flag + ']+');
  41.         var sign = filename.match(reg);
  42.         return sign && sign[0].contains(dir8_flag);
  43.     };
  44.     var _Game_CharacterBaseinitMembers = Game_CharacterBase.prototype.initMembers;
  45.     Game_CharacterBase.prototype.initMembers = function() {
  46.         _Game_CharacterBaseinitMembers.call(this);
  47.         this._standWait = 0;
  48.                 this._stepstop = false;        //doranikofu stop cylcing idle anime flag
  49.        //doranikofu                this._isStand = false;
  50.                 this._isStand = true;
  51.         this._isDir8Character = false;
  52.     };
  53.     var _Game_CharacterBasesetImage = Game_CharacterBase.prototype.setImage;
  54.     Game_CharacterBase.prototype.setImage = function(characterName, characterIndex) {
  55.         _Game_CharacterBasesetImage.call(this, characterName, characterIndex);
  56.         this.getCharacterMaxFrame(characterName);
  57.         if (ImageManager.isDir8Character(characterName)) {
  58.             this._characterIndex  = 0;
  59.             this._isDir8Character = true;
  60.         };
  61.     };
  62.     var _Game_CharacterBaseupdate = Game_CharacterBase.prototype.update;
  63.     Game_CharacterBase.prototype.update = function() {
  64.         _Game_CharacterBaseupdate.call(this);
  65.         if (this.isMoving()) {
  66.             this._standWait = 0;
  67.             this._isStand = false;
  68.             if (this._isDir8Character) { this._stepAnime = false };
  69.         } else {
  70.             this._standWait += 1;
  71.                         if (this._standWait == parseInt(stand_wait)) {                //doranikofu
  72.                 this._isStand = true;                                                        //
  73.                                 this._pattern = 0;                                                                //reset to default frame after switching to idle to avoid big pose jumps
  74.                                 this._stepstop = false;                                                        // reset flag
  75.                         };                                                                                                        //
  76.                 if (this._standWait > parseInt(stand_wait)) {
  77.                             if ((this._isDir8Character) && (this._standWait > (parseInt(stand_wait) + parseInt(idle_wait)))) {        //doranikofu add idle wait
  78.                                                 this._stepAnime = true;
  79.                                                 if (this._pattern == this._maxFrame - 1) this._stepstop = true;
  80.                                                 if (this._stepstop) this._pattern = this._maxFrame - 1;
  81.                                                 };
  82.             };
  83.         };
  84.     };
  85.     var _Game_CharacterBasemoveDiagonally = Game_CharacterBase.prototype.moveDiagonally;
  86.     Game_CharacterBase.prototype.moveDiagonally = function(horz, vert) {
  87.         _Game_CharacterBasemoveDiagonally.call(this, horz, vert);
  88.         if (horz > 5) {
  89.             vert > 5 ? this.setDirection(9) : this.setDirection(7);
  90.         } else {
  91.             vert > 5 ? this.setDirection(3) : this.setDirection(1);
  92.         };
  93.     };
  94.     Game_CharacterBase.prototype.getCharacterMaxFrame = function(characterName) {
  95.         var framedate = characterName.match(new RegExp(frame_flag + "(\\d+),(\\d+)"));
  96.         if (framedate) {
  97.             this._maxFrame = parseInt(framedate[1]);
  98.             this._formerPattern = parseInt(framedate[2]);
  99.         } else{
  100.             this._maxFrame = 3;
  101.             this._formerPattern = 1;
  102.         };
  103.     };
  104.     Game_CharacterBase.prototype.pattern = function() {
  105.         return this._pattern < this.maxFrame() ? this._pattern : 1;
  106.     };
  107.     Game_CharacterBase.prototype.maxFrame = function() {
  108.         return this._maxFrame;
  109.     };
  110.     Game_CharacterBase.prototype.maxPattern = function() {
  111.         if (this._maxFrame === 3) {
  112.             return 4;
  113.         } else {
  114.             return this._maxFrame;
  115.         };
  116.     };
  117.     Game_CharacterBase.prototype.isOriginalPattern = function() {
  118.         return this.pattern() === this._formerPattern;
  119.     };
  120.     Game_CharacterBase.prototype.resetPattern = function() {
  121.         this.setPattern(this._formerPattern);
  122.     };
  123.     Game_CharacterBase.prototype.isFast = function() {
  124.         return this._standWait < 2 && (this.isDashing() || this._moveSpeed > 4);
  125.     };
  126.     Game_CharacterBase.prototype.isStand = function() {
  127.         return this._isStand;
  128.     };
  129.     Game_CharacterBase.prototype.setCharacterIndex = function(index) {
  130.         this._characterIndex = index;
  131.     };
  132.     Game_Player.prototype.moveByInput = function() {
  133.         if (!this.isMoving() && this.canMove()) {
  134.             var direction = Input.dir8;
  135.             if (direction > 0) {
  136.                 $gameTemp.clearDestination();
  137.             } else if ($gameTemp.isDestinationValid()){
  138.                 var x = $gameTemp.destinationX();
  139.                 var y = $gameTemp.destinationY();
  140.                 direction = this.findDirectionTo(x, y);
  141.             }
  142.             if (direction > 0) {
  143.                 if (direction % 2 == 0){
  144.                     this.moveStraight(direction);
  145.                     return;
  146.                 }
  147.                 if (direction < 5){
  148.                     this.moveDiagonally(direction + 3 , 2);
  149.                 } else {
  150.                     this.moveDiagonally(direction - 3 , 8);
  151.                 }
  152.             }
  153.         }
  154.     };
  155.     var _Game_PlayermoveDiagonally = Game_Player.prototype.moveDiagonally;
  156.     Game_Player.prototype.moveDiagonally = function(horz, vert) {
  157.         if (!this.canPass(this._x, this._y, horz) && !this.canPass(this._x, this._y, vert)){
  158.             this.setMovementSuccess(false);
  159.             return;
  160.         }
  161.         if (this.canPass(this._x, this._y, horz) && !this.canPass(this._x, this._y, vert)){
  162.             this.moveStraight(horz);
  163.             return;
  164.         }
  165.         if (this.canPass(this._x, this._y, vert) && !this.canPass(this._x, this._y, horz)){
  166.             this.moveStraight(vert);
  167.             return;
  168.         }
  169.         if (!this.canPassDiagonally(this._x, this._y, horz, vert)) {
  170.             if (Math.random() > 0.5){
  171.                 this.setDirection(vert); this.moveStraight(vert);
  172.             } else {
  173.                 this.setDirection(horz); this.moveStraight(horz);
  174.             }
  175.             return;
  176.         }
  177.         _Game_PlayermoveDiagonally.call(this, horz, vert);
  178.     };
  179.     Sprite_Character.prototype.characterPatternY = function() {
  180.         if (this._character.direction() % 2 == 0){
  181.             if (this._character._isDir8Character){
  182.                 this._character.setCharacterIndex(this._character.isFast() ? 2 : this._character.isStand() ? 0 : 1);        //doranikofu changed index
  183.             };
  184.             return (this._character.direction() - 2) / 2;
  185.         } else {
  186.             if (this._character._isDir8Character){
  187.                 this._character.setCharacterIndex(this._character.isFast() ? 6 : this._character.isStand() ? 4 : 5);        //doranikofu changed index
  188.             };
  189.             return parseInt((this._character.direction() + 1) / 3);
  190.         }
  191.     };
  192.     Sprite_Character.prototype.patternWidth = function() {
  193.         if (this._tileId > 0) {
  194.             return $gameMap.tileWidth();
  195.         } else if (this._isBigCharacter) {
  196.             return this.bitmap.width / this._character.maxFrame();
  197.         } else {
  198.             return this.bitmap.width / (this._character.maxFrame() * 4);
  199.         }
  200.     };
  201.     Sprite_Character.prototype.characterBlockX = function() {
  202.         if (this._isBigCharacter) {
  203.             return 0;
  204.         } else {
  205.             var index = this._character.characterIndex();
  206.             return (index % 4) * this._character.maxFrame();
  207.         }
  208.     };
  209. })();


效果图, 左下是主角和跟随的待机,右上是npc


素材图下载-自己做的仙剑奇侠传5前传人物模型渲染拼好的图
characters.rar (3.5 MB, 下载次数: 2795)

评分

参与人数 2星屑 +11 收起 理由
夏末渐离 + 10 我很赞同
西姐 + 1 精品文章

查看全部评分

回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
676
在线时间
224 小时
注册时间
2006-12-7
帖子
839
4
发表于 2015-12-15 14:01:50 | 只看该作者
最近改了一些,往文件名里面塞参数判定是否需要全部3中动作还是只要一部分

不过貌似和npc对话的时候没有8向判定么,菊苣打算做一个么?

点评

待机状态好像不是循环的,你应该是用的@doranikofu 改了之后的版本,你看他写的改动说明就知道了。=。= 拼素材按脚本说明里说的方式拼就可以了  发表于 2015-12-16 23:02
之前试了一下,待机状态好像不是循环的,手抬起来之后就不动了。我只有八帧的行走图,一样格式的拼有用吗  发表于 2015-12-16 17:13
我现在也觉得合并文件好√。还是那句话:拼一下素材又不难。  发表于 2015-12-16 13:13
合并文件比较好,之前分文件的时候,第一次切换动作有明显卡顿,这次mv读文件似乎是比较慢。如果一个文件存的话只会第一次进场景慢一点  发表于 2015-12-16 09:50
是 斜向触发事件的时候如果是八向npc的话要能也斜向回应就好了,目前是触发不了  发表于 2015-12-16 09:49
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
60
在线时间
77 小时
注册时间
2015-12-10
帖子
17
5
发表于 2015-12-15 15:08:43 | 只看该作者
搞大量行走图存在的意义?  公共事件如果C被按下加速+1,换主角奔跑行走图 不就实现了吗

点评

请问如何设置C或者别的什么键被按下,事件脚本还是别的?  发表于 2019-1-18 09:30
回复 支持 0 反对 2

使用道具 举报

Lv2.观梦者

梦石
0
星屑
676
在线时间
224 小时
注册时间
2006-12-7
帖子
839
6
发表于 2015-12-18 06:19:53 | 只看该作者
还有一个问题
最近用那个analog move插件 SAN_AnalogMove
那个里面方向3是右下,方向7是左上,是他搞错了么
默认脚本里面有奇数的方向定义么
用这个插件的话鼠标移动会流畅好多,不过方向3/7会抽,还没彻底解决
改这两个替换3/7只后显示正常了
Game_AnalogMove.prototype.dir8ToRadian
Game_AnalogMove.prototype.radianToDir8

但是
Game_AnalogMove.prototype.dir8ToRadian
改了以后键盘如果右下的话人物左上移动
键盘左上人物右下移动。。。鼠标移动不影响

不改的话控制正常,但是切换场景的时候如果保留方向,左上移动切换场景就自动变成右下方向了。。。
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
506
在线时间
221 小时
注册时间
2011-8-15
帖子
90
7
发表于 2015-12-26 11:09:34 | 只看该作者
8 帧有问题的,明显在2帧之间晃动
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
506
在线时间
221 小时
注册时间
2011-8-15
帖子
90
8
发表于 2015-12-26 11:33:03 | 只看该作者
已经找到问题了,但是待机动画的时候不是循环的吗?单独播放一次后就停住了

点评

PS,开切片工具或者网格或者辅助线  发表于 2015-12-28 19:13
我能问你一下,你是怎么拼八方向图的。。我拼出来的老是不对,我的素材比较大  发表于 2015-12-28 19:03
是循环的,主楼的原版插件就是循环的 @doranikofu 改过的版本是不循环的。你可以自己选择使用  发表于 2015-12-26 11:54
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
275
在线时间
2 小时
注册时间
2010-11-18
帖子
1
9
发表于 2015-12-28 16:34:56 | 只看该作者
我想问一下大大们, 怎样保持四方向然后又能使用多帧的行走图咧?  在下小白 麻烦大大们帮忙解答啦!!拜托啦!!

点评

那你把八方向的部分素材也用四方向的就好了呗。  发表于 2015-12-28 17:04
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
506
在线时间
221 小时
注册时间
2011-8-15
帖子
90
10
发表于 2015-12-29 16:13:38 | 只看该作者
aaaassss123 发表于 2015-12-26 11:33
已经找到问题了,但是待机动画的时候不是循环的吗?单独播放一次后就停住了 ...

那个拼图上面应该有发出来,原版的应该是行走-待机-跑步,改版的是待机-行走-跑步,第二行则是8方向的,我只用到4方向。所以第二行是和第一行一样的
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-4-25 14:27

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表