Reset globals.
authordsc <david.schoonover@gmail.com>
Mon, 22 Nov 2010 05:42:03 +0000 (21:42 -0800)
committerdsc <david.schoonover@gmail.com>
Mon, 22 Nov 2010 05:42:03 +0000 (21:42 -0800)
css/lttl.css
src/tanks/config.js
src/tanks/game/game.js
src/tanks/globals.js
src/tanks/main.js

index 4a925ee..4960efe 100644 (file)
@@ -23,7 +23,7 @@ table.grid td { /* outline:1px solid rgba(255,255,255,0.1); */
     margin:0; padding:0; white-space:nowrap; overflow:hidden; }
 .gridShowCoords table.grid td:hover { color:rgba(255,255,255,0.1); }
 
-#viewport { position:relative; width:500px; height:500px; margin:1em auto; /* overflow:hidden; */ }
+#viewport { position:relative; width:500px; height:500px; margin:1em auto; cursor:crosshair; }
 
 
 #overlay { position:fixed; top:0; left:0; width:100%; height:100%; background-color:#000; opacity:0.5; z-index:100; }
index d6e2652..39b1897 100644 (file)
@@ -1,12 +1,11 @@
 //  -*- mode: JavaScript; tab-width: 4; indent-tabs-mode: nil; -*-
 tanks.config = {
+    debug : {
+        gridShowCoords : false
+    },
     pathing : { 
         overlayPathmap    : false,
         overlayAIPaths    : false,
         traceTrajectories : false
-    },
-    debug : {
-        gridShowCoords : false
-        
     }
 };
\ No newline at end of file
index 78e25d7..a8a9950 100644 (file)
@@ -3,6 +3,8 @@ tanks.Game = new Y.Class('Game', {
     init : function init(viewport){
         Y.bindAll(this);
         
+        tanks.resetGlobals();
+        
         this.byId = {};
         this.active   = new Y.YArray();
         this.units    = new Y.YArray();
index 0f80622..1506b90 100644 (file)
@@ -31,6 +31,15 @@ var undefined
 
 ;
 
+tanks.resetGlobals = function resetGlobals(){
+    NOW      = new Date().getTime();
+    ELAPSED  = MS_PER_FRAME;
+    TICKS    = 0;
+    
+    SECONDTH = ELAPSED / 1000;
+    SQUARETH = REF_SIZE * SECONDTH;
+}
+
 if (!window.console) {
     console = {
         log   : Y.op.nop,
index 1211d25..b76dbaa 100644 (file)
@@ -6,7 +6,7 @@ this.main = main;
 // Main method is only executed once, so we'll setup things
 // that don't change between games.
 function main(){
-    qkv = Y(window.location.search).fromKV();
+    qkv = Y(window.location.search.slice(1)).fromKV().end();
     
     /// Debug ///
     if (qkv.debug) $('#debug').toggle();