<commit_before>
function showMenu()
{
    app.inMenu = true;
    window.addEventListener("mousedown", closeMenu, true);
    drawCurrentMenu();
    switchMusicToMenu();
}

function closeMenu(e)
{    
    // end screen
    if (app.curMenu == 1)
    {
        if (Math.abs((app.canvas.height * 3/4) - e.clientY - (app.canvas.width/40)*(1/3)) < (app.canvas.width/40)*(3/4) &&
            Math.abs((app.canvas.width / 2) - e.clientX) < (app.canvas.width/40) * 3.5)
        {
            app.curMenu = 2;
        }
        else
        {
            app.inMenu = false;
            window.removeEventListener("mousedown", closeMenu, true);
            switchMusicToGame();
            //_destroyCurrentGame();
            //app.level = new Level(100, 100);
        }
    }
    // credits
    else if (app.curMenu == 2)
    {
        app.curMenu = 1;
    }
    // main
    else
    {
        app.curMenu = 1;
        app.inMenu = false;
        window.removeEventListener("mousedown", closeMenu, true);
        switchMusicToGame();
    }
}

function _destroyCurrentGame()
{
    /*
    for (var i = 0; i < _actors.length; i++)
    {
        app.kill(_actors[i]);   
    }
    */
    //app.killAll();
    //app.removeKilled();
}

function drawCurrentMenu()
{
    drawBackgroundImage();
    
    if (app.curMenu == 0)
        _drawMainMenu();
    else if (app.curMenu == 1)
        _drawEndScreen();
    else if (app.curMenu == 2)
        _drawCredits();
}

function switchMusicToGame()
{
    app.cache["asset/MainMenuIntro_small.wav"].pause();
    app.cache["asset/MainMenuLoop_small.wav"].pause();
    app.cache["asset/FirstShipLoop_small.wav"].play();
}

function switchMusicToMenu()
{
    app.cache["asset/FirstShipLoop_small.wav"].pause();
    app.cache["asset/MainMenuIntro_small.wav"].play();
    app.cache["asset/MainMenuIntro_small.wav"].addEventListener("ended", function(e){
        app.cache["asset/MainMenuLoop_small.wav"].play();
    });
}

function onPlayerDeath()
{
    showMenu();
}

function _drawMainMenu()
{
    app.ctx.save();
        app.ctx.fillStyle = 'white';
        app.ctx.textAlign="center";
        app.ctx.font=app.canvas.width/20+"px Arial"; 
        app.ctx.fillText("Cosmic Rising", app.canvas.width / 2, app.canvas.height / 4);
        app.ctx.font=app.canvas.width/40+"px Arial"; 
        app.ctx.fillText("Touch anywhere to begin", app.canvas.width / 2, app.canvas.height / 2);
    app.ctx.restore();
}

function _drawEndScreen()
{   
    app.ctx.save();
        app.ctx.fillStyle = 'white';
        app.ctx.textAlign="center";
    
        app.ctx.font=app.canvas.width/20+"px Arial"; 
        app.ctx.fillText("Final Score: " + app.score, app.canvas.width / 2, app.canvas.height / 4);
    
        app.ctx.font=app.canvas.width/40+"px Arial"; 
        app.ctx.fillText("Touch anywhere to play again!", app.canvas.width / 2, app.canvas.height / 2);
    
        app.ctx.font=app.canvas.width/40+"px Arial"; 
        app.ctx.fillText("View Credits", app.canvas.width / 2, app.canvas.height * 3 / 4);
    app.ctx.restore();
}

function _drawCredits()
{
    app.ctx.save();
        app.ctx.fillStyle = 'white';
        
        app.ctx.textAlign="center";
        app.ctx.font=app.canvas.width/30+"px Arial"; 
        app.ctx.fillText("Thanks for playing Cosmic Rising!", app.canvas.width / 2, app.canvas.height / 4);
    
        app.ctx.textAlign="center";
        app.ctx.font=app.canvas.width/50+"px Arial"; 
        app.ctx.fillText("<NAME> - <EMAIL>", app.canvas.width / 2, app.canvas.height * 5 / 10);
        app.ctx.fillText("<NAME> - <EMAIL>", app.canvas.width / 2, app.canvas.height * 6 / 10);
        app.ctx.fillText("<NAME> - <EMAIL>", app.canvas.width / 2, app.canvas.height * 7 / 10);
        app.ctx.fillText("<NAME> - <EMAIL>", app.canvas.width / 2, app.canvas.height * 8 / 10);
        app.ctx.fillText("<NAME> - <EMAIL>", app.canvas.width / 2, app.canvas.height * 9 / 10);
    app.ctx.restore();
}
<commit_msg>game kinda restarts now<commit_after>
function showMenu()
{
    app.inMenu = true;
    window.addEventListener("mousedown", closeMenu, true);
    drawCurrentMenu();
    switchMusicToMenu();
}

