HTML and CSS Reference
In-Depth Information
}
if (keyPressList[39]==true) {
//rotate clockwise
player.rotation += player.rotationalVelocity;
if (player.rotation >350) {
player.rotation = 10
}
}
if (keyPressList[32]==true) {
if (player.missileFrameCount>player.missileFrameDelay){
playSound(SOUND_SHOOT,.5);
firePlayerMissile();
player.missileFrameCount = 0;
}
}
}
function update() {
updatePlayer();
updatePlayerMissiles();
updateRocks();
updateSaucers();
updateSaucerMissiles();
updateParticles();
}
function render() {
fillBackground();
renderScoreBoard();
renderPlayerShip(player.x,player.y,player.rotation,1);
renderPlayerMissiles();
renderRocks();
renderSaucers();
renderSaucerMissiles();
renderParticles();
}
function updatePlayer() {
player.missileFrameCount++;
player.x += player.movingX*frameRateCounter.step;
player.y += player.movingY*frameRateCounter.step;
if (player.x > xMax) {
player.x =- player.width;
}else if (player.x<-player.width){
player.x = xMax;
}
if (player.y > yMax) {
player.y =- player.height;
Search WWH ::




Custom Search