summary history branches tags files
date:Fri Apr 13 19:04:06 2012 -0400
A few logic changes that might have been able to cause bugs, and one that might run a tiny bit faster.
diff --git a/tempest/tempest/core.cljs b/tempest/tempest/core.cljs
line changes: +5/-2
index 1764aa7..70899c4
--- a/tempest/tempest/core.cljs
+++ b/tempest/tempest/core.cljs
@@ -140,9 +140,9 @@ is because the game's main loop logic changes based on a few possible states:
         gs3 (->> gs2
+                 check-if-enemies-remain
-                 check-if-enemies-remain
@@ -274,7 +274,7 @@ is because the game's main loop logic changes based on a few possible states:
 (defn build-enemy
   "Returns a dictionary describing an enemy on the given level and segment,
    and starting on the given step.  Step defaults to 0 (innermost step of
-   level) if not specified. TODO: Only makes flippers."
+   level) if not specified."
   [level seg-idx & {:keys [step] :or {step 0}}]
   {:step step
    :stride 1
@@ -809,6 +809,7 @@ flipper appears to flip 'inside' the level:
   (let [{:keys [spikes player]} game-state step (:step player)
+        ;; TODO: (nth) caused an error here once, spikes was length 0.
         segment (:segment player) spike-len (nth spikes segment)]
      (zero? spike-len) game-state
@@ -884,6 +885,7 @@ flipper appears to flip 'inside' the level:
           (assoc game-state :zoom target)
           (assoc game-state :zoom newzoom)))))
 (defn clear-player-segment
   "Returns game-state unchanged, and as a side affect clears the player's
    current segment back to blue.  To avoid weird color mixing, it is cleared
@@ -1283,6 +1285,7 @@ The setTimeout fail-over is hard-coded to attempt 30fps.
       (assoc (clear-level-entities game-state)
         :player (assoc player :is-dead? true)
         :is-zooming? true
+        :player-zooming? false
         :zoom-in? false)

diff --git a/tempest/tempest/draw.cljs b/tempest/tempest/draw.cljs
line changes: +6/-5
index d206c16..563682f
--- a/tempest/tempest/draw.cljs
+++ b/tempest/tempest/draw.cljs
@@ -21,11 +21,12 @@ level functions to draw complete game entities using the primitives.
 (defn draw-rectangle
   "Draws a rectangle (4 cartesian coordinates in a vector) on the 2D context
    of an HTML5 canvas."
-  [context [p0 & points]]
-  (.moveTo context (first p0) (peek p0))
-  (doseq [p points]
-    (.lineTo context (first p) (peek p)))
-  (.lineTo context (first p0) (peek p0))
+  [context [[x0 y0] [x1 y1] [x2 y2] [x3 y3]]]
+  (.moveTo context x0 y0)
+  (.lineTo context x1 y1)
+  (.lineTo context x2 y2)
+  (.lineTo context x3 y3)
+  (.lineTo context x0 y0)
   (.stroke context)