function closeMenu(e)
{    
    // end screen
    if (app.curMenu == 1)
    {
        if (Math.abs((app.canvas.height * 3/4) - e.clientY - (app.canvas.width/40)*(1/3)) < (app.canvas.width/40)*(3/4) &&
            Math.abs((app.canvas.width / 2) - e.clientX) < (app.canvas.width/40) * 3.5)
        {
            app.curMenu = 2;
        }
        else
        {
            app.inMenu = false;
            window.removeEventListener("mousedown", closeMenu, true);
            switchMusicToGame();
            //_destroyCurrentGame();
            //app.level = new Level(100, 100);
            app.score = 0;
            app.player = new PlasmaShip(0,0);
            app.player.update = updatePlayerShip;
        }
    }
    // credits
    else if (app.curMenu == 2)
    {
        app.curMenu = 1;
    }
    // main
    else
    {
        app.curMenu = 1;
        app.inMenu = false;
        window.removeEventListener("mousedown", closeMenu, true);
        switchMusicToGame();
    }
}

function _destroyCurrentGame()
{
    
    for (var i = 0; i < app.actors.length; i++)
    {
        app.kill(app.actors[i]);   
    }
    
    //app.killAll();
    //app.removeKilled();
}

function drawCurrentMenu()
{
    drawBackgroundImage();
    
    if (app.curMenu == 0)
        _drawMainMenu();
    else if (app.curMenu == 1)
        _drawEndScreen();
    else if (app.curMenu == 2)
        _drawCredits();
}

function switchMusicToGame()
{
    app.cache["asset/MainMenuIntro_small.wav"].pause();
    app.cache["asset/MainMenuLoop_small.wav"].pause();
    app.cache["asset/FirstShipLoop_small.wav"].play();
}

function switchMusicToMenu()
{
    app.cache["asset/FirstShipLoop_small.wav"].pause();
    app.cache["asset/MainMenuIntro_small.wav"].play();
    app.cache["asset/MainMenuIntro_small.wav"].addEventListener("ended", function(e){
        app.cache["asset/MainMenuLoop_small.wav"].play();
    });
}

function onPlayerDeath()
{
    showMenu();
}

function _drawMainMenu()
{
    app.ctx.save();
        app.ctx.fillStyle = 'white';
        app.ctx.textAlign="center";
        app.ctx.font=app.canvas.width/20+"px Arial"; 
        app.ctx.fillText("Cosmic Rising", app.canvas.width / 2, app.canvas.height / 4);
        app.ctx.font=app.canvas.width/40+"px Arial"; 
        app.ctx.fillText("Touch anywhere to begin", app.canvas.width / 2, app.canvas.height / 2);
    app.ctx.restore();
}

function _drawEndScreen()
{   
    app.ctx.save();
        app.ctx.fillStyle = 'white';
        app.ctx.textAlign="center";
    
        app.ctx.font=app.canvas.width/20+"px Arial"; 
        app.ctx.fillText("Final Score: " + app.score, app.canvas.width / 2, app.canvas.height / 4);
    
        app.ctx.font=app.canvas.width/40+"px Arial"; 
        app.ctx.fillText("Touch anywhere to play again!", app.canvas.width / 2, app.canvas.height / 2);
    
        app.ctx.font=app.canvas.width/40+"px Arial"; 
        app.ctx.fillText("View Credits", app.canvas.width / 2, app.canvas.height * 3 / 4);
    app.ctx.restore();
}

function _drawCredits()
{
    app.ctx.save();
        app.ctx.fillStyle = 'white';
        
        app.ctx.textAlign="center";
        app.ctx.font=app.canvas.width/30+"px Arial"; 
        app.ctx.fillText("Thanks for playing Cosmic Rising!", app.canvas.width / 2, app.canvas.height / 4);
    
        app.ctx.textAlign="center";
        app.ctx.font=app.canvas.width/50+"px Arial"; 
        app.ctx.fillText("<NAME> - <EMAIL>", app.canvas.width / 2, app.canvas.height * 5 / 10);
        app.ctx.fillText("<NAME> - <EMAIL>", app.canvas.width / 2, app.canvas.height * 6 / 10);
        app.ctx.fillText("<NAME> - <EMAIL>", app.canvas.width / 2, app.canvas.height * 7 / 10);
        app.ctx.fillText("<NAME> - anand.mangal94<EMAIL>", app.canvas.width / 2, app.canvas.height * 8 / 10);
        app.ctx.fillText("<NAME> - <EMAIL>", app.canvas.width / 2, app.canvas.height * 9 / 10);
    app.ctx.restore();
}

{'fraction_non_alphanumeric': 0.16999627745377838, 'fraction_numerical': 0.0197294949745626, 'mean_word_length': 2.288453692370461, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1573455', 'n_tokens_mistral': 2896, 'n_tokens_neox': 2740, 'n_words': 450}