Really stupid fix for Safari crashing. Thread game logic in multiple steps instead of one long one.
:dependencies [[org.clojure/clojure "1.3.0"]
[noir "1.2.1"]]
:dev-dependencies [[lein-marginalia "0.7.0-SNAPSHOT"]]
- :plugins [[lein-cljsbuild "0.1.3"]]
+ :plugins [[lein-cljsbuild "0.1.6"]]
:cljsbuild {
:builds [{:source-path "tempest"
:compiler {:output-to "resources/public/tempest.js"
(defn game-logic-playable
"Called by next-game-state when game and player are active."
[game-state]
- (->> game-state
- clear-player-segment
- dequeue-keypresses
- highlight-player-segment
- maybe-change-level
- clear-frame
- draw-board
- render-frame
- remove-collided-entities
- remove-collided-bullets
- update-projectile-locations
- update-enemy-locations
- maybe-split-tankers
- handle-dead-enemies
- maybe-enemies-shoot
- maybe-make-enemy
- check-if-player-captured
- update-player-if-shot
- check-if-enemies-remain
- update-entity-is-flipping
- update-entity-flippyness
- animate-player-capture
- update-frame-count
- maybe-render-fps-display
- schedule-next-frame
- ))
+ (let [gs1 (->> game-state
+ clear-player-segment
+ dequeue-keypresses
+ highlight-player-segment
+ maybe-change-level
+ clear-frame
+ draw-board
+ render-frame)
+ gs2 (->> gs1
+ remove-collided-entities
+ remove-collided-bullets
+ update-projectile-locations
+ update-enemy-locations
+ maybe-split-tankers
+ handle-dead-enemies
+ maybe-enemies-shoot)
+ gs3 (->> gs2
+ maybe-make-enemy
+ check-if-player-captured
+ update-player-if-shot
+ check-if-enemies-remain
+ update-entity-is-flipping
+ update-entity-flippyness
+ animate-player-capture
+ update-frame-count
+ maybe-render-fps-display)]
+ (->> gs3 schedule-next-frame)))
(defn game-logic-non-playable
{:flipper 20 :tanker 10}
{:flipper 0.01 :tanker 0.005})
(make-level-entry *level5_lines* false
- {:flipper 20}
- {:flipper 0.01})
+ {:flipper 20 :tanker 10}
+ {:flipper 0.01 :tanker 0.005})
(make-level-entry *level6_lines* true
- {:flipper 20}
- {:flipper 0.01})
+ {:flipper 20 :tanker 10}
+ {:flipper 0.01 :tanker 0.005})
(make-level-entry *level7_lines* false
- {:flipper 20}
- {:flipper 0.01})
+ {:flipper 20 :tanker 10}
+ {:flipper 0.01 :tanker 0.005})
(make-level-entry *level8_lines* false
- {:flipper 20}
- {:flipper 0.01}
+ {:flipper 20 :tanker 10}
+ {:flipper 0.01 :tanker 0.005}
:length-fn #(* 10 %)
:steps 400)
(make-level-entry *level9_lines* false
- {:flipper 20}
- {:flipper 0.01})
+ {:flipper 20 :tanker 10}
+ {:flipper 0.01 :tanker 0.005})
(make-level-entry *level10_lines* false
- {:flipper 20}
- {:flipper 0.01})
+ {:flipper 20 :tanker 10}
+ {:flipper 0.01 :tanker 0.005})
])