<commit_before><!DOCTYPE html>
<html>
  <head>
    <title>Shooting Game</title>
    <script language="javascript" type="text/javascript" src="https://code.createjs.com/createjs-2015.11.26.min.js" ></script>  
  </head>
  <body onload="init();" >
    <canvas id="gameCanvas" ></canvas>
    <script> 
      // constants
      var WIDTH = 800; 
      var HEIGHT = 500; 

      // globals
      var image;
      var stage;
      var preload;
      var manifest;
      var queue;
      var score = 0;
      var gameTime = 0; 
      var zombieSpeed = 0;
      var zombiePositionX; 
      var zombiePositionY;
      var crosshairImage;
      var zombies = [];

      function init() { 
        var canvas = document.getElementById("gameCanvas"); 
        context = canvas.getContext('2d');
        context.canvas.width = WIDTH;
        context.canvas.height = HEIGHT;

        // hide the cursor
        canvas.style.cursor = 'none';
        stage = new createjs.Stage("gameCanvas");
        
        loadAssets();
      }

      function loadAssets() { 
        // set up the loading queue
        queue = new createjs.LoadQueue(false);
        queue.installPlugin(createjs.Sound);
        queue.on("complete", queueLoaded, this);
        createjs.Sound.alternateExtensions = ["ogg"];

        // add assets to the loading queue
        queue.loadManifest([
          {id: 'backgroundImage', src: 'assets/art/background.png'}, 
          {id: 'crossHair', src: 'assets/art/crosshairs/circle-02.png'},
          {id: 'zombie', src: 'assets/art/zombie/1.png'},
          {id: 'backgroundMusic', src: 'assets/sound/Imminent Threat.mp3'},
          {id: 'shotSound', src: 'assets/sound/shot.mp3'}
        ]);
        queue.load();
      }

      function queueLoaded(event) {
        addAssetsToCanvas();
        stage.update();
      }

      function addAssetsToCanvas() { 
        // add the background
        var backgroundImage = new createjs.Bitmap(queue.getResult("backgroundImage"));
        stage.addChild(backgroundImage); 

        // add crosshair
        crosshairImage = new createjs.Bitmap(queue.getResult("crossHair"));
        crosshairImage.scaleX=0.3;
        crosshairImage.scaleY=0.3;
        crosshairImage.x = (stage.canvas.width - crosshairImage.image.width * crosshairImage.scaleX) / 2;
        crosshairImage.y = (stage.canvas.height - crosshairImage.image.height * crosshairImage.scaleY) / 2;

        stage.addChild(crosshairImage); 

        // add score
        var scoreText = new createjs.Text("1UP: " + score.toString(), "36px Arial", "#FFF");
        scoreText.x = 10;
        scoreText.y = 10;
        stage.addChild(scoreText);

        // add timer 
        var timerText = new createjs.Text("Time: " + gameTime.toString(), "36px Arial", "#FFF");
        timerText.x = WIDTH - 150;
        timerText.y = 10;
        stage.addChild(timerText);

        // add background music 
        createjs.Sound.play("backgroundMusic", {loop: -1});

        // spawn zombies
        spawnZombies(6);

        // add ticker 
        createjs.Ticker.addEventListener('tick', stage);
        createjs.Ticker.addEventListener('tick', tickEvent);

        // events for the mouse
        window.onmousemove = handleMouseMove;
        window.onmousedown = handleMouseDown;
      }

      // spawns a zombie in a ramdom location (within the screen)
      function spawnZombies(numberOfZombies) { 
        if (numberOfZombies <= 0) {
          throw ("Need to specify number of zombies"); 
        }
        for (var i = 0; i < numberOfZombies; i++ ) { 
          var newZombie = new Zombie(stage, queue.getResult("zombie")); 
          newZombie.setup(true); 
          newZombie.draw();
          zombies.push(newZombie);
        }
      }

      function tickEvent() { 
        // move the zombie
        for (var i = 0; i < zombies.length; i++) { 
          zombies[i].walk();
        }
      }

      function handleMouseMove(event) { 
        crosshairImage.x = event.clientX - 45;
        crosshairImage.y = event.clientY - 45;
      }

      function handleMouseDown(event) { 
        // play gunshot sound
        var shotInstance = createjs.Sound.play("shotSound");
        shotInstance.volume = 0.5;

        // Obtain shot position
        var shotX = Math.round(event.clientX);
        var shotY = Math.round(event.clientY);

        // loop through all zombie positions and check if you hit any
        console.log(zombies.length)
        for (var i = 0; i < zombies.length; i++) {

          if (isZombieShot(zombies[i], shotX, shotY)) { 
            console.log(zombies[i].x);
            stage.removeChild(zombies[i].getZombieImage());
            zombies.splice(i, 1);
            break;
          }
        }
      }

      function Zombie (stage, manifestItem) {
        this.x = 0;
        this.y = 0;
        this.scaleX = 1.5;
        this.scaleY = 1.5;
        this.maxSpeedX = 10; <commit_msg>Spawn twice the number of zombies'<commit_after><!DOCTYPE html>
<html>
  <head>
    <title>Shooting Game</title>
    <script language="javascript" type="text/javascript" src="https://code.createjs.com/createjs-2015.11.26.min.js" ></script>  
  </head>
  <body onload="init();" >
    <canvas id="gameCanvas" ></canvas>
    <script> 
      // constants
      var WIDTH = 800; 
      var HEIGHT = 500; 

      // globals
      var image;
      var stage;
      var preload;
      var manifest;
      var queue;
      var score = 0;
      var gameTime = 0; 
      var zombieSpeed = 0;
      var zombiePositionX; 
      var zombiePositionY;
      var crosshairImage;
      var zombies = [];
      var numZombiesShot = 0;

      function init() { 
        var canvas = document.getElementById("gameCanvas"); 
        context = canvas.getContext('2d');
        context.canvas.width = WIDTH;
        context.canvas.height = HEIGHT;

        // hide the cursor
        canvas.style.cursor = 'none';
        stage = new createjs.Stage("gameCanvas");
        
        // load the art and sound
        loadAssets();
      }

      function loadAssets() { 
        // set up the loading queue
        queue = new createjs.LoadQueue(false);
        queue.installPlugin(createjs.Sound);
        // when done loading, call queueLoaded
        queue.on("complete", queueLoaded, this);
        createjs.Sound.alternateExtensions = ["ogg"];

        // add assets to the loading queue
        queue.loadManifest([
          {id: 'backgroundImage', src: 'assets/art/background.png'}, 
          {id: 'crossHair', src: 'assets/art/crosshairs/circle-02.png'},
          {id: 'zombie', src: 'assets/art/zombie/1.png'},
          {id: 'backgroundMusic', src: 'assets/sound/Imminent Threat.mp3'},
          {id: 'shotSound', src: 'assets/sound/shot.mp3'}
        ]);
        queue.load();
      }

      function queueLoaded(event) {
        addAssetsToCanvas();
        stage.update();
      }

      function addAssetsToCanvas() { 
        // add the background
        var backgroundImage = new createjs.Bitmap(queue.getResult("backgroundImage"));
        stage.addChild(backgroundImage); 

        // add crosshair
        crosshairImage = new createjs.Bitmap(queue.getResult("crossHair"));
        crosshairImage.scaleX=0.3;
        crosshairImage.scaleY=0.3;
        crosshairImage.x = (stage.canvas.width - crosshairImage.image.width * crosshairImage.scaleX) / 2;
        crosshairImage.y = (stage.canvas.height - crosshairImage.image.height * crosshairImage.scaleY) / 2;

        stage.addChild(crosshairImage); 

        // add score
        var scoreText = new createjs.Text("1UP: " + score.toString(), "36px Arial", "#FFF");
        scoreText.x = 10;
        scoreText.y = 10;
        stage.addChild(scoreText);

        // add timer 
        var timerText = new createjs.Text("Time: " + gameTime.toString(), "36px Arial", "#FFF");
        timerText.x = WIDTH - 150;
        timerText.y = 10;
        stage.addChild(timerText);

        // add background music 
        createjs.Sound.play("backgroundMusic", {loop: -1});

        // spawn zombies
        spawnZombies(1);

        // add ticker 
        createjs.Ticker.addEventListener('tick', stage);
        createjs.Ticker.addEventListener('tick', tickEvent);

        // events for the mouse
        window.onmousemove = handleMouseMove;
        window.onmousedown = handleMouseDown;
      }

      // spawns a zombie in a ramdom location (within the screen)
      function spawnZombies(numberOfZombies) { 
        if (numberOfZombies <= 0) {
          throw ("Need to specify number of zombies"); 
        }
        for (var i = 0; i < numberOfZombies; i++ ) { 
          var newZombie = new Zombie(stage, queue.getResult("zombie")); 
          newZombie.setup(true); 
          newZombie.draw();
          zombies.push(newZombie);
        }
      }

      function tickEvent() { 
        // move the zombie
        for (var i = 0; i < zombies.length; i++) { 
          zombies[i].walk();
        }
      }

      function handleMouseMove(event) { 
        crosshairImage.x = event.clientX - 45;
        crosshairImage.y = event.clientY - 45;
      }

      function handleMouseDown(event) { 
        // play gunshot sound
        var shotInstance = createjs.Sound.play("shotSound");
        shotInstance.volume = 0.5;

        // Obtain shot position
        var shotX = Math.round(event.clientX);
        var shotY = Math.round(event.clientY);

        // loop through all zombie positions and check if you hit any
        console.log(zombies.length)
        for (var i = 0; i < zombies.length; i++) {

          if (isZombieShot(zombies[i], shotX, shotY)) {
            // increase number of zombies shot
            numZombiesShot++;

            console.log(zombies[i].x);

            // remove the zombie
            stage.removeChild(zombies[i].getZombieImage());
            zombies.splice(i, 1);

            // spawn twice the amount of zombies
            spawnZombies(numZombiesShot * 2);

            break;
          }
        }
      }

      // zombie class
      function Zombie (stage, manifestItem) {
        this.x = 0;
        this.y = 0;
        this.scaleX = 1.5;
        this.scaleY = 1.5;
        this.maxSpeedX = 10; 
{'fraction_non_alphanumeric': 0.1240454278441355, 'fraction_numerical': 0.012727628744859996, 'mean_word_length': 1.970340215178831, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 27, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3709824', 'n_tokens_mistral': 3294, 'n_tokens_neox': 3024, 'n_words': 683}