Game Development Reference
In-Depth Information
for (i = 0; i < len; i++) {
btn = this.buttonHolder.getChildAt(i);
if (btn.quantity > 0 || btn.quantity < 0) {
btn.enableButton();
}
}
}
p.onAttackButtonSelected = function (e) {
if (this.currentAttackButton != null) {
this.currentAttackButton.enableButton();
}
this.currentAttackButton = e.currentTarget;
this.currentAttackButton.selectButton();
var event = new
events.BattleButtonEvent(events.ATTACK_BUTTON_SELECTED, false,
false, this.currentAttackButton.type);
this.dispatchEvent(event);
}
p.update = function () {
if (!this.waitingToAttack) {
this.updateWaitBar();
}
this.updateStats();
}
p.updateWaitBar = function () {
var scale = this.waitBar.scaleX + (.001 * this.SPEED);
if (scale > 1) {
scale = 1;
}
this.waitBar.scaleX = scale;
if (scale == 1) {
this.waitingToAttack = true;
this.enableButtons();
}
}
p.updateStats = function () {
this.hpTxt.text = this.hero.HP + '_' + this.hero.maxHP;
}
p.resetPanel = function () {
this.waitingToAttack = false;
this.waitBar.scaleX = 0;
this.disableButtons();
this.mouseEnabled = true;
this.currentAttackButton = null;
}
window.game.BattlePanel = BattlePanel;
}());
Search WWH ::




Custom Search