Skip to content
This repository
Browse code

Merged David's animation code with jagregrory's collision-detection r…

…outine
  • Loading branch information...
commit e2d393cba39dc0eacd5b7889dfc672a393ec80da 1 parent 5c198c7
dylanbeattie authored June 05, 2011
70  .idea/projectCodeStyle.xml
... ...
@@ -0,0 +1,70 @@
  1
+<?xml version="1.0" encoding="UTF-8"?>
  2
+<project version="4">
  3
+  <component name="CodeStyleSettingsManager">
  4
+    <option name="PER_PROJECT_SETTINGS">
  5
+      <value>
  6
+        <ADDITIONAL_INDENT_OPTIONS fileType="css">
  7
+          <option name="INDENT_SIZE" value="4" />
  8
+          <option name="CONTINUATION_INDENT_SIZE" value="8" />
  9
+          <option name="TAB_SIZE" value="4" />
  10
+          <option name="USE_TAB_CHARACTER" value="false" />
  11
+          <option name="SMART_TABS" value="false" />
  12
+          <option name="LABEL_INDENT_SIZE" value="0" />
  13
+          <option name="LABEL_INDENT_ABSOLUTE" value="false" />
  14
+          <option name="USE_RELATIVE_INDENTS" value="false" />
  15
+        </ADDITIONAL_INDENT_OPTIONS>
  16
+        <ADDITIONAL_INDENT_OPTIONS fileType="haml">
  17
+          <option name="INDENT_SIZE" value="2" />
  18
+          <option name="CONTINUATION_INDENT_SIZE" value="8" />
  19
+          <option name="TAB_SIZE" value="4" />
  20
+          <option name="USE_TAB_CHARACTER" value="false" />
  21
+          <option name="SMART_TABS" value="false" />
  22
+          <option name="LABEL_INDENT_SIZE" value="0" />
  23
+          <option name="LABEL_INDENT_ABSOLUTE" value="false" />
  24
+          <option name="USE_RELATIVE_INDENTS" value="false" />
  25
+        </ADDITIONAL_INDENT_OPTIONS>
  26
+        <ADDITIONAL_INDENT_OPTIONS fileType="js">
  27
+          <option name="INDENT_SIZE" value="4" />
  28
+          <option name="CONTINUATION_INDENT_SIZE" value="8" />
  29
+          <option name="TAB_SIZE" value="4" />
  30
+          <option name="USE_TAB_CHARACTER" value="false" />
  31
+          <option name="SMART_TABS" value="false" />
  32
+          <option name="LABEL_INDENT_SIZE" value="0" />
  33
+          <option name="LABEL_INDENT_ABSOLUTE" value="false" />
  34
+          <option name="USE_RELATIVE_INDENTS" value="false" />
  35
+        </ADDITIONAL_INDENT_OPTIONS>
  36
+        <ADDITIONAL_INDENT_OPTIONS fileType="sass">
  37
+          <option name="INDENT_SIZE" value="2" />
  38
+          <option name="CONTINUATION_INDENT_SIZE" value="8" />
  39
+          <option name="TAB_SIZE" value="4" />
  40
+          <option name="USE_TAB_CHARACTER" value="false" />
  41
+          <option name="SMART_TABS" value="false" />
  42
+          <option name="LABEL_INDENT_SIZE" value="0" />
  43
+          <option name="LABEL_INDENT_ABSOLUTE" value="false" />
  44
+          <option name="USE_RELATIVE_INDENTS" value="false" />
  45
+        </ADDITIONAL_INDENT_OPTIONS>
  46
+        <ADDITIONAL_INDENT_OPTIONS fileType="xml">
  47
+          <option name="INDENT_SIZE" value="4" />
  48
+          <option name="CONTINUATION_INDENT_SIZE" value="8" />
  49
+          <option name="TAB_SIZE" value="4" />
  50
+          <option name="USE_TAB_CHARACTER" value="false" />
  51
+          <option name="SMART_TABS" value="false" />
  52
+          <option name="LABEL_INDENT_SIZE" value="0" />
  53
+          <option name="LABEL_INDENT_ABSOLUTE" value="false" />
  54
+          <option name="USE_RELATIVE_INDENTS" value="false" />
  55
+        </ADDITIONAL_INDENT_OPTIONS>
  56
+        <ADDITIONAL_INDENT_OPTIONS fileType="yml">
  57
+          <option name="INDENT_SIZE" value="2" />
  58
