main.js
//callback function to run each frame
callback function to run each frame
callback function to run each frame
function run()
{
	var now = Date.now();
	var DeltaTime = (now - lastUpdate) * 0.001;
	lastUpdate = now;
	context.fillStyle = "#0000FF";
	context.fillRect(0, 0, canvas.width, canvas.height);
	switch (gameState)
	{
		case STATE_SPLASH:
			runSplash(DeltaTime);
			break;
		case STATE_GAME:
			runGame(DeltaTime);
			break;
		case STATE_GAMEOVER:
			runEnd(DeltaTime);
			break;
	}
}
function run ( ) { var now = Date . now ( ) ; var DeltaTime = ( now - lastUpdate ) * 0.001 ; lastUpdate = now ; context . fillStyle = "#0000FF" ; context . fillRect ( 0 , 0 , canvas . width , canvas . height ) ; switch ( gameState ) { case STATE_SPLASH : runSplash ( DeltaTime ) ; break ; case STATE_GAME : runGame ( DeltaTime ) ; break ; case STATE_GAMEOVER : runEnd ( DeltaTime ) ; break ; } }
callback function to run each frame
callback function to run each frame
//Game States