So hi guys,
I was wondering because I want to do something like a atb system similar to this :
the problem in Ruby it's easy...but in JS it's kinda weird...I just don't know how to do a proper "each" method.
here my coding...in simple this really similar to game_Battler I just don't know how to initialize it
thanks for any further answer
I was wondering because I want to do something like a atb system similar to this :
the problem in Ruby it's easy...but in JS it's kinda weird...I just don't know how to do a proper "each" method.
here my coding...in simple this really similar to game_Battler I just don't know how to initialize it
var NioPlugin = NioPlugin || {};
var NioPlugin.ATB_GUI = NioPlugin.ATB_GUI || {};
//==============================================================================
// ■ Sprite_ATB
//------------------------------------------------------------------------------
// The Sprite class who handle
//==============================================================================
function Sprite_ATB(){this.initialize.apply(this,arguments);}
Sprite_ATB.prototype.constructor = Sprite_ATB;
Sprite_ATB.prototype = Object.create(Sprite_Base.prototype);
Sprite_ATB.prototype.initialize = function(battler) {
Sprite_Base.prototype.initialize.call(this);
this.initMember();
this.setBattler(battler);
};
Sprite_ATB.prototype.initMember = function() {
this.anchor.x = 0.5;
this.anchor.y = 1;
this._homeX = 0;
this._homeY = 0;
this._finalX = 0;
this._finaly = 0;
this._battler = null;
};
Sprite_ATB.prototype.setBattler = function(battler) {
this._battler = battler;
};
Sprite_ATB.prototype.update = function() {
Sprite_Base.prototype.update.call(this);
while(ImageManager.isReady() != true){
this.loadBitmap();
}
if(this._battler && ImageManager.isReady()){
this.updateVisibility();
this.bitmap = ImageManager.loadSystem("ATB_" + this._battler.name());
} else {
this.bitmap = ImageManager.loadSystem("");
}
};
//===============================================================================
// => END : Sprite_ATB
//===============================================================================
//==============================================================================
// ■ Spriteset_Battle
//------------------------------------------------------------------------------
// The set of sprites on the battle screen.
//==============================================================================
NioPlugin.ATB_GUI.createUpperLayer = Spriteset_Battle.prototype.createUpperLayer;
Spriteset_Battle.prototype.createUpperLayer = function(){
NioPlugin.ATB_GUI.createUpperLayer.call(this);
this.createATBLayout();
this.createATBFace();
};
Spriteset_Battle.prototype.createATBLayout = function() {
this._layout = new Sprite();
this._layout.bitmap = ImageManager.loadSystem("atbLayout");
this._layout.x = 100;
this._layout.y = 100;
this.addChild(this._layout);
};
Spriteset_Battle.prototype.createATBFace = function() {
this.createEnemieFaces();
this.createActorFaces();
};
Spriteset_Battle.prototype.createEnemieFaces = function() {};
// create the ATB actorFace for the atb bar
Spriteset_Battle.prototype.createActorFaces = function() {
this._atbActor = [];
for (var i = 0; i < this._atbActor.length; i++) {
this._atbActor = new Sprite_ATB(i);
this._battleField.addChild(this._atbActor);
};
};
// from a exemple I am unsure if this could work actually
for (var i = $gameParty.members().length - 1; i >= 0; i--) {
var actor = $gameParty.members();
}
var NioPlugin.ATB_GUI = NioPlugin.ATB_GUI || {};
//==============================================================================
// ■ Sprite_ATB
//------------------------------------------------------------------------------
// The Sprite class who handle
//==============================================================================
function Sprite_ATB(){this.initialize.apply(this,arguments);}
Sprite_ATB.prototype.constructor = Sprite_ATB;
Sprite_ATB.prototype = Object.create(Sprite_Base.prototype);
Sprite_ATB.prototype.initialize = function(battler) {
Sprite_Base.prototype.initialize.call(this);
this.initMember();
this.setBattler(battler);
};
Sprite_ATB.prototype.initMember = function() {
this.anchor.x = 0.5;
this.anchor.y = 1;
this._homeX = 0;
this._homeY = 0;
this._finalX = 0;
this._finaly = 0;
this._battler = null;
};
Sprite_ATB.prototype.setBattler = function(battler) {
this._battler = battler;
};
Sprite_ATB.prototype.update = function() {
Sprite_Base.prototype.update.call(this);
while(ImageManager.isReady() != true){
this.loadBitmap();
}
if(this._battler && ImageManager.isReady()){
this.updateVisibility();
this.bitmap = ImageManager.loadSystem("ATB_" + this._battler.name());
} else {
this.bitmap = ImageManager.loadSystem("");
}
};
//===============================================================================
// => END : Sprite_ATB
//===============================================================================
//==============================================================================
// ■ Spriteset_Battle
//------------------------------------------------------------------------------
// The set of sprites on the battle screen.
//==============================================================================
NioPlugin.ATB_GUI.createUpperLayer = Spriteset_Battle.prototype.createUpperLayer;
Spriteset_Battle.prototype.createUpperLayer = function(){
NioPlugin.ATB_GUI.createUpperLayer.call(this);
this.createATBLayout();
this.createATBFace();
};
Spriteset_Battle.prototype.createATBLayout = function() {
this._layout = new Sprite();
this._layout.bitmap = ImageManager.loadSystem("atbLayout");
this._layout.x = 100;
this._layout.y = 100;
this.addChild(this._layout);
};
Spriteset_Battle.prototype.createATBFace = function() {
this.createEnemieFaces();
this.createActorFaces();
};
Spriteset_Battle.prototype.createEnemieFaces = function() {};
// create the ATB actorFace for the atb bar
Spriteset_Battle.prototype.createActorFaces = function() {
this._atbActor = [];
for (var i = 0; i < this._atbActor.length; i++) {
this._atbActor = new Sprite_ATB(i);
this._battleField.addChild(this._atbActor);
};
};
// from a exemple I am unsure if this could work actually
for (var i = $gameParty.members().length - 1; i >= 0; i--) {
var actor = $gameParty.members();
}
thanks for any further answer