+          <option name="CONTINUATION_INDENT_SIZE" value="8" />
  59
+          <option name="TAB_SIZE" value="4" />
  60
+          <option name="USE_TAB_CHARACTER" value="false" />
  61
+          <option name="SMART_TABS" value="false" />
  62
+          <option name="LABEL_INDENT_SIZE" value="0" />
  63
+          <option name="LABEL_INDENT_ABSOLUTE" value="false" />
  64
+          <option name="USE_RELATIVE_INDENTS" value="false" />
  65
+        </ADDITIONAL_INDENT_OPTIONS>
  66
+      </value>
  67
+    </option>
  68
+  </component>
  69
+</project>
  70
+
166  .idea/workspace.xml
... ...
@@ -1,8 +1,14 @@
1 1
 <?xml version="1.0" encoding="UTF-8"?>
2 2
 <project version="4">
3 3
   <component name="ChangeListManager">
4  
-    <list default="true" id="7317696f-fc4e-428e-a525-03340f4ecdb5" name="Default" comment="">
  4
+    <list default="true" id="7317696f-fc4e-428e-a525-03340f4ecdb5" name="Default" comment="Fixed bug - was setting left and width of horizontal box instead of top and height. D'oh.">
  5
+      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/.idea/projectCodeStyle.xml" />
5 6
       <change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
  7
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/public/css/bomber.css" afterPath="$PROJECT_DIR$/public/css/bomber.css" />
  8
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/public/index.html" afterPath="$PROJECT_DIR$/public/index.html" />
  9
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/public/js/game/client.js" afterPath="$PROJECT_DIR$/public/js/game/client.js" />
  10
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/public/js/game/kaboom.game.js" afterPath="$PROJECT_DIR$/public/js/game/kaboom.game.js" />
  11
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/public/js/game/kaboom.renderer.js" afterPath="$PROJECT_DIR$/public/js/game/kaboom.renderer.js" />
6 12
     </list>
7 13
     <list id="07e85f89-abd1-48f0-9afd-84fa67e279d7" name="Failed commit: Default" comment="Removed all hardcoded references to &quot;localhost&quot;. server.js will now listen on all available IPs on the specified port, and the KaboomClient passes window.location.hostname and window.location.port into the SocketClient init() routine. This means Kaboom now runs cleanly on remote servers." />
8 14
     <ignored path="KaboomJS.iws" />
@@ -38,7 +44,7 @@
38 44
       <file leaf-file-name="client.js" pinned="false" current="false" current-in-tab="false">
39 45
         <entry file="file://$PROJECT_DIR$/public/js/game/client.js">
40 46
           <provider selected="true" editor-type-id="text-editor">
41  
-            <state line="45" column="55" selection-start="1582" selection-end="1582" vertical-scroll-proportion="0.0">
  47
+            <state line="17" column="0" selection-start="463" selection-end="463" vertical-scroll-proportion="0.0">
42 48
               <folding />
43 49
             </state>
44 50
           </provider>
@@ -53,19 +59,55 @@
53 59
           </provider>
54 60
         </entry>
55 61
       </file>
56  
-      <file leaf-file-name="kaboom.game.js" pinned="false" current="true" current-in-tab="true">
  62
+      <file leaf-file-name="kaboom.game.js" pinned="false" current="false" current-in-tab="false">
57 63
         <entry file="file://$PROJECT_DIR$/public/js/game/kaboom.game.js">
58 64
           <provider selected="true" editor-type-id="text-editor">
59  
-            <state line="122" column="63" selection-start="4350" selection-end="4350" vertical-scroll-proportion="0.93760264">
  65
+            <state line="17" column="0" selection-start="454" selection-end="454" vertical-scroll-proportion="0.0">
60 66
               <folding />
61 67
             </state>
62 68
           </provider>
63 69
         </entry>
64 70
       </file>
65  
-      <file leaf-file-name="kaboom.renderer.js" pinned="false" current="false" current-in-tab="false">
  71
+      <file leaf-file-name="kaboom.player.js" pinned="false" current="false" current-in-tab="false">
  72
+        <entry file="file://$PROJECT_DIR$/public/js/game/kaboom.player.js">
  73
+          <provider selected="true" editor-type-id="text-editor">
  74
+            <state line="47" column="21" selection-start="1153" selection-end="1153" vertical-scroll-proportion="0.0">
  75
+              <folding />
  76
+            </state>
  77
+          </provider>
  78
