Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var COLD = COLD || {};
- (function(){
- COLD.animatedWindow = {
- windowBaseUpdate : Window_Base.prototype.update,
- windowBaseInitialize : Window_Base.prototype.initialize,
- originalSetBattler : Sprite_Actor.prototype.setBattler,
- originalInitialize : Sprite_Actor.prototype.initialize,
- newSetBattler : function(battler){
- Sprite_Battler.prototype.setBattler.call(this, battler);
- var changed = (battler !== this._actor);
- if (changed) {
- this._actor = battler;
- this._stateSprite.setup(battler);
- };
- },
- newInitialize : function(battler) {Sprite_Battler.prototype.initialize.call(this, battler);},
- modifyActorSprite : function(value){
- if(value == 'new'){
- Sprite_Actor.prototype.initialize = COLD.animatedWindow.newInitialize
- Sprite_Actor.prototype.setBattler = COLD.animatedWindow.newSetBattler;
- }else{
- Sprite_Actor.prototype.initialize = COLD.animatedWindow.originalInitialize;
- Sprite_Actor.prototype.setBattler = COLD.animatedWindow.originalSetBattler;
- };
- }
- };
- })();
- (function($){
- $.prototype.drawAnimatedActor = function(actor, x, y, motion){
- if(x <= this.width && y <= this.height){
- COLD.animatedWindow.modifyActorSprite('new');
- this._actorSprite = new Sprite_Actor();
- this._actorSprites.addChild(this._actorSprite);
- this._actorSprite.setBattler(actor);
- this._actorSprite.setHome(x, y);
- this.actorMotions.push(motion);
- COLD.animatedWindow.modifyActorSprite('original');
- };
- };
- $.prototype.update = function(){
- COLD.animatedWindow.windowBaseUpdate.call(this);
- if(this._actorSprites.children.length > 0){
- this.updateActors();
- };
- };
- $.prototype.initialize = function(x, y, width, height){
- COLD.animatedWindow.windowBaseInitialize.call(this,x,y,width,height);
- this._actorSprites = new Sprite();
- this.addChild(this._actorSprites);
- this.actorMotions = [];
- };
- $.prototype.updateActors = function(){
- var childs = this._actorSprites.children;
- for (var i = 0; i < childs.length; i++){
- if(childs[i]._motionCount == 0){
- childs[i].startMotion(this.actorMotions[i]);
- };
- };
- };
- })(Window_Base);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement