HTML and CSS Reference
In-Depth Information
height: 480px;
border: 1px solid black;
}
canvas {
background: #333;
position: absolute;
}
3. Let's move to the JavaScript code. At irst, we have a seing object that contains
variables that configure the values of different game components. These are
variables that may change during the development process:
;(function(){
var game = this.game || (this.game={});
game.setting = {
gameWidth: 300,
gameHeight: 480
};
}).call(this);
4. Then, we prepare several object skeletons such as the game view, input,
and calculaion:
// Game View
;(function(){
var game = this.game || (this.game={});
game.gameView = {
init: function() {
var hello = new createjs.Text('Hello CreateJS', '18px
Impact', 'white');
game.stage.addChild(hello);
}
};
}).call(this);
5. We define a placeholder for the input module. In this task, we modularize the logic.
In later tasks, we will add code to the module:
// Input
;(function(){
var game = this.game || (this.game={});
// inputs logic here later
}).call(this);
 
Search WWH ::




Custom Search