Adds a new tank type, expands first level.
authordsc <david.schoonover@gmail.com>
Mon, 28 Feb 2011 09:53:57 +0000 (01:53 -0800)
committerdsc <david.schoonover@gmail.com>
Mon, 28 Feb 2011 09:53:57 +0000 (01:53 -0800)
data/config.yaml
data/types/levels.yaml
data/types/units.yaml
src/tanks/map/index.cjs
src/tanks/map/pathing/map.cjs
src/tanks/map/pit.cjs [moved from src/tanks/map/fence.cjs with 94% similarity]
src/tanks/ui/grid.cjs
src/tanks/ui/main.cjs
src/tanks/ui/viewport.cjs
www/css/lttl.css

index e32760c..7080b0a 100644 (file)
@@ -1,12 +1,12 @@
 game:
     timeDilation        : 1.0
-    # zoom                : 1.0
     gameoverDelay       : 1000
 debug:
     showFpsGraph        : false
-    enableGameLogging   : false
-    # createGridTable    : false
-    # showGridCoords     : false
+    # enableGameLogging   : false
+    # createGridCanvas    : false
+    createGridTable     : false
+    showGridCoords      : false
 map:
     refSize             : &ref_size 50
     rockSizeMin         : 12.5
@@ -17,7 +17,6 @@ pathing:
     overlayPathmap      : false
     traceTrajectories   : false
 ui:
-    createGridCanvas    : true
     overlayOnPause      : true
     showAttackCooldown  : false
     showCountdown       : true
index 1a2b15d..2021d39 100644 (file)
@@ -13,12 +13,12 @@ types:
     test:
         name: Da Test
         desc: A test level.
-        levelSize: 2000 500
+        levelSize: 1000 500
         bounds:
-          - [-50,-50, 2100,50]
+          - [-50,-50, 1100,50]
           - [-50,0, 50,500]
-          - [2001,0, 50,500]
-          - [-50,501, 2100,50]
+          - [1001,0, 50,500]
+          - [-50,501, 1100,50]
         walls:
           - type: wall
             args: [300,50, 50,200] # [x,y, w,h]
@@ -31,20 +31,20 @@ types:
           - type: wall
             args: [450,300, 50,200]
          
-          - type: fence
+          - type: pit
             args: [360,210, 30,30]
           - type: rock
             args: [400,200, 25,25]
           - type: rock
             args: [425,225, 25,25]
-          - type: fence
+          - type: pit
             args: [460,210, 30,30]
          
-          - type: fence
+          - type: pit
             args: [10,210, 30,30]
-          - type: fence
+          - type: pit
             args: [110,210, 30,30]
-          - type: fence
+          - type: pit
             args: [210,210, 30,30]
          
           - type: rock
@@ -57,6 +57,68 @@ types:
             args: [100,400, 50,50]
           - type: rock
             args: [150,300, 50,50]
+          
+          - type: rock
+            args: [560,100, 30,30]
+          - type: rock
+            args: [575,130, 20,20]
+          - type: rock
+            args: [550,150, 40,40]
+          - type: rock
+            args: [560,190, 10,10]
+          - type: pit
+            args: [560,210, 30,30]
+          - type: rock
+            args: [550,250, 25,25]
+          - type: rock
+            args: [550,275, 25,25]
+          - type: rock
+            args: [575,290, 10,10]
+          - type: rock
+            args: [560,300, 30,30]
+          - type: rock
+            args: [575,330, 20,20]
+          
+          - type: wall
+            args: [650,250, 50,50]
+          - type: pit
+            args: [500,400, 150,100]
+          
+          # moat
+          - type: pit
+            args: [725,50, 10,10]
+          - type: pit
+            args: [725,60, 25,280]
+          
+          # rock hallway
+          # - type: wall
+          #   args: [750,0, 25,50]
+          # - type: wall
+          #   args: [875,0, 25,50]
+          - type: rock
+            args: [725,0, 50,50]
+          - type: rock
+            args: [735,50, 10,10]
+          - type: rock
+            args: [745,50, 10,10]
+          - type: rock
+            args: [755,50, 10,10]
+          - type: rock
+            args: [765,50, 10,10]
+          - type: rock
+            args: [750,60, 10,10]
+          - type: rock
+            args: [760,60, 30,30]
+          - type: rock
+            args: [860,60, 30,30]
+          - type: rock
+            args: [760,160, 30,30]
+          - type: rock
+            args: [860,160, 30,30]
+          - type: rock
+            args: [760,260, 30,30]
+          - type: rock
+            args: [860,260, 30,30]
         
         units:
           - type: player
