Game Development Reference
In-Depth Information
Creating the Level Complete Scene
The level complete screen will be a container class called LevelComplete . There is seemingly a lot of code, but most of
it is messaging and positioning. This class is seen in Listing 14-43.
Listing 14-43. LevelComplete.js - The LevelComplete Class Displays The Level Results and Offer Items for Purchase
(function () {
window.game = window.game || {}
function LevelComplete() {
this.initialize();
}
var p = LevelComplete.prototype = new createjs.Container();
p.Container_initialize = p.initialize;
p.currentPower = null;
p.powerIncrease = null;
p.currentDefense = null;
p.defenseIncrease = null;
p.currentMAX_HP = null;
p.maxHPIncrease = null;
p.currentCoins = null;
p.coinsIncrease = null;
p.initialize = function () {
this.Container_initialize();
this.updateLevel();
this.updateStats();
this.addBG();
this.addLevelMessaging();
this.addShop();
this.drawContinueButton();
}
p.updateLevel = function () {
if (data.GameData.currentLevel ==
data.PlayerData.player.gameLevel) {
data.PlayerData.player.gameLevel =
(data.PlayerData.player.gameLevel * 1) + 1;
}
}
p.updateStats = function () {
var player = data.PlayerData.player;
var currentLevel =
data.GameData.levelData[data.GameData.currentLevel - 1];
this.currentPower = data.PlayerData.player.power * 1;
this.powerIncrease = currentLevel.powerIncreaseAwarded * 1;
this.currentDefense = data.PlayerData.player.defense * 1;
this.defenseIncrease = currentLevel.defenseIncreaseAwarded * 1;
 
Search WWH ::




Custom Search