+        </entry>
  79
+      </file>
  80
+      <file leaf-file-name="kaboom.renderer.js" pinned="false" current="true" current-in-tab="true">
66 81
         <entry file="file://$PROJECT_DIR$/public/js/game/kaboom.renderer.js">
67 82
           <provider selected="true" editor-type-id="text-editor">
68  
-            <state line="44" column="31" selection-start="1517" selection-end="1517" vertical-scroll-proportion="0.0">
  83
+            <state line="86" column="13" selection-start="3003" selection-end="3003" vertical-scroll-proportion="0.025745258">
  84
+              <folding />
  85
+            </state>
  86
+          </provider>
  87
+        </entry>
  88
+      </file>
  89
+      <file leaf-file-name="index.html" pinned="false" current="false" current-in-tab="false">
  90
+        <entry file="file://$PROJECT_DIR$/public/index.html">
  91
+          <provider selected="true" editor-type-id="text-editor">
  92
+            <state line="30" column="31" selection-start="907" selection-end="907" vertical-scroll-proportion="-19.826086">
  93
+              <folding />
  94
+            </state>
  95
+          </provider>
  96
+        </entry>
  97
+      </file>
  98
+      <file leaf-file-name="bomber.css" pinned="false" current="false" current-in-tab="false">
  99
+        <entry file="file://$PROJECT_DIR$/public/css/bomber.css">
  100
+          <provider selected="true" editor-type-id="text-editor">
  101
+            <state line="49" column="27" selection-start="674" selection-end="674" vertical-scroll-proportion="0.0">
  102
+              <folding />
  103
+            </state>
  104
+          </provider>
  105
+        </entry>
  106
+      </file>
  107
+      <file leaf-file-name="level.js" pinned="false" current="false" current-in-tab="false">
  108
+        <entry file="file://$PROJECT_DIR$/public/js/game/level.js">
  109
+          <provider selected="true" editor-type-id="text-editor">
  110
+            <state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0">
69 111
               <folding />
70 112
             </state>
71 113
           </provider>
@@ -97,17 +139,34 @@
97 139
         <option value="$PROJECT_DIR$/doc/kaboom_object_model.js" />
98 140
         <option value="$PROJECT_DIR$/doc/object_idea_hacks.txt" />
99 141
         <option value="$PROJECT_DIR$/etc/client_hax.txt" />
100  
-        <option value="$PROJECT_DIR$/public/index.html" />
101 142
         <option value="$PROJECT_DIR$/public/js/game/kaboom.player.js" />
102 143
         <option value="$PROJECT_DIR$/public/js/game/level.js" />
103 144
         <option value="$PROJECT_DIR$/server.js" />
104 145
         <option value="$PROJECT_DIR$/public/js/game/kaboom.socket.js" />
  146
+        <option value="$PROJECT_DIR$/public/css/bomber.css" />
  147
+        <option value="$PROJECT_DIR$/public/js/game/kaboom.game.js" />
105 148
         <option value="$PROJECT_DIR$/public/js/game/client.js" />
  149
+        <option value="$PROJECT_DIR$/public/index.html" />
106 150
         <option value="$PROJECT_DIR$/public/js/game/kaboom.renderer.js" />
107  
-        <option value="$PROJECT_DIR$/public/js/game/kaboom.game.js" />
108 151
       </list>
109 152
     </option>
110 153
   </component>
  154
+  <component name="ProjectInspectionProfilesVisibleTreeState">
  155
+    <entry key="Project Default">
  156
+      <profile-state>
  157
+        <expanded-state>
  158
+          <State>
  159
+            <id />
  160
+          </State>
  161
+        </expanded-state>
  162
+        <selected-state>
  163
+          <State>
  164
+            <id>CSS</id>
  165
+          </State>
  166
+        </selected-state>
  167
+      </profile-state>
  168
+    </entry>
  169
+  </component>
111 170
   <component name="ProjectLevelVcsManager" settingsEditedManually="false">
112 171
     <OptionsSetting value="true" id="Add" />
113 172
     <OptionsSetting value="true" id="Remove" />
@@ -178,6 +237,10 @@
178 237
               <option name="myItemId" value="js" />
179 238
               <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
180 239
             </PATH_ELEMENT>
  240
+            <PATH_ELEMENT>
  241
+              <option name="myItemId" value="libs" />
  242
+              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
  243
+            </PATH_ELEMENT>
181 244
           </PATH>
182 245
           <PATH>
