Game Development Reference
In-Depth Information
p.initialize = function () {
this.Container_initialize();
this.totalCoins = data.PlayerData.player.coins;
this.magicData = data.GameData.magicCosts;
this.addStoreMessaging();
this.addPurse();
this.addItemButtons();
}
p.addStoreMessaging = function () {
var txt;
var storeWidth = 600;
var storeHeight = 440;
var xPos = 20;
var yPos = 20;
var vGap = 70;
var storeBG = new createjs.Shape();
storeBG.graphics.beginFill('#f7f4ef').drawRect(0, 0, storeWidth,
storeHeight);
txt = this.getBitmapTxt('MAGIC SHOP', xPos, yPos);
this.addChild(storeBG, txt);
yPos += vGap;
txt = this.getBitmapTxt('POTION_ ' + this.magicData.potion + '
COINS', xPos, yPos, .7);
this.addChild(txt);
yPos += vGap * .7;
txt = this.getBitmapTxt('FIRE_ ' + this.magicData.fire + ' COINS',
xPos, yPos, .7);
this.addChild(txt);
yPos += vGap * .7;
txt = this.getBitmapTxt('EARTH_ ' + this.magicData.earth + ' COINS',
xPos, yPos, .7);
this.addChild(txt);
yPos += vGap * .7;
txt = this.getBitmapTxt('LIGHTNING_ ' + this.magicData.lightning + '
COINS', xPos, yPos, .7);
this.addChild(txt);
}
p.addPurse = function () {
var coin;
var xPos = 530;
var yPos = 20;
var coinOffsetX = -45;
var coinOffsetY = -8;
coin = new createjs.Sprite(spritesheet, 'coin');
coin.paused = true;
coin.x = xPos + coinOffsetX;
coin.y = yPos + coinOffsetY;
createjs.Tween.get(coin, {loop:true}).to({currentAnimationFrame:8},
600)
Search WWH ::




Custom Search