HTML and CSS Reference
In-Depth Information
},
hide: function() {
this.node.classList.remove('in');
this.node.classList.add('out');
}
};
// Start Scene
var startScene = game.startScene =
Object.create(scene);
startScene.node = document.getElementById('start-
scene');
startScene.setup = function() {
document.getElementById('start-btn').onclick =
function(){
game.flow.startGame();
return false;
};
};
// Gameover Scene
var gameOverScene = game.gameOverScene =
Object.create(scene);
gameOverScene.node = document.getElementById('gameover-
scene');
gameOverScene.setup = function() {
document.getElementById('back-to-menu-
button').onclick = function() {
game.flow.startOver();
};
};
})();
5. We just created the staring menu and the game-over scene. But where is the
major game scene? This ime the game scene will grow into a large block of code.
In order to make it easier to maintain, we put the code into a new file named
game-scene.js shown as follows:
// game scene module
;(function(){
var game = this.cardBattleGame = this.cardBattleGame
|| {};
var gameScene = game.gameScene =
Object.create(game.scene);
 
Search WWH ::




Custom Search