define([
  './state',
  './initInput',
  './handleInput',
  './update',
  './draw',
  './loadLevel',
  './UI',
  'dojo/has',
  'frozen/box2d/Box',
  'frozen/box2d/BoxGame'
], function(state, initInput, handleInput, update, draw, loadLevel, UI, has, Box, BoxGame){

  'use strict';

  has.add('debug', function(global){
    return !!global.localStorage.getItem('debug');
  });

  //setup a GameCore instance
  var game = new BoxGame({
    canvasId: 'canvas',
    gameAreaId: 'gameArea',
    canvasPercentage: 0.95,
    box: new Box({
      gravityY: 0,
      gravityX: 0,
      resolveCollisions: true
    }),
    initInput: initInput,
    handleInput: handleInput,
    update: update,
    draw: draw,
    loadLevel: loadLevel,
    ui: new UI()
  });

  //if you want to take a look at the game object in dev tools
  console.log(game);

  game.loadLevel(state.level);

  //launch the game!
  game.run();

});
@@ -6,21 +6,8 @@
 e(%5B%0A
-  './state',%0A
   '.
@@ -151,16 +151,52 @@
 BoxGame'
+,%0A  'frozen/box2d/listeners/Contact'
 %0A%5D, func
@@ -204,15 +204,8 @@
 ion(
-state, 
 init
@@ -270,16 +270,25 @@
  BoxGame
+, Contact
 )%7B%0A%0A  'u
@@ -391,24 +391,677 @@
 g');%0A  %7D);%0A%0A
+  var box = new Box(%7B%0A    gravityX: 0,%0A    gravityY: 0,%0A    contactListener: new Contact(%7B%0A      beginContact: function(idA, idB, contact)%7B%0A        if(idA !== 'ball' && idB !== 'ball')%7B%0A          return;%0A        %7D%0A        var id = idA !== 'ball' ? idA : idB;%0A        if(game.entities%5Bid%5D.sensor)%7B%0A          game.entities.ball.touching%5Bid%5D = true;%0A        %7D%0A      %7D,%0A      endContact: function(idA, idB, contact)%7B%0A        if(idA !== 'ball' && idB !== 'ball')%7B%0A          return;%0A        %7D%0A        var id = idA !== 'ball' ? idA : idB;%0A        if(game.entities%5Bid%5D.sensor)%7B%0A          game.entities.ball.touching%5Bid%5D = false;%0A        %7D%0A      %7D%0A    %7D)%0A  %7D);%0A%0A
   //setup a 
@@ -1198,92 +1198,11 @@
 ox: 
-new Box(%7B%0A      gravityY: 0,%0A      gravityX: 0,%0A      resolveCollisions: true%0A    %7D)
+box
 ,%0A  
@@ -1333,16 +1333,30 @@
 new UI()
+,%0A    level: 0
 %0A  %7D);%0A%0A
@@ -1461,12 +1461,11 @@
 vel(
-stat
+gam
 e.le

remove state, add contact listener to box