找到一个状态动画插件,求教怎么让动画循环
外站上找到一个插件,作用是在战斗场景,如果附加了某个状态,会播放一个动画,
在这个状态消失的时候,播放另外一个动画,
我感觉这个插件是一个很大的启发,
如果,
在这个插件的基础上,
把播放的这个动画设置成无限循环播放,
然后在状态消失,播放另一个动画的时候停止,
这样不就可以做出来累死大话梦话那样的状态动画了吗?
求大神来帮忙看看插件,怎么设置动画循环我不会写,
插件指令
在状态的注释里面写:
在附加这个状态时候,播放125号动画
在状态消失的时候,播放126号动画
JAVASCRIPT 代码
var Imported = Imported || {} ;
var TH = TH || {};
Imported.StateChangeAnimations = 1;
TH.StateChangeAnimations = TH.StateChangeAnimations || {};
(function($){
$.stateAddRegex = //im
$.stateRemoveRegex = //im
$.stateAddAnimation = function(state){
if(state.stateAddAnimation === undefined){
data = {id: 0, mirror: false, delay: 0};
var res = $.stateAddRegex.exec(state.note);
if(res){
data.id = Math.floor(res);
}
state.stateAddAnimation = data;
}
return state.stateAddAnimation;
};
$.stateRemoveAnimation = function(state){
if(state.stateRemoveAnimation === undefined){
data = {id: 0, mirror: false, delay: 0};
var res = $.stateRemoveRegex.exec(state.note);
if(res){
data.id = Math.floor(res);
}
state.stateRemoveAnimation = data;
}
return state.stateRemoveAnimation;
};
var TH_GameBattlerBase_addNewState = Game_BattlerBase.prototype.addNewState;
Game_BattlerBase.prototype.addNewState = function(stateId){
TH_GameBattlerBase_addNewState.call(this, stateId);
this.playStateAddAnimation(stateId);
};
var TH_GameBattlerBase_eraseState = Game_BattlerBase.prototype.eraseState;
Game_BattlerBase.prototype.eraseState = function(stateId){
if(this.isStateAffected(stateId)){
this.playEraseStateAnimation(stateId);
}
TH_GameBattlerBase_eraseState.call(this, stateId);
};
Game_BattlerBase.prototype.playStateAddAnimation = function(stateId){
var state = $dataStates;
var data = $.stateAddAnimation(state);
if(data.id > 0){
this.startAnimation(data.id, data.mirror, data.delay);
}
};
Game_BattlerBase.prototype.playEraseStateAnimation = function(stateId){
var state = $dataStates;
var data = $.stateRemoveAnimation(state);
if(data.id > 0){
this.startAnimation(data.id, data.mirror, data.delay);
}
};
})(TH.StateChangeAnimations);
本帖来自P1论坛作者RM无节操小分队,因Project1站服务器在国外有时候访问缓慢不方便作者交流学习,经联系P1站长fux2同意署名转载一起分享游戏制作经验,共同为国内独立游戏作者共同创造良好交流环境,原文地址:https://rpg.blue/forum.php?mod=viewthread&tid=388679若有侵权,发帖作者可联系底部站长QQ在线咨询功能删除,谢谢。
页:
[1]