Clean up
This commit is contained in:
parent
f658f2974c
commit
4a68f5ff82
10
src/game.clj
10
src/game.clj
@ -10,8 +10,8 @@
|
|||||||
;; (def ^:const screen-width 970)
|
;; (def ^:const screen-width 970)
|
||||||
;; (def ^:const screen-height 530)
|
;; (def ^:const screen-height 530)
|
||||||
(def ^:const cell-size 16)
|
(def ^:const cell-size 16)
|
||||||
(def ^:const rows (quot screen-width cell-size))
|
(def ^:const rows (quot screen-height cell-size))
|
||||||
(def ^:const cols (quot screen-height cell-size))
|
(def ^:const cols (quot screen-width cell-size))
|
||||||
(def ^:const grid-len (* rows cols))
|
(def ^:const grid-len (* rows cols))
|
||||||
|
|
||||||
(def scale 4.0)
|
(def scale 4.0)
|
||||||
@ -135,7 +135,7 @@
|
|||||||
0
|
0
|
||||||
directions)))
|
directions)))
|
||||||
|
|
||||||
(defn do-neighbors! [grid row col do-fn]
|
(defn do-neighbors! [row col do-fn]
|
||||||
(doseq [[_ [dy dx]] directions
|
(doseq [[_ [dy dx]] directions
|
||||||
:let [r (+ row dy)
|
:let [r (+ row dy)
|
||||||
c (+ col dx)]]
|
c (+ col dx)]]
|
||||||
@ -159,7 +159,7 @@
|
|||||||
|
|
||||||
(defn auto-tile! [game at-row at-col]
|
(defn auto-tile! [game at-row at-col]
|
||||||
(set-random-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]
|
(fn [r c]
|
||||||
(when (tile-at game r c)
|
(when (tile-at game r c)
|
||||||
(set-random-tile! game r c)))))
|
(set-random-tile! game r c)))))
|
||||||
@ -175,7 +175,7 @@
|
|||||||
(set-tile! game at-row at-col nil)))
|
(set-tile! game at-row at-col nil)))
|
||||||
(when (rl/mouse-button-pressed? rl/mouse-button-middle)
|
(when (rl/mouse-button-pressed? rl/mouse-button-middle)
|
||||||
(doseq [r (range 10) c (range 20)]
|
(doseq [r (range 10) c (range 20)]
|
||||||
(auto-tile! @@#'engine/game-state r c)))
|
(auto-tile! game r c)))
|
||||||
(cond-> game
|
(cond-> game
|
||||||
(rl/key-pressed? rl/key-space)
|
(rl/key-pressed? rl/key-space)
|
||||||
(update :editor-mode not)
|
(update :editor-mode not)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user