<commit_before>var canvas = document.getElementById('g');
var controls = new Controls();
var camera = new Camera(canvas, 0, 0, 3.0);
var backgroundLayer = [];
var entities = [];
var player = new Player(0, 0);
var enemy = new Enemy(15, 15);

entities.push(enemy);
entities.push(player);

var loop = new GameLoop();

loop.start(function frame(deltaT) {
    entities.forEach(function(entity) {
        entity.update(controls.states, deltaT);
    });

    camera.render(backgroundLayer, entities);
});<commit_msg>Enemies are now placed every few seconds (time increases for increased difficulty)<commit_after>var canvas = document.getElementById('g');
var controls = new Controls();
var camera = new Camera(canvas, 0, 0, 3.0);
var backgroundLayer = [];
var entities = [];
var player = new Player(0, 0);
var timer = 0;
var enemyCountdown = 10;

entities.push(player);
placeRandomEnemy();

var loop = new GameLoop();

loop.start(function frame(deltaT) {
    timer += deltaT;

    if(Math.round(timer) >= enemyCountdown) {
        placeRandomEnemy();
        timer -= enemyCountdown;

        if(enemyCountdown > 1)
            enemyCountdown--;
    }

    backgroundLayer.forEach(function(entity) {
        if(entity.update)
            entity.update(controls.states, deltaT);
    });

    entities.forEach(function(entity) {
        entity.update(controls.states, deltaT);
    });

    camera.render(backgroundLayer, entities);
});

function placeRandomEnemy() {
    var x = player.x + Math.sign(Math.random() - 0.5) * 100;
    var y = player.y + Math.sign(Math.random() - 0.5) * 100;

    console.log('Placing enemy at (' + x + ', ' + y + ')');

    entities.push(new Enemy(x, y));
}
{'fraction_non_alphanumeric': 0.1506849315068493, 'fraction_numerical': 0.01786777843954735, 'mean_word_length': 3.5652173913043477, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '2164200', 'n_tokens_mistral': 545, 'n_tokens_neox': 517, 'n_words': 130}