Skip to content

Instantly share code, notes, and snippets.

@jcromartie jcromartie/atom.cljs forked from newsomc/atom.cljs
Last active Dec 14, 2015

Embed
What would you like to do?
(defn make-ghost
[color]
{:get-tick 0, :eatable nil, :color nil, :eaten nil, :specs color, :position nil, :due nil, :map nil, :direction nil})
(def ghost-specs ["#00FFDE" "#FF0000" "#FFB8DE" "#FFB847"])
(def game-state (atom {:state nil
:audio []
:ghosts (mapv make-ghost ghost-specs)
:eaten-count 0
:level 0
:tick 0
:n-score 0
:block-size nil}))
(def ghost-init-state
{:eaten true, :eatable true, :position {:x 90, :y 80}})
(defn reset-ghost
[ghost]
(merge-with merge ghost ghost-init-state))
(defn reset-ghost-state! [ghost]
(swap! game-state (fn [state] (update-in [:ghosts] #(map reset-ghost %)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.