<commit_before>define('HUD',

['vent', 'util', 'Sprite'],

function( vent, util ){

    'use strict';

    var init,
        ctx,
        canvas,
        update,
        render,
        bindEvents,
        drawItems,
        score,
        draw;


    drawItems = {
        bar: function( ctx ){
            ctx.fillStyle = '#111';
            ctx.beginPath();
            ctx.rect(0, ctx.canvas.height - 50, ctx.canvas.width, 50);
            ctx.fill();

            ctx.fillStyle = '#444';
            ctx.beginPath();
            ctx.rect(0, ctx.canvas.height - 52, ctx.canvas.width, 2);
            ctx.fill();
        },
        score: function( ctx ) {
            ctx.font = "20px Georgia";
            ctx.fillStyle = '#f1f1f1';
            ctx.textAlign = 'right';
            ctx.fillText(
                'Score: ' + score,
                ctx.canvas.width - 25, ctx.canvas.height - 20
            );
        }
    };


    init = function( obj ){
        var cvs = document.createElement('canvas');
        ctx = cvs.getContext('2d');
        cvs.width = obj.width;
        cvs.height = obj.height;
        cvs.id = 'hud-canvas';
        util.getById('game-container').appendChild(cvs);
        canvas = {
            width: cvs.width,
            height: cvs.height,
            ctx: ctx
        };

        score = 0;

        vent.on('update', update);
        vent.on('render', render);
    };


    bindEvents = function(){
        vent.on('effects-canvas-added', function( obj ){
            init(obj);
        });
    };


    update = function(){

    };


    render = function(){
        ctx.clearRect(0, 0, ctx.canvas.width, 50);
        draw('bar');
        draw('score');<commit_msg>update score on enemy-down event<commit_after>define('HUD',

['vent', 'util', 'Sprite'],

function( vent, util ){

    'use strict';

    var init,
        ctx,
        canvas,
        update,
        render,
        bindEvents,
        drawItems,
        score,
        draw;


    drawItems = {
        bar: function( ctx ){
            ctx.fillStyle = '#111';
            ctx.beginPath();
            ctx.rect(0, ctx.canvas.height - 50, ctx.canvas.width, 50);
            ctx.fill();

            ctx.fillStyle = '#444';
            ctx.beginPath();
            ctx.rect(0, ctx.canvas.height - 52, ctx.canvas.width, 2);
            ctx.fill();
        },
        score: function( ctx ) {
            ctx.font = "20px Georgia";
            ctx.fillStyle = '#f1f1f1';
            ctx.textAlign = 'right';
            ctx.fillText(
                'Score: ' + score,
                ctx.canvas.width - 25, ctx.canvas.height - 20
            );
        }
    };


    init = function( obj ){
        var cvs = document.createElement('canvas');
        ctx = cvs.getContext('2d');
        cvs.width = obj.width;
        cvs.height = obj.height;
        cvs.id = 'hud-canvas';
        util.getById('game-container').appendChild(cvs);
        canvas = {
            width: cvs.width,
            height: cvs.height,
            ctx: ctx
        };

        score = 0;

        vent.on('update', update);
        vent.on('render', render);
    };


    bindEvents = function(){
        vent.on('effects-canvas-added', function( obj ){
            init(obj);
        });
        vent.on('enemy-down', function(){
            score += 2;
        });
    };


    update = function(){

    };


    render = function(){
        ctx.clearRect(0, 0, ctx.canvas.width, 50);
        draw('bar');
        draw('score');
{'fraction_non_alphanumeric': 0.1496443812233286, 'fraction_numerical': 0.017354196301564723, 'mean_word_length': 1.398362892223738, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6845124', 'n_tokens_mistral': 1106, 'n_tokens_neox': 1030, 'n_words': 211}