183 246
             <PATH_ELEMENT>
@@ -211,6 +274,42 @@
211 274
               <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
212 275
             </PATH_ELEMENT>
213 276
             <PATH_ELEMENT>
  277
+              <option name="myItemId" value="public" />
  278
+              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
  279
+            </PATH_ELEMENT>
  280
+            <PATH_ELEMENT>
  281
+              <option name="myItemId" value="images" />
  282
+              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
  283
+            </PATH_ELEMENT>
  284
+          </PATH>
  285
+          <PATH>
  286
+            <PATH_ELEMENT>
  287
+              <option name="myItemId" value="KaboomJS" />
  288
+              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
  289
+            </PATH_ELEMENT>
  290
+            <PATH_ELEMENT>
  291
+              <option name="myItemId" value="KaboomJS" />
  292
+              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
  293
+            </PATH_ELEMENT>
  294
+            <PATH_ELEMENT>
  295
+              <option name="myItemId" value="public" />
  296
+              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
  297
+            </PATH_ELEMENT>
  298
+            <PATH_ELEMENT>
  299
+              <option name="myItemId" value="css" />
  300
+              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
  301
+            </PATH_ELEMENT>
  302
+          </PATH>
  303
+          <PATH>
  304
+            <PATH_ELEMENT>
  305
+              <option name="myItemId" value="KaboomJS" />
  306
+              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
  307
+            </PATH_ELEMENT>
  308
+            <PATH_ELEMENT>
  309
+              <option name="myItemId" value="KaboomJS" />
  310
+              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
  311
+            </PATH_ELEMENT>
  312
+            <PATH_ELEMENT>
214 313
               <option name="myItemId" value="data" />
215 314
               <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
216 315
             </PATH_ELEMENT>
@@ -228,7 +327,7 @@
228 327
     <property name="FileHistory.git4idea.history.GitHistoryProvider_treeOrder3" value="3" />
229 328
     <property name="FileHistory.git4idea.history.GitHistoryProvider_treeOrder1" value="1" />
230 329
     <property name="FileHistory.git4idea.history.GitHistoryProvider_treeOrder2" value="2" />
231  
-    <property name="options.lastSelected" value="preferences.keymap" />
  330
+    <property name="options.lastSelected" value="preferences.sourceCode.CSS" />
232 331
     <property name="FileHistory.git4idea.history.GitHistoryProvider_flatOrder1" value="1" />
233 332
     <property name="FileHistory.git4idea.history.GitHistoryProvider_treeWidth0" value="230" />
234 333
     <property name="FileHistory.git4idea.history.GitHistoryProvider_flatOrder0" value="0" />
@@ -292,13 +391,13 @@
292 391
       <window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
293 392
       <window_info id="Phing Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
294 393
       <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
295  
-      <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.5652174" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
  394
+      <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.10105758" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
296 395
       <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="true" content_ui="tabs" />
297 396
       <window_info id="Dependency Viewer" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
298  
-      <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.21800368" sideWeight="0.74735606" order="0" side_tool="false" content_ui="tabs" />
  397
+      <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.21800368" sideWeight="0.8989424" order="0" side_tool="false" content_ui="tabs" />
299 398
       <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
300 399
       <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
301  
-      <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.25264394" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
  400
+      <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25264394" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
302 401
       <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
303 402
       <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
304 403
       <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
@@ -363,55 +462,66 @@
363 462
         <state line="7" column="1" selection-start="170" selection-end="170" vertical-scroll-proportion="0.21341464" />
364 463
       </provider>
365 464
     </entry>
366  
-    <entry file="file://$PROJECT_DIR$/public/index.html">
  465
+    <entry file="file://$PROJECT_DIR$/server.js">
367 466
       <provider selected="true" editor-type-id="text-editor">
368  
-        <state line="24" column="49" selection-start="607" selection-end="607" vertical-scroll-proportion="0.1" />
  467
+        <state line="19" column="0" selection-start="573" selection-end="573" vertical-scroll-proportion="0.0" />
369 468
       </provider>
370 469
     </entry>
371  
-    <entry file="file://$PROJECT_DIR$/public/js/game/level.js">
  470
+    <entry file="file://$PROJECT_DIR$/data/level.txt">
372 471
       <provider selected="true" editor-type-id="text-editor">
373  
-        <state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0" />
  472
+        <state line="13" column="0" selection-start="234" selection-end="234" vertical-scroll-proportion="0.0" />
  473
