27 lines
		
	
	
		
			543 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			27 lines
		
	
	
		
			543 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
//Set the game state
 | 
						|
var state = play;
 | 
						|
 | 
						|
gameLoop();
 | 
						|
 | 
						|
function gameLoop() {
 | 
						|
 | 
						|
  //Loop this function 60 times per second
 | 
						|
  requestAnimationFrame(gameLoop);
 | 
						|
 | 
						|
  //Update the current game state:
 | 
						|
  state();
 | 
						|
 | 
						|
  //Render the stage
 | 
						|
  renderer.render(stage);
 | 
						|
}
 | 
						|
 | 
						|
function play() {
 | 
						|
  if(terminalsHacked === 4){
 | 
						|
    window.location="https://github.com/joshuashoemaker/game-off-2016/gameover.html"
 | 
						|
  }
 | 
						|
  if(!player.alive()){
 | 
						|
    setTimeout(function(){
 | 
						|
      window.location="https://github.com/joshuashoemaker/game-off-2016/gameover.html"
 | 
						|
    }, 1500)
 | 
						|
  }
 | 
						|
} |