From: dsc Date: Sun, 2 Jan 2011 01:14:48 +0000 (-0800) Subject: Oops. Left debug logging in. X-Git-Url: http://git.less.ly:3516/?a=commitdiff_plain;h=7a28c67316c92d3a022d9c85abb4af08918f173c;p=tanks.git Oops. Left debug logging in. --- diff --git a/src/Y/core.cjs b/src/Y/core.cjs index 1c237cd..706755e 100644 --- a/src/Y/core.cjs +++ b/src/Y/core.cjs @@ -181,6 +181,7 @@ function descriptors(A, B){ if (arguments.length < 2) return reduce(A, _getDescriptors, {}); + // FIXME: This is busted var desc = slice.call(arguments,1).reduce(_copyDescriptors, {}); Object.defineProperties(A, desc); return A; diff --git a/src/tanks/index.js b/src/tanks/index.js index 455172d..f2abafe 100644 --- a/src/tanks/index.js +++ b/src/tanks/index.js @@ -13,7 +13,7 @@ tanks = { 'ui' : require('tanks/ui'), 'Game' : require('tanks/game').Game, - 'currentGame' : null, + 'game' : null, }; diff --git a/src/tanks/map/level.cjs b/src/tanks/map/level.cjs index 2877b92..d45bde0 100644 --- a/src/tanks/map/level.cjs +++ b/src/tanks/map/level.cjs @@ -45,36 +45,36 @@ Rect.subclass('Level', { game.player = game.addThing(new PlayerTank(1), 3,9); // game.addThing(new Tank(1).colors('#4596FF', '#182B53', '#F25522'), 3,9); - // E = - // game.addThing(new Tank(2), 0,7); - // game.addThing(new Tank(2), 1,0); - // game.addThing(new Tank(2), 8,1); + E = + game.addThing(new Tank(2), 0,7); + game.addThing(new Tank(2), 1,0); + game.addThing(new Tank(2), 8,1); - // I = game.addThing(new Item(), 8,8); + I = game.addThing(new Item(), 8,8); - DATA = $('
').appendTo('body');
-        E = game.addThing(new Thing(2), 0,0);
-        var i = 0;
-        function testBulletSpeed(){
-            B = P.shoot(0,475);
-            var start = new Date().getTime()
-            ,   startClock = NOW
-            ,   startX = B.loc.x;
-            B.bounces = 1;
-            console.log(i+' B.movePerMs='+B.movePerMs+', move='+B.stats.move);
-            
-            B.addEventListener('destroy', function(evt){
-                var elapsed = (new Date().getTime() - start)/1000
-                ,   clock = (NOW - startClock)/1000
-                ,   distance = startX - B.loc.x ;
-                DATA.text(DATA.text()+elapsed.toFixed(3)+'\t'+clock.toFixed(3)+'\t'+distance.toFixed(3)+'\t'+(distance/elapsed).toFixed(3)+'\n');
-                if (++i < 20) testBulletSpeed();
-            });
-        }
-        game.addEventListener('start', function(evt){
-            DATA.text('elapsed\tclock\tpx\tpx/s\n');
-            testBulletSpeed();
-        });
+        // DATA = $('
').appendTo('body');
+        // E = game.addThing(new Thing(2), 0,0);
+        // var i = 0;
+        // function testBulletSpeed(){
+        //     B = P.shoot(0,475);
+        //     var start = new Date().getTime()
+        //     ,   startClock = NOW
+        //     ,   startX = B.loc.x;
+        //     B.bounces = 1;
+        //     console.log(i+' B.movePerMs='+B.movePerMs+', move='+B.stats.move);
+        //     
+        //     B.addEventListener('destroy', function(evt){
+        //         var elapsed = (new Date().getTime() - start)/1000
+        //         ,   clock = (NOW - startClock)/1000
+        //         ,   distance = startX - B.loc.x ;
+        //         DATA.text(DATA.text()+elapsed.toFixed(3)+'\t'+clock.toFixed(3)+'\t'+distance.toFixed(3)+'\t'+(distance/elapsed).toFixed(3)+'\n');
+        //         if (++i < 20) testBulletSpeed();
+        //     });
+        // }
+        // game.addEventListener('start', function(evt){
+        //     DATA.text('elapsed\tclock\tpx\tpx/s\n');
+        //     testBulletSpeed();
+        // });
     },
     
     addWall : function addWall(x,y, w,h, isBoundary){
diff --git a/src/tanks/thing/thing.cjs b/src/tanks/thing/thing.cjs
index b82b7d0..ad36be2 100644
--- a/src/tanks/thing/thing.cjs
+++ b/src/tanks/thing/thing.cjs
@@ -93,11 +93,8 @@ exports['Thing'] = new evt.Class('Thing', {
     'attr' : op.attr.methodize(),
     
     get movePerMs(){
-        var stat = this.stats.move
-        ,   move = (typeof stat === "number" ? stat : stat.val);
-        var r = move*REF_SIZE/1000;
-        console.log(this+'.movePerMs = '+move+'*'+REF_SIZE+'/1000 = '+r);
-        return r;
+        var stat = this.stats.move;
+        return (typeof stat === "number" ? stat : stat.val)*REF_SIZE/1000;
     },
     
     
diff --git a/src/tanks/ui/main.cjs b/src/tanks/ui/main.cjs
index dbdcb8a..23aa750 100644
--- a/src/tanks/ui/main.cjs
+++ b/src/tanks/ui/main.cjs
@@ -11,6 +11,7 @@ var Y            = require('Y').Y
 ,   config       = require('tanks/config').config
 
 ,   updateTimer  = null
+,   LBT = null
 ;
 function stopProp(evt){ evt.stopPropagation(); }
 
@@ -86,12 +87,12 @@ function main(){
     // $('#overlay').hide();
 }
 
-function gameExists(){ return !!tanks.currentGame; }
+function gameExists(){ return !!tanks.game; }
 
 function setupGame(){
     if ( gameExists() ) teardownGame();
     
-    LBT = tanks.currentGame = new Game();
+    LBT = tanks.game = new Game();
     
     LBT.addEventListener('win',  gameover('You Win!', 'Play Again', ''));
     LBT.addEventListener('lose', gameover('You Lose :(', 'Try Again', ''));
@@ -153,7 +154,7 @@ function startGame(evt){
 }
 
 function pauseGame(evt){
-    // $('#overlay').toggle();
+    $('#overlay').toggle();
     $('#pause').toggle();
     toggleGame();
 }
diff --git a/src/tanks/util/utils.cjs b/src/tanks/util/utils.cjs
index 04c1494..86f52a1 100644
--- a/src/tanks/util/utils.cjs
+++ b/src/tanks/util/utils.cjs
@@ -6,7 +6,7 @@ Object.dump = function(o){
 };
 
 function dumpPathmap(){
-    var pm = LBT.pathmap;
+    var pm = tanks.game.pathmap;
     console.warn(new Date(), pm);
     pm.collect(pm.x1,pm.y1, pm.x2,pm.y2, function(acc, v, r){
         console.log(r+'');