+      </provider>
  474
+    </entry>
  475
+    <entry file="file://$PROJECT_DIR$/public/js/game/kaboom.socket.js">
  476
+      <provider selected="true" editor-type-id="text-editor">
  477
+        <state line="19" column="29" selection-start="589" selection-end="589" vertical-scroll-proportion="0.0">
  478
+          <folding />
  479
+        </state>
374 480
       </provider>
375 481
     </entry>
376 482
     <entry file="file://$PROJECT_DIR$/public/js/game/kaboom.player.js">
377 483
       <provider selected="true" editor-type-id="text-editor">
378  
-        <state line="47" column="21" selection-start="1003" selection-end="1003" vertical-scroll-proportion="0.22428331" />
  484
+        <state line="47" column="21" selection-start="1153" selection-end="1153" vertical-scroll-proportion="0.0">
  485
+          <folding />
  486
+        </state>
379 487
       </provider>
380 488
     </entry>
381  
-    <entry file="file://$PROJECT_DIR$/server.js">
  489
+    <entry file="file://$PROJECT_DIR$/public/js/game/level.js">
382 490
       <provider selected="true" editor-type-id="text-editor">
383  
-        <state line="19" column="0" selection-start="573" selection-end="573" vertical-scroll-proportion="0.0" />
  491
+        <state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0" />
384 492
       </provider>
385 493
     </entry>
386  
-    <entry file="file://$PROJECT_DIR$/data/level.txt">
  494
+    <entry file="file://$PROJECT_DIR$/public/css/bomber.css">
387 495
       <provider selected="true" editor-type-id="text-editor">
388  
-        <state line="13" column="0" selection-start="234" selection-end="234" vertical-scroll-proportion="0.0" />
  496
+        <state line="49" column="27" selection-start="674" selection-end="674" vertical-scroll-proportion="0.0">
  497
+          <folding />
  498
+        </state>
389 499
       </provider>
390 500
     </entry>
391  
-    <entry file="file://$PROJECT_DIR$/public/js/game/kaboom.socket.js">
  501
+    <entry file="file://$PROJECT_DIR$/public/js/game/kaboom.game.js">
392 502
       <provider selected="true" editor-type-id="text-editor">
393  
-        <state line="19" column="29" selection-start="589" selection-end="589" vertical-scroll-proportion="0.0">
  503
+        <state line="17" column="0" selection-start="454" selection-end="454" vertical-scroll-proportion="0.0">
394 504
           <folding />
395 505
         </state>
396 506
       </provider>
397 507
     </entry>
398 508
     <entry file="file://$PROJECT_DIR$/public/js/game/client.js">
399 509
       <provider selected="true" editor-type-id="text-editor">
400  
-        <state line="45" column="55" selection-start="1582" selection-end="1582" vertical-scroll-proportion="0.0">
  510
+        <state line="17" column="0" selection-start="463" selection-end="463" vertical-scroll-proportion="0.0">
401 511
           <folding />
402 512
         </state>
403 513
       </provider>
404 514
     </entry>
405  
-    <entry file="file://$PROJECT_DIR$/public/js/game/kaboom.renderer.js">
  515
+    <entry file="file://$PROJECT_DIR$/public/index.html">
406 516
       <provider selected="true" editor-type-id="text-editor">
407  
-        <state line="44" column="31" selection-start="1517" selection-end="1517" vertical-scroll-proportion="0.0">
  517
+        <state line="30" column="31" selection-start="907" selection-end="907" vertical-scroll-proportion="-19.826086">
408 518
           <folding />
409 519
         </state>
410 520
       </provider>
411 521
     </entry>
412  
-    <entry file="file://$PROJECT_DIR$/public/js/game/kaboom.game.js">
  522
+    <entry file="file://$PROJECT_DIR$/public/js/game/kaboom.renderer.js">
413 523
       <provider selected="true" editor-type-id="text-editor">
414  
-        <state line="122" column="63" selection-start="4350" selection-end="4350" vertical-scroll-proportion="0.93760264">
  524
+        <state line="86" column="13" selection-start="3003" selection-end="3003" vertical-scroll-proportion="0.025745258">
415 525
           <folding />
416 526
         </state>
417 527
       </provider>
83  public/css/bomber.css
... ...
@@ -1,80 +1,91 @@
1  
-
2 1
 body {
3  
-	font-family: helvetica;
4  
-	font-size: 1.5em;
5  
-	background: black;
6  
-	color: #ccc;
  2
+    font-family: helvetica;
  3
+    font-size: 1.5em;
  4
+    background: black;
  5
+    color: #ccc;
7 6
 }
