summary history branches tags files
commit:3fd1576447cda6337dea82aae624429d7ac40b7b
author:mrmekon
committer:mrmekon
date:Mon Apr 2 23:13:27 2012 -0400
parents:e8c2ed52cc6ae1b95f310892349868bcc606bf14
Every level initializes with one enemy per segment.  Flip speed increased.
diff --git a/tempest/tempest.cljs b/tempest/tempest.cljs
line changes: +9/-51
index 4d9356d..a3e8d8a
--- a/tempest/tempest.cljs
+++ b/tempest/tempest.cljs
@@ -63,6 +63,12 @@ Publicly exported functions to embed Tempest game in HTML.
 ;;   * Frame timing, and disassociate movement speed from framerate.
 ;;
 
+(defn enemy-on-each-segment
+  "List of enemies, one per segment."
+  [level]
+  (map #(c/build-flipper level % :step 0)
+       (range (count (:segments level)))))
+
 (defn ^:export canvasDraw
   "Begins a game of tempest.  'level' specified as a string representation
    of an integer."
@@ -78,6 +84,8 @@ Publicly exported functions to embed Tempest game in HTML.
 
     (draw/draw-board bgcontext dims level)
     (events/listen handler "key" (fn [e] (c/queue-keypress e)))
+
+    (.log js/console (pr-str (enemy-on-each-segment level)))
     
     (let [empty-game-state (c/build-game-state)
           game-state (assoc empty-game-state
@@ -86,57 +94,7 @@ Publicly exported functions to embed Tempest game in HTML.
                        :context context
                        :dims dims
                        :anim-fn (c/animationFrameMethod)
-                       :enemy-list (list
-                                    (c/build-flipper level 0 :step 0)
-                                    (c/build-flipper level 1 :step 0)
-                                    (c/build-flipper level 2 :step 0)
-                                    (c/build-flipper level 3 :step 0)
-                                    (c/build-flipper level 4 :step 0)
-                                    (c/build-flipper level 5 :step 0)
-                                    (c/build-flipper level 6 :step 0)
-                                    (c/build-flipper level 7 :step 0)
-                                    (c/build-flipper level 8 :step 0)
-                                    (c/build-flipper level 9 :step 0)
-                                    (c/build-flipper level 10 :step 0)
-                                    (c/build-flipper level 11 :step 0)
-                                    (c/build-flipper level 12 :step 0)
-                                    (c/build-flipper level 13 :step 0)
-                                    (c/build-flipper level 14 :step 0)
-                                    (c/build-flipper level 15 :step 0)
-                                    (c/build-flipper level 16 :step 0)
-                                    (c/build-flipper level 17 :step 0)
-                                    (c/build-flipper level 18 :step 0)
-                                    (c/build-flipper level 19 :step 0)
-                                    (c/build-flipper level 20 :step 0)
-                                    (c/build-flipper level 21 :step 0)
-                                    (c/build-flipper level 22 :step 0)
-                                    (c/build-flipper level 23 :step 0)
-                                    (c/build-flipper level 24 :step 0)
-                                    (c/build-flipper level 25 :step 0)
-                                    (c/build-flipper level 26 :step 0)
-                                    (c/build-flipper level 27 :step 0)
-                                    (c/build-flipper level 28 :step 0)
-                                    (c/build-flipper level 29 :step 0)
-                                    (c/build-flipper level 30 :step 0)
-                                    (c/build-flipper level 31 :step 0)
-                                    (c/build-flipper level 32 :step 0)
-                                    (c/build-flipper level 33 :step 0)
-                                    (c/build-flipper level 34 :step 0)
-                                    (c/build-flipper level 35 :step 0)
-                                    (c/build-flipper level 36 :step 0)
-                                    (c/build-flipper level 37 :step 0)
-                                    (c/build-flipper level 38 :step 0)
-                                    (c/build-flipper level 39 :step 0)
-                                    (c/build-flipper level 40 :step 0)
-                                    (c/build-flipper level 41 :step 0)
-                                    (c/build-flipper level 42 :step 0)
-                                    (c/build-flipper level 43 :step 0)
-                                    (c/build-flipper level 44 :step 0)
-                                    (c/build-flipper level 45 :step 0)
-                                    (c/build-flipper level 46 :step 0)
-                                    ))]
+                       :enemy-list (enemy-on-each-segment level))]
       (c/next-game-state game-state))))
 
 
-(comment
-)

diff --git a/tempest/tempest/core.cljs b/tempest/tempest/core.cljs
line changes: +1/-1
index c255811..5918bc8
--- a/tempest/tempest/core.cljs
+++ b/tempest/tempest/core.cljs
@@ -101,7 +101,7 @@ after passing through all the other functions.  This implements the game loop.
     :flip-dir (DirectionEnum "NONE")
     :flip-point [0 0]
     :flip-stride 1
-    :flip-step-count 100
+    :flip-step-count 20
     :flip-max-angle 0
     :flip-cur-angle 0
     :flip-permanent-dir nil