function startNewGame() {
    document.body.style.cursor = 'none';
    resetGameState();
    var nextLevelTime = 15;
    gameTimer.start();
    submitted = false;

    // update the play timer
    gameTimerUpdateString = setInterval(function() {
        var minutes = parseInt(gameTimer.getElapsedTime()/60);
        var seconds = parseInt(gameTimer.getElapsedTime() % 60);
        totalSeconds = parseInt(gameTimer.getElapsedTime());

        if(totalSeconds >= nextLevelTime){
            currColorPointer = (currColorPointer+1) % levelColorArray.length;
            nextLevelTime += 15;

            gameLevel += 1;
            drawLevel();
        }
        document.getElementById('hud-time').innerText = pad(minutes, 2) + ":" + pad(seconds, 2);
    }, 500);

    drawHealthBar();
    drawLevel();
}
// resets any current game state and immediately starts a new game
resets any current game state and immediately starts a new game
resets any current game state and immediately starts a new game
function startNewGame() {
    document.body.style.cursor = 'none';
    resetGameState();
    var nextLevelTime = 15;
    gameTimer.start();
    submitted = false;
    gameTimerUpdateString = setInterval(function() {
        var minutes = parseInt(gameTimer.getElapsedTime()/60);
        var seconds = parseInt(gameTimer.getElapsedTime() % 60);
        totalSeconds = parseInt(gameTimer.getElapsedTime());
        if(totalSeconds >= nextLevelTime){
            currColorPointer = (currColorPointer+1) % levelColorArray.length;
            nextLevelTime += 15;
            gameLevel += 1;
            drawLevel();
        }
        document.getElementById('hud-time').innerText = pad(minutes, 2) + ":" + pad(seconds, 2);
    }, 500);
    drawHealthBar();
    drawLevel();
}
function startNewGame ( ) { document . body . style . cursor = 'none' ; resetGameState ( ) ; var nextLevelTime = 15 ; gameTimer . start ( ) ; submitted = false ; gameTimerUpdateString = setInterval ( function ( ) { var minutes = parseInt ( gameTimer . getElapsedTime ( ) / 60 ) ; var seconds = parseInt ( gameTimer . getElapsedTime ( ) % 60 ) ; totalSeconds = parseInt ( gameTimer . getElapsedTime ( ) ) ; if ( totalSeconds >= nextLevelTime ) { currColorPointer = ( currColorPointer + 1 ) % levelColorArray . length ; nextLevelTime += 15 ; gameLevel += 1 ; drawLevel ( ) ; } document . getElementById ( 'hud-time' ) . innerText = pad ( minutes , 2 ) + ":" + pad ( seconds , 2 ) ; } , 500 ) ; drawHealthBar ( ) ; drawLevel ( ) ; }
resets any current game state and immediately starts a new game
resets any current game state and immediately starts a new game
// update the play timer