8 7
 
9 8
 #container {
10  
-	position: absolute; 
11  
-	width: 816px; 
12  
-	height: 624px;
13  
-	margin: 5px;
14  
-	padding: 10px;
15  
-	z-index: 0;
  9
+    position: absolute;
  10
+    width: 816px;
  11
+    height: 624px;
  12
+    margin: 5px;
  13
+    padding: 10px;
  14
+    z-index: 0;
16 15
 }
17 16
 
18 17
 #arena, #playerLayer {
19  
-	position: absolute;
20  
-	width: 816px; 
21  
-	height: 624px;
22  
-	z-index: 10;
  18
+    position: absolute;
  19
+    width: 816px;
  20
+    height: 624px;
  21
+    z-index: 10;
23 22
 }
24 23
 
25 24
 #playerLayer {
26  
-  z-index: 20;
  25
+    z-index: 20;
27 26
 }
28 27
 
29 28
 #holding {
30  
-  position: absolute;
31  
-  left: 860px;
32  
-  width: 48px;
33  
-  height: 624px;
34  
-  z-index: 20;
  29
+    position: absolute;
  30
+    left: 860px;
  31
+    width: 48px;
  32
+    height: 624px;
  33
+    z-index: 20;
35 34
 }
36 35
 
37 36
 .row {
38  
-	background: beige;
  37
+    background: beige;
  38
+    position: absolute;
39 39
 }
40 40
 
  41
+
41 42
 .tile {
42  
-	background: transparent;
  43
+    background: transparent;
  44
+    width: 48px;
  45
+    height: 48px;
  46
+    position: absolute;
43 47
 }
44 48
 
  49
+.tile.solid {
  50
+    background-color: #999;
  51
+}
  52
+
  53
+.tile.destroyable {
  54
+    background-color: #ccc;
  55
+}
45 56
 .player {
46  
-  float: left;
47  
-  width: 36px;
48  
-  height: 72px;
49  
-  z-index: 40;
  57
+    position: absolute;
  58
+    width: 36px;
  59
+    height: 72px;
  60
+    z-index: 40;
50 61
 }
51 62
 
52 63
 #player_1 {
53  
-  background: url(../images/player-1.png);
  64
+    background: url(../images/player-1.png);
54 65
 }
55 66
 
56 67
 #player_2 {
57  
-  background: url(../images/player-2.png);
  68
+    background: url(../images/player-2.png);
58 69
 }
59 70
 
60 71
 #player_3 {
61  
-  background: url(../images/player-3.png);
  72
+    background: url(../images/player-3.png);
62 73
 }
63 74
 
64 75
 #player_4 {
65  
-  background: url(../images/player-4.png);
  76
+    background: url(../images/player-4.png);
66 77
 }
67 78
 
68 79
 .boundingBox {
69  
-  border: 1px solid red;
70  
-  position: absolute;
71  
-  z-index: 100;
  80
+    border: 1px solid red;
  81
+    position: absolute;
  82
+    z-index: 100;
72 83
 }
73 84
 
74 85
 .boundingBox.player {
75  
-  border: 1px solid green;
  86
+    border: 1px solid green;
76 87
 }
77 88
 
78 89
 .intersecting {
79  
-  background: rgba(0, 0, 255, 0.5);
  90
+    background: rgba(0, 0, 255, 0.5);
80 91
 }
1  public/index.html
@@ -21,6 +21,7 @@
21 21
 <script src="js/libs/jquery.hotkeys.js"></script>
22 22
 <script src="js/libs/key_status.js"></script>
23 23
 <script src="js/libs/json2.js"></script>
  24
+<script src="js/libs/jquery.spritely-0.5.js"></script>
24 25
 <script src="js/game/client.js"></script>
25 26
 <script src="js/game/kaboom.socket.js"></script>
26 27
 <script src="js/game/kaboom.game.js"></script>
