diff --git a/src/game.clj b/src/game.clj index bdcb47b..1bac1c3 100644 --- a/src/game.clj +++ b/src/game.clj @@ -10,8 +10,8 @@ ;; (def ^:const screen-width 970) ;; (def ^:const screen-height 530) (def ^:const cell-size 16) -(def ^:const rows (quot screen-width cell-size)) -(def ^:const cols (quot screen-height cell-size)) +(def ^:const rows (quot screen-height cell-size)) +(def ^:const cols (quot screen-width cell-size)) (def ^:const grid-len (* rows cols)) (def scale 4.0) @@ -135,7 +135,7 @@ 0 directions))) -(defn do-neighbors! [grid row col do-fn] +(defn do-neighbors! [row col do-fn] (doseq [[_ [dy dx]] directions :let [r (+ row dy) c (+ col dx)]] @@ -159,7 +159,7 @@ (defn auto-tile! [game at-row at-col] (set-random-tile! game at-row at-col) - (do-neighbors! (:grid game) at-row at-col + (do-neighbors! at-row at-col (fn [r c] (when (tile-at game r c) (set-random-tile! game r c))))) @@ -175,7 +175,7 @@ (set-tile! game at-row at-col nil))) (when (rl/mouse-button-pressed? rl/mouse-button-middle) (doseq [r (range 10) c (range 20)] - (auto-tile! @@#'engine/game-state r c))) + (auto-tile! game r c))) (cond-> game (rl/key-pressed? rl/key-space) (update :editor-mode not)