HTML and CSS Reference
In-Depth Information
}
function gameStatePlayLevel() {
ConsoleLog.log("appStateGamePlay");
}
function gameStateGameOver() {
ConsoleLog.log("appStateGameOver");
}
function runGame(){
currentGameStateFunction();
}
//*** application start
switchGameState(GAME_STATE_TITLE);
//**** application loop
const FRAME_RATE = 40;
var intervalTime = 1000/FRAME_RATE;
setInterval(runGame, intervalTime );
}
//***** object prototypes *****
//*** consoleLog util object
//create constructor
function ConsoleLog(){
}
//create function that will be added to the class
console_log = function(message) {
if(typeof(console) !== 'undefined' && console != null) {
console.log(message);
}
}
//add class/static function to class by assignment
ConsoleLog.log = console_log;
//*** end console log object
</script>
Example 8-9 added in the ConsoleLog object from the previous chapters.
We will continue to use this utility to create helpful debug messages in
the JavaScript log window of the browser.
We will continue to explore the application state machine, and then create one for our
game logic states in the upcoming section, “Putting It All Together” on page 407 .
Search WWH ::




Custom Search