@@ -68,12 +130,21 @@ types:
           - type: green
             align: 2
             loc: [175,25]
-          # - type: green
-          #   align: 2
-          #   loc: [425,125]
+          - type: green
+            align: 2
+            loc: [525,25]
+          - type: green
+            align: 2
+            loc: [675,425]
+          - type: orange
+            align: 2
+            loc: [775,125]
+          - type: orange
+            align: 2
+            loc: [775,325]
         items:
-          # - type: rockets
-          #   loc: [325,275]
+          - type: rockets
+            loc: [75,275]
           - type: nitro
             loc: [325,25]
     
@@ -94,20 +165,20 @@ types:
           - type: wall
             args: [100,100, 50,50]
          
-          - type: fence
+          - type: pit
             args: [360,210, 30,30]
           - type: rock
             args: [400,200, 25,25]
           - type: rock
             args: [425,225, 25,25]
-          - type: fence
+          - type: pit
             args: [460,210, 30,30]
          
-          - type: fence
+          - type: pit
             args: [10,210, 30,30]
-          - type: fence
+          - type: pit
             args: [110,210, 30,30]
-          - type: fence
+          - type: pit
             args: [210,210, 30,30]
          
           - type: rock
@@ -163,20 +234,20 @@ types:
           - type: wall
             args: [100,100, 50,50]
          
-          - type: fence
+          - type: pit
             args: [360,210, 30,30]
           - type: rock
             args: [400,200, 25,25]
           - type: rock
             args: [425,225, 25,25]
-          - type: fence
+          - type: pit
             args: [460,210, 30,30]
          
-          - type: fence
+          - type: pit
             args: [10,210, 30,30]
-          - type: fence
+          - type: pit
             args: [110,210, 30,30]
-          - type: fence
+          - type: pit
             args: [210,210, 30,30]
          
           - type: rock
@@ -229,20 +300,20 @@ types:
           - type: wall
             args: [100,100, 50,50]
          
-          - type: fence
+          - type: pit
             args: [360,210, 30,30]
           # - type: rock
           #   args: [400,200, 25,25]
           # - type: rock
           #   args: [425,225, 25,25]
-          - type: fence
+          - type: pit
             args: [460,210, 30,30]
          
-          - type: fence
+          - type: pit
             args: [10,210, 30,30]
-          - type: fence
+          - type: pit
             args: [110,210, 30,30]
-          - type: fence
+          - type: pit
             args: [210,210, 30,30]
          
           - type: rock
index 15c7596..899fba6 100644 (file)
@@ -46,6 +46,7 @@ types:
             body   : '#E73075'
             turret : '#A72F5B'
             barrel : '#2E62C9'
+    
     blue:
         name: Blue Tank
         desc: A friendly blue tank.
@@ -66,6 +67,7 @@ types:
             body   : '#4596FF'
             turret : '#182B53'
             barrel : '#F25522'
+    
     green:
         name: Green Tank
         desc: A very green tank.
@@ -77,7 +79,7 @@ types:
             move  : 0.75
             power : 1
             speed : 0.5
-            shots : 3
+            shots : 5
         ai:
             path          : 1.0
             dodge         : 1.0
@@ -87,6 +89,28 @@ types:
             body   : '#83BB32'
             turret : '#1C625B'
             barrel : '#D43B24'
-            
+    
+    orange:
+        name: Orange Tank
+        desc: A very orange tank.
+        tags: [ 'tank' ]
+        symbol: tanks/thing/tank.Tank
+        lootTable : rich
+        stats:
+            hp    : 1
+            move  : 0.45
+            power : 1
+            speed : 0.35
+            shots : 3
+        ai:
+            path          : 1.0
+            dodge         : 1.0
+            shootIncoming : 0.10
+            shootEnemy    : 0.35
+        colors:
+            body   : '#EE8057'
+            turret : '#C13B00'
+            barrel : '#244792'
+        
         
     
index eaf4b68..b6580d4 100644 (file)
@@ -6,5 +6,5 @@ require('Y').Y
     'Level'   : require('tanks/map/level').Level,
     'Wall'    : require('tanks/map/wall').Wall,
     'Rock'    : require('tanks/map/rock').Rock,
-    'Fence'   : require('tanks/map/fence').Fence
+    'Pit'   : require('tanks/map/pit').Pit
 });
