var Skier = require('./skier');
var Tree = require('./tree');
var Rock = require('./rock');

function Skifree () {
  var canvas = document.getElementById('skifree');
  var context = canvas.getContext('2d');
  document.addEventListener("keydown", function(event) {
    keyPressed(event);
  }, false);

  var skier = new Skier({ canvas: canvas, context: context });
  var tree = new Tree({ canvas: canvas, context: context });
  var rock = new Rock({ canvas: canvas, context: context });

  function keyPressed(event) {
    if (event.keyCode === 37) {
      skier.moveLeft();
    } else if (event.keyCode === 39) {
      skier.moveRight();
    }
  }

  requestAnimationFrame(function gameLoop() {
    context.clearRect(0, 0, canvas.width, canvas.height);
    skier.draw();
    tree.draw();
    rock.draw();
    requestAnimationFrame(gameLoop);
  });
}

module.exports = Skifree;

@@ -478,16 +478,52 @@
 text %7D);
+%0A  var bodies = %5Bskier, tree, rock%5D;
 %0A%0A  func
@@ -678,16 +678,436 @@
  %7D%0A  %7D%0A%0A
+  var isColliding = function(b1, b2) %7B%0A    if (b1.x === b2.x && b1.y === b2.y) %7B%0A      console.log(%22collision%22);%0A    %7D%0A  %7D;%0A%0A  var reportCollisions = function(bodies) %7B%0A    var bodyPairs = %5B%5D;%0A    for (var i = 0; i %3C bodies.length; i++) %7B%0A      for (var j = i + 1; j %3C bodies.length; j++) %7B%0A        if (isColliding(bodies%5Bi%5D, bodies%5Bj%5D)) %7B%0A          bodyPairs.push(%5Bbodies%5Bi%5D, bodies%5Bj%5D%5D);%0A        %7D%0A      %7D%0A    %7D%0A  %7D;%0A%0A
   reques
@@ -1233,24 +1233,24 @@
 ree.draw();%0A
-
     rock.dra
@@ -1250,24 +1250,54 @@
 ock.draw();%0A
+    reportCollisions(bodies);%0A
     requestA

Add basic collision detection