HTML and CSS Reference
In-Depth Information
}
newRock.dy = Math.random()*3;
if (Math.random()<.5){
newRock.dy*=-1;
}
newRock.rotationInc = (Math.random()*5)+1;
if (Math.random()<.5){
newRock.rotationInc*=-1;
}
newRock.rotation = 0;
ConsoleLog.log("new rock scale"+(newRock.scale));
rocks.push(newRock);
}
}
function addToScore(value){
score+=value;
}
document.onkeydown = function(e){
e = e?e:window.event;
//ConsoleLog.log(e.keyCode + "down");
keyPressList[e.keyCode] = true;
}
document.onkeyup = function(e){
//document.body.onkeyup = function(e){
e = e?e:window.event;
//ConsoleLog.log(e.keyCode + "up");
keyPressList[e.keyCode] = false;
};
//*** application start
switchGameState(GAME_STATE_TITLE);
frameRateCounter = new FrameRateCounter();
//**** application loop
const FRAME_RATE = 40;
var intervalTime = 1000/FRAME_RATE;
setInterval(runGame, intervalTime );
}
//***** object prototypes *****
//*** consoleLog util object
//create constructor
function ConsoleLog(){
}
Search WWH ::




Custom Search