nice little queue for the amount of mints.

This commit is contained in:
Bryce Covert
2016-04-19 17:48:46 -07:00
parent f440eeb3ff
commit 33b4e8bb88
4 changed files with 94 additions and 47 deletions

View File

@@ -366,6 +366,10 @@
:baseline 240)
(particle-effect! :set-position 162 104))
:bowl (assoc (utils/get-texture "inside-antique/bowl.png")
:images [(utils/get-texture "inside-antique/bowl-0.png")
(utils/get-texture "inside-antique/bowl-1.png")
(utils/get-texture "inside-antique/bowl-2.png")
(utils/get-texture "inside-antique/bowl-3.png")]
:x 165
:y 110
:baseline 125
@@ -385,6 +389,15 @@
(actions/talk entities :ego "I'll just try another one of these mints."))
(actions/play-animation entities :ego :reach)
(actions/update-state entities (fn [s] (assoc s :mints-eaten (inc (s :mints-eaten)))))
(actions/update-entities entities
(fn [entities]
(update-in entities
[:room :entities :bowl]
(fn [b]
(merge b
(get-in b [:images (- 3
(get-in entities [:state :mints-eaten] 0))])
)))))
(actions/play-sound entities (keyword (str "fire-" (get-in @entities [:state :mints-eaten]))) 0.8)
(cond
@@ -412,16 +425,22 @@
:teddy (rooms/make-entity :teddy teddy)
:collision "inside-antique/collision.png"
:apply-state (fn [_ entities]
(as-> entities entities
(if (or (actions/has-item? entities :teddy)
(actions/has-obtained? entities :balloon))
(update-in entities [:room :entities] #(dissoc % :teddy))
entities)
(if (actions/has-item? entities :portrait )
entities
(assoc-in entities [:room :entities :portrait] (get-in entities [:room :portrait])))
(choose-correct-blind-state entities)
))
(let [mints-eaten (get-in entities [:state :mints-eaten] 0)]
(as-> entities entities
(if (or (actions/has-item? entities :teddy)
(actions/has-obtained? entities :balloon))
(update-in entities [:room :entities] #(dissoc % :teddy))
entities)
(update-in entities
[:room :entities :bowl]
(fn [b]
(merge b (get-in b [:images (- 3 mints-eaten)]))))
(if (actions/has-item? entities :portrait )
entities
(assoc-in entities [:room :entities :portrait] (get-in entities [:room :portrait])))
(choose-correct-blind-state entities)
)))
:scale-fn (utils/scaler-fn-with-baseline 110 0.10 1.75)
:start-pos [222 3])))