HTML and CSS Reference
In-Depth Information
// indicatiors
var lives = document.getElementById('lives');
var energies = document.getElementById('energies');
var waves = document.getElementById('waves');
for(var i=0, len=addButtons.length; i<len; i++) {
var button = addButtons[i];
button.onmousedown = function(e) {
if (cjs.Ticker.getPaused()) { return; }
var buildingType = this.dataset.type;
// have enough energy
var cost = game[buildingType].cost;
if (cost && game.energies >= cost) {
game.energies -= cost;
var event = new cjs.Event('readyToPlaceBuilding');
event.buildingType = buildingType;
function tick() {
lives.textContent = game.lives;
energies.textContent = game.energies;
waves.textContent = 1;
cjs.Ticker.addEventListener('tick', tick);
}).call(this, game, createjs);
Objective complete - mini debriefing
We use the following three layers for our display objects:
F bgLayer
F boardLayer
F effectLayer
The background layer only contains the background image. Later, when we extend the game
with different scenarios, we can work on this layer to show the different graphical themes or
even play the animaion inside this layer.
Search WWH ::

Custom Search