1  public/js/game/client.js
@@ -14,7 +14,6 @@ function KaboomClient(config) {
14 14
 KaboomClient.prototype = {
15 15
 
16 16
     init: function() {
17  
-        var that = this;
18 17
     },
19 18
 
20 19
     /**
6  public/js/game/kaboom.game.js
@@ -231,11 +231,7 @@ function KaboomLevel(initialTileMap) {
231 231
 
232 232
             row.push(new Tile(solid, tileType, this.rows.length, row.length));
233 233
         }
234  
-        ;
235  
-
236  
-        if (row.length > 0) {
237  
-            this.rows.push(row);
238  
-        }
  234
+        if (row.length) this.rows.push(row);
239 235
     }
240 236
 
241 237
 
142  public/js/game/kaboom.renderer.js
@@ -37,104 +37,114 @@ Tile.prototype.showBoundingBox = function(layer, game) {
37 37
 };
38 38
 
39 39
 function KaboomRenderer(opts) {
  40
+    this.opts = opts;
  41
+    this.tileClasses = ["solid", "destroyable", "blank"];
  42
+    this.initialise();
40 43
     var game = opts.game;
41  
-    this.itemImages = ["images/" + game.TILE_SIZE + "/solid-block.png",
42  
-        "images/" + game.TILE_SIZE + "/destroyable-block.png",
43  
-        "images/" + game.TILE_SIZE + "/blank.png" ];
44  
-    this.initialise = function() {
45  
-        var level = game.level;
  44
+}
  45
+
  46
+KaboomRenderer.prototype = {
  47
+    makeTileHtml : function(tile) {
  48
+        var game = this.opts.game;
  49
+        var tileHtmlId = 'tile_' + tile.row + '_' + tile.col;
  50
+        var tileCssClass = 'tile ' + this.tileClasses[tile.tileType];
  51
+        return('<div id="' + tileHtmlId + '" class="' + tileCssClass + '" style="top: ' + (tile.row * game.TILE_SIZE) + 'px;left:' + tile.col * game.TILE_SIZE + 'px;" />');
  52
+    },
46 53
 
  54
+    initialise : function() {
  55
+        var level = game.level;
47 56
         // create tiles
48 57
         for (var row = 0; row < level.rows.length; row++) {
49  
-            var rowDiv = $('<div class="row" style="position:absolute;top:' + row * game.TILE_SIZE + 'px;height:' + game.TILE_SIZE + 'px;width:' + game.TILE_SIZE * level.rows[row].length + 'px" />');
50  
-
51 58
             for (var tileIndex = 0; tileIndex < level.rows[row].length; tileIndex++) {
52 59
                 var tile = level.rows[row][tileIndex];
53  
-                var tileDiv = $('<div id="tile_' + row + '_' + tileIndex + '" class="tile" style="position:absolute;height:' + game.TILE_SIZE + 'px;width:' + game.TILE_SIZE + 'px;top:0;left:' + tileIndex * game.TILE_SIZE + 'px" />');
54  
-
55  
-                if (tile != null) {
56  
-                    tileDiv.css('background', 'url(' + this.itemImages[tile.tileType] + ')');
57  
-                }
58  
-
59  
-                rowDiv.append(tileDiv);
  60
+                if (tile != null) this.opts.arena.append(this.makeTileHtml(tile));
60 61
             }
61  
-
62  
-            opts.arena.append(rowDiv);
63 62
         }
64  
-
65 63
         // create players
66 64
         for (var player = 0; player < game.players.length; player++) {
67 65
             this.createPlayer(player + 1);
68 66
         }
69  
-    };
  67
+    },
70 68
 
71  
-    this.createPlayer = function(num) {
  69
+    createPlayer : function(num) {
72 70
         var playerDiv = $('<div id="player_' + num + '" class="player" />');
  71
+        this.opts.holding.append(playerDiv);
  72
+    },
73 73
 
74  
-        opts.holding.append(playerDiv);
75  
-    };
76  
-
77  
-    this.updatePlayerLocations = function() {
  74
+    updatePlayerLocations : function() {
78 75
         for (var i = 0; i < game.players.length; i++) {
79 76
             var player = game.players[i];
80 77
 
81  
-            if (player != null) {
82  
-                if (opts.showBoundingBoxes) {
83  
-                    player.showBoundingBox(opts.playerLayer, game);
84  
-                }
  78
+            if (player == null) continue;
85 79
 
86  
-                var playerDiv = $('#player_' + (i + 1));
  80
+            if (this.opts.showBoundingBoxes) player.showBoundingBox(this.opts.playerLayer, game);
87 81
 
88  
-                if (!playerDiv.data('isInPlay')) {
89  
-                    opts.playerLayer.append(playerDiv);
90  
-                    playerDiv.data('isInPlay', true);
91  
-                }
  82
+            var playerDiv = $('#player_' + (i + 1));
  83
+
  84
+            if (!playerDiv.data('isInPlay')) {
  85
+                this.opts.playerLayer.append(playerDiv);
  86
+                playerDiv.data('isInPlay', true);
  87
+            }
92 88
 
93  
-                if (playerDiv.data('y') != player.position.y && playerDiv.data('x') != player.position.x) {
94  
-                    var y = player.position.y - 32;
95  
-                    var x = player.position.x + 8;
96  
-                    playerDiv.css({
97  
-                        position: 'absolute',
98  
-                        top: y + 'px',
99  
-                        left: x + 'px'
100  
-                    });
101  
-                    playerDiv.data('x', x);
102  
-                    playerDiv.data('y', y);
  89
+            if (playerDiv.data('y') != player.position.y && playerDiv.data('x') != player.position.x) {
  90
+                var y = player.position.y - 32;
  91
+                var x = player.position.x + 8;
  92
+                playerDiv.css({
  93
+                    position: 'absolute',
  94
+                    top: y + 'px',
  95
+                    left: x + 'px'
  96
+                });
  97
+                playerDiv.data('x', x);
  98
+                playerDiv.data('y', y);
  99
+
  100
+                if (player.velocity != null) {
  101
+                    if (player.velocity.dx != 0 || player.velocity.dy != 0) {
  102
+                        if (player.velocity.dy > 0) {
  103
+                            playerDiv.css({background: 'url(images/walk-down-sprite.png)'});
  104
+                        } else if (player.velocity.dy < 0) {
  105
+                            playerDiv.css({background: 'url(images/walk-up-sprite.png)'});
  106
+                        } else if (player.velocity.dx < 0) {
  107
+                            playerDiv.css({background: 'url(images/walk-left-sprite.png)'});
  108
+                        } else if (player.velocity.dx > 0) {
  109
+                            playerDiv.css({background: 'url(images/walk-right-sprite.png)'});
  110
+                        }
  111
+                        playerDiv.sprite({fps: 2, no_of_frames: 2});
  112
+                    } else {
  113
+                        playerDiv.destroy();
  114
+                    }
103 115
                 }
104 116
             }
105 117
         }
106  
-    };
  118
+    },
107 119
 
108  
-    this.updateItems = function() {
  120
+    updateItems : function() {
109 121
         for (var rowIndex = 0; rowIndex < game.level.rows.length; rowIndex++) {
110 122
             for (var tileIndex = 0; tileIndex < game.level.rows[rowIndex].length; tileIndex++) {
111 123
                 var tile = game.level.rows[rowIndex][tileIndex];
112  
-                var tileDiv = $('#tile_' + rowIndex + '_' + tileIndex);
113  
-
114  
-                var url = null;
115  
-
116  
-                if (tile == null) {
117  
-                    url = 'url(images/blank.png)';
118  
-                } else {
119  
-                    url = 'url(' + this.itemImages[tile.tileType] + ')';
120  
-                }
121  
-
122  
-                if (tileDiv.data('background') != url) {
123  
-                    tileDiv.css('background', url);
124  
-                    tileDiv.data('background', url);
125  
-                }
126  
-
127  
-                if (opts.showBoundingBoxes) {
128  
-                    tile.showBoundingBox(opts.playerLayer, game);
  124
+//                var tileDiv = $('#tile_' + rowIndex + '_' + tileIndex);
  125
+
  126
+//                var url = null;
  127
+//
  128
+//                if (tile == null) {
  129
+//                    url = 'url(images/blank.png)';
  130
+//                } else {
  131
+//                    url = 'url(' + this.itemImages[tile.tileType] + ')';
  132
+//                }
  133
+//
  134
+//                if (tileDiv.data('background') != url) {
  135
+//                    tileDiv.data('background', url);
  136
+//                }
  137
+
  138
+                if (this.opts.showBoundingBoxes) {
  139
+                    tile.showBoundingBox(this.opts.playerLayer, game);
129 140
                 }
130 141
             }
131 142
         }
132  
-    };
  143
+    },
133 144
 
134  
-    this.update = function() {
  145
+    update : function() {
135 146
         this.updatePlayerLocations();
136 147
         this.updateItems();
137  
-    };
138  
-
139  
-    this.initialise();
  148
+    }
140 149
 }
  150
+

0 notes on commit e2d393c

Please sign in to comment.
Something went wrong with that request. Please try again.