HTML and CSS Reference
In-Depth Information
6. We have another module for mathemaical calculaions. It's a placeholder for now,
but we will add logic to the object later:
// Calculation
;(function(){
var game = this.game || (this.game={});
game.calculation = {};
}).call(this);
7. Next, we have the core game logic defined with the most basic setup:
// The Game Logic
;(function(){
var game = this.game || (this.game={});
game.start = function() {
var canvas = document.getElementById('canvas');
// passing the canvas to EaselJS.
game.stage = new createjs.Stage(canvas);
game.gameView.init();
game.stage.update();
};
}).call(this);
8. Finally, we have our entry point to connect the modules:
// Entry Point
;(function(){
if (this.game) {
this.game.start();
} else {
throw "No game logic found.";
}
}).call(this);
After performing these steps, we have the following text painted on the canvas tag:
 
Search WWH ::




Custom Search