index 8b6b7d2..f36f041 100644 (file)
@@ -28,7 +28,7 @@ QuadTree.subclass('Map', {
     
     allWalls   : null, // All walls in this map
     innerWalls : null, // Non-boundary walls
-    denseWalls : null, // Non-boundary non-Fences
+    denseWalls : null, // Non-boundary non-Pits
     
     
     
similarity index 94%
rename from src/tanks/map/fence.cjs
rename to src/tanks/map/pit.cjs
index d985260..c562065 100644 (file)
@@ -8,9 +8,9 @@ var Y = require('Y').Y
 ,
 
 
-Fence =
-exports['Fence'] =
-Wall.subclass('Fence', {
+Pit =
+exports['Pit'] =
+Wall.subclass('Pit', {
     
     isReflective : false,
     
@@ -27,7 +27,7 @@ Wall.subclass('Fence', {
     
     
     
-    init : function initFence(x,y, w,h){
+    init : function initPit(x,y, w,h){
         Wall.init.call(this, x,y, w,h, this.isBoundary);
     },
     
index cc82a2c..141aa4a 100644 (file)
@@ -37,26 +37,26 @@ Rect.subclass('Grid', {
         ,   h    =  this.canvasHeight
         ;
         
-        // if ( this.createGridTable ) {
-        //     var tbody = $('<tbody/>');
-        //     Y(0, rows).forEach(function(y){
-        //         var row = $('<tr class="row row'+y+'" />').appendTo(tbody);
-        //         Y(0, cols).forEach(function(x){
-        //             $('<td class="cell cell'+x+'_'+y+' col'+x+'">'+x+','+y+'</td>')
-        //                 .width(side).height(side)
-        //                 .appendTo(row);
-        //         }, this);
-        //     }, this);
-        //     
-        //     this.table =
-        //         $('<table class="grid" cellspacing="0" cellpadding="0" />')
-        //             .width(this.layerWidth)
-        //             .height(this.layerHeight)
-        //             .append(tbody)
-        //             .prependTo( this.layer );
-        //     
-        // } else
-        //     this.table = null;
+        if ( this.createGridTable ) {
+            var tbody = $('<tbody/>');
+            Y(0, rows).forEach(function(y){
+                var row = $('<tr class="row row'+y+'" />').appendTo(tbody);
+                Y(0, cols).forEach(function(x){
+                    $('<td class="cell cell'+x+'_'+y+' col'+x+'">'+(x*side)+','+(y*side)+'</td>')
+                        .width(side).height(side)
+                        .appendTo(row);
+                }, this);
+            }, this);
+            
+            this.table =
+                $('<table class="grid" cellspacing="0" cellpadding="0" />')
+                    .width(this.layerWidth)
+                    .height(this.layerHeight)
+                    .append(tbody)
+                    .prependTo( this.layer );
+            
+        } else
+            this.table = null;
         
         if ( this.createGridCanvas ) {
             ctx.lineWidth   = this.lineWidth;
@@ -78,5 +78,5 @@ Rect.subclass('Grid', {
     
 });
 
-config.updateOnChange(['ui.createGridTable', 'ui.createGridCanvas'], Grid.fn);
+config.updateOnChange(['debug.createGridTable', 'debug.createGridCanvas'], Grid.fn);
 
index 5ca519a..8c9d2e6 100644 (file)
@@ -35,15 +35,17 @@ function main(){
     
     overlay = $('#overlay');
     updateOverlay( config.get('ui.overlayOnPause') );
-    config.on('set:ui.overlayOnPause',     function(evt){ updateOverlay(evt.newval); });
-    config.on('set:ui.debug.showFpsGraph', function(evt){ updateUI('#info', evt.newval); });
+    config.on('set:ui.overlayOnPause',    function(evt){ updateOverlay(evt.newval); });
+    config.on('set:debug.showFpsGraph',   function(evt){ updateUI('#info', evt.newval); });
+    config.on('set:debug.showGridCoords', function(evt){ $('body')[(evt.newval ? 'add' : 'remove' )+'Class']('showGridCoords'); });
     
-    // Player.on('create', function(evt){ P = evt.data.instance; });
+    config.set('debug.showGridCoords', config.get('debug.showGridCoords'));
     
     /// Debug ///
     if (qkv.debug || config.get('debug.showFpsGraph'))
         updateUI('#info', SHOW);
     
+    
     // Show debug menus
     $(document).bind('keydown', 'ctrl+d', function(evt){ updateUI('.debug',  TOGGLE); });
     $(document).bind('keydown', 'ctrl+i', function(evt){ updateUI('#info',   TOGGLE); });
index c9b14ea..a09ee1e 100644 (file)
@@ -6,7 +6,7 @@ var Y = require('Y').Y
 ,   min = Y(Math.min).limit(2)
 ,   max = Y(Math.max).limit(2)
 
-,   PAD_X = 1024, PAD_Y = 690
+,   PAD_X = 1024, PAD_Y = 690 // viewport padding is max iPad resolution (heh)
 ,
 
 Viewport =
@@ -15,12 +15,15 @@ HtmlLayer.subclass('Viewport', {
     _layerId : 'viewport',
     
     spacer : null, // inner layer to induce scrolling so we can arbitrarily center the elements
-    maxBleedX : 10, // Maximum amount of empty space to show to the left/right of content. (Tip: set to Infinity to disable)
-    maxBleedY : 10, // Maximum amount of empty space to show to the top/bottom of content. (Tip: set to Infinity to disable)
+    maxViewWidth  : 600,    // Max portal sizes
+    maxViewHeight : 520,
+    maxBleedX     : 10,     // Maximum amount of empty space to show (Tip: set to Infinity to disable)
+    maxBleedY     : 10,
     
     
     init : function initViewport(props, attrs, html){
         HtmlLayer.init.call(this, props, attrs, html);
+        this.css({ 'max-width':this.maxViewWidth, 'max-height':this.maxViewHeight });
         this.spacer = $('<div class="spacer ezl layer" />').appendTo(this.layer);
     },
     
index d6496cd..693085f 100644 (file)
@@ -15,7 +15,7 @@ td { text-align:center; vertical-align:middle; }
 
 .bigblue { position:fixed; width:100%; top:50%; margin-top:-200px; z-index:1001; }
     .bigblue .box { width:400px; margin:0 auto; padding:1em; color:#000; background-color:#2992C5;
-        box-shadow:7.5px 7.5px 15px #000; -moz-box-shadow:7.5px 7.5px 15px #000; -webkit-box-shadow:7.5px 7.5px 15px #000; }
+        box-shadow:5px 5px 6px 2px rgba(0,0,0,0.4); -moz-box-shadow:5px 5px 6px 2px rgba(0,0,0,0.4); -webkit-box-shadow:5px 5px 6px 2px rgba(0,0,0,0.4); }
     .bigblue h1 { text-align:center; font-size:2em; letter-spacing:2px; }
     .bigblue h2 { font-size:1.1em; letter-spacing:2px; }
     .bigblue .start { margin:1.5em 0 0.5em; text-align:center; border:0; }
@@ -49,8 +49,10 @@ td { text-align:center; vertical-align:middle; }
 /*** Game and Viewport ***/
 
 #game { position:relative; width:100%; height:100%; margin:0; padding:0; }
-#viewport { position:relative; width:100%; height:100%; max-width:1024px; max-height:690px;
-        overflow:hidden; cursor:crosshair; margin:0 auto; background-color:#3F3F3F; }
+#viewport { width:100%; height:100%; /* max-width:1024px; max-height:690px; */ /* <- Set by Viewport class */
+        position:relative; margin:10px auto; overflow:hidden; cursor:crosshair;
+        background-color:#3F3F3F; border:15px solid #222;
+        box-shadow:inset 0 0 5px 1px rgba(0,0,0,0.4); -moz-box-shadow:inset 0 0 5px 1px rgba(0,0,0,0.4); -webkit-box-shadow:inset 0 0 5px 1px rgba(0,0,0,0.4); }
     #viewport > .layer { margin:690px 1024px; }
     #viewport > .spacer { position:absolute; z-index:-1; width:1024px; height:690px; /* width:100%; height:100%; */ }
     #viewport .layer.grid { outline:1px solid rgba(255,255,255, 0.1); }
@@ -99,12 +101,13 @@ td { text-align:center; vertical-align:middle; }
     #config input[type=checkbox] { top:0.33em; }
 
 
-table.grid { position:absolute; top:0; left:0; z-index:10; }
+#viewport .layer.grid { z-index:1000; }
+table.grid { position:absolute; top:0; left:0; }
 table.grid,
-table.grid td { /* outline:1px solid rgba(255,255,255,0.1); */ 
-    color:transparent; font: 18pt monospace; 
+table.grid td { outline:1px solid rgba(255,255,255,0.05);
+    color:transparent; font: 10px/50px Menlo, monospace; text-align:center;
     margin:0; padding:0; white-space:nowrap; overflow:hidden; }
-.showGridCoords table.grid td:hover { color:rgba(255,255,255,0.1); }
+.showGridCoords table.grid td:hover { color:rgba(255,255,255,0.5); }
 
 /* 
 #debug { position:relative; top:1em; right:1em; z-index:5000; }