查看: 3762|回复: 0

[已经过期] 找到一个状态动画插件,求教怎么让动画循环

[复制链接]
梦石
0
星屑
75
在线时间
231 小时
注册时间
2014-10-5
回帖
226
发表于 2016-1-24 17:21:53 | 显示全部楼层 |阅读模式

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

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

×
外站上找到一个插件,作用是在战斗场景,
如果附加了某个状态,会播放一个动画,
在这个状态消失的时候,播放另外一个动画,
我感觉这个插件是一个很大的启发,
如果,
在这个插件的基础上,
把播放的这个动画设置成无限循环播放,
然后在状态消失,播放另一个动画的时候停止,
这样不就可以做出来累死大话梦话那样的状态动画了吗?
求大神来帮忙看看插件,怎么设置动画循环我不会写,
插件指令
在状态的注释里面写:
<state add animation: 125 />  在附加这个状态时候,播放125号动画
<state remove animation: 126 /> 在状态消失的时候,播放126号动画
  1. var Imported = Imported || {} ;
  2. var TH = TH || {};
  3. Imported.StateChangeAnimations = 1;
  4. TH.StateChangeAnimations = TH.StateChangeAnimations || {};

  5. (function ($) {

  6.   $.stateAddRegex = /<state[-_ ]add[-_ ]animation:\s*(\d+)\s*\/>/im
  7.   $.stateRemoveRegex = /<state[-_ ]remove[-_ ]animation:\s*(\d+)\s*\/>/im
  8.   
  9.   $.stateAddAnimation = function(state) {
  10.     if (state.stateAddAnimation === undefined) {
  11.       data = {id: 0, mirror: false, delay: 0};
  12.       var res = $.stateAddRegex.exec(state.note);
  13.       if (res) {
  14.         data.id = Math.floor(res[1]);
  15.       }
  16.       state.stateAddAnimation = data;
  17.     }
  18.     return state.stateAddAnimation;
  19.   };
  20.   
  21.   $.stateRemoveAnimation = function(state) {
  22.     if (state.stateRemoveAnimation === undefined) {
  23.       data = {id: 0, mirror: false, delay: 0};
  24.       var res = $.stateRemoveRegex.exec(state.note);
  25.       if (res) {
  26.         data.id = Math.floor(res[1]);
  27.       }
  28.       state.stateRemoveAnimation = data;
  29.     }
  30.     return state.stateRemoveAnimation;
  31.   };

  32.   var TH_GameBattlerBase_addNewState = Game_BattlerBase.prototype.addNewState;
  33.   Game_BattlerBase.prototype.addNewState = function(stateId) {
  34.     TH_GameBattlerBase_addNewState.call(this, stateId);
  35.     this.playStateAddAnimation(stateId);
  36.   };
  37.   
  38.   var TH_GameBattlerBase_eraseState = Game_BattlerBase.prototype.eraseState;
  39.   Game_BattlerBase.prototype.eraseState = function(stateId) {
  40.     if (this.isStateAffected(stateId)) {
  41.       this.playEraseStateAnimation(stateId);
  42.     }
  43.     TH_GameBattlerBase_eraseState.call(this, stateId);   
  44.   };
  45.   
  46.   Game_BattlerBase.prototype.playStateAddAnimation = function(stateId) {
  47.     var state = $dataStates[stateId];
  48.     var data = $.stateAddAnimation(state);
  49.     if (data.id > 0) {
  50.       this.startAnimation(data.id, data.mirror, data.delay);
  51.     }
  52.   };
  53.   
  54.   Game_BattlerBase.prototype.playEraseStateAnimation = function(stateId) {
  55.     var state = $dataStates[stateId];
  56.     var data = $.stateRemoveAnimation(state);
  57.     if (data.id > 0) {
  58.       this.startAnimation(data.id, data.mirror, data.delay);
  59.     }
  60.   };
  61. })(TH.StateChangeAnimations);
复制代码
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部