Game Development Reference
In-Depth Information
this.currentMAX_HP = data.PlayerData.player.maxHP * 1;
this.maxHPIncrease = currentLevel.HPEarned;
this.currentCoins = data.PlayerData.player.coins * 1;
this.coinsIncrease = currentLevel.coinsAwarded * 1;
//update data
player.power = this.currentPower + this.powerIncrease;
player.defense = this.currentDefense + this.defenseIncrease;
player.maxHP = this.currentMAX_HP + this.maxHPIncrease;
player.coins = this.currentCoins + this.coinsIncrease;
}
p.addBG = function () {
var bg = new
createjs.Bitmap(game.assets.getAsset(game.assets.MENU_BG));
this.addChild(bg);
}
p.addLevelMessaging = function () {
var txt;
var xPos = 30;
var yPos = 40;
var vGap = 90;
var msgWidth = 600;
var msgHeight = 470;
var msgPos = {x:20, y:40};
var msgContainer = new createjs.Container();
//bg
var containerBG = new createjs.Shape();
containerBG.graphics.beginFill('#f7f4ef').drawRect(0, 0, msgWidth,
msgHeight);
//title
txt = this.getBitmapTxt('LEVEL COMPLETE!', xPos, yPos);
msgContainer.addChild(containerBG, txt);
//attack
yPos += vGap;
txt = this.getBitmapTxt('ATTACK INCREASE_ + ' + this.powerIncrease +
' = ' + data.PlayerData.player.power, xPos, yPos);
msgContainer.addChild(txt);
//defense
yPos += vGap;
txt = this.getBitmapTxt('DEFENSE INCREASE_ + ' +
this.defenseIncrease + ' = ' + data.PlayerData.player.defense,
xPos, yPos);
msgContainer.addChild(txt);
//HP
yPos += vGap;
txt = this.getBitmapTxt('HP INCREASE_ + ' + this.maxHPIncrease + ' =
' + data.PlayerData.player.maxHP, xPos, yPos);
msgContainer.addChild(txt);
//coins
yPos += vGap;
txt = this.getBitmapTxt('COINS EARNED_ + ' + this.coinsIncrease + '
= ' + data.PlayerData.player.coins, xPos, yPos);
Search WWH ::




Custom Search