several nice tweaks.

This commit is contained in:
2016-01-07 21:22:43 -08:00
parent 9019166c7e
commit 7dab5867c8
4 changed files with 38 additions and 27 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View File

@@ -101,12 +101,14 @@
(utils/save @~entities "autosave" "Autosave")))))))) (utils/save @~entities "autosave" "Autosave"))))))))
(defn force-end [entities current-action key] (defn force-end [entities current-action key]
(do (put! (get-channel current-action) :end) (do (when current-action
(put! (get-channel current-action) :end))
(screen! dialogue/talking-screen :stop-talk :id key) (screen! dialogue/talking-screen :stop-talk :id key)
(-> entities (-> entities
(assoc-in [key :script-running?] false) (assoc-in [key :script-running?] false)
(assoc-in [key :current] nil) (assoc-in [key :current] nil)
(assoc-in [key :started?] false)))) (assoc-in [key :started?] false)
(assoc-in [key :channel] (chan)))))
(defmacro get-unsaved-script [entities & forms] (defmacro get-unsaved-script [entities & forms]
`(fn [starting-entities#] `(fn [starting-entities#]

View File

@@ -345,6 +345,16 @@
(update-in [:room :entities] #(dissoc % :game-player :books)) (update-in [:room :entities] #(dissoc % :game-player :books))
add-monocle-if-necessary)) add-monocle-if-necessary))
(defn offer-solution [entities riddle]
(condp = (get-in @entities [:state :current-riddle])
riddle true
:done (do (actions/do-dialogue entities :game-player "I've gotten all the help I need with riddles today.")
nil)
nil (do (actions/do-dialogue entities :game-player "Why are you offering me this?")
nil)
(do (actions/do-dialogue entities :ego "What about this?" :game-player "No, that's not the solution. Keep looking.")
nil)))
(defn make [screen] (defn make [screen]
(let [sign (utils/make-anim-seq "inside-castle/sign" [44 20] 0.3 (flatten [(repeat 20 0) 1 0 2 0 1 0 2 0 1 0 2 0 1])) (let [sign (utils/make-anim-seq "inside-castle/sign" [44 20] 0.3 (flatten [(repeat 20 0) 1 0 2 0 1 0 2 0 1 0 2 0 1]))
game-player-talk-sheet (texture! (utils/get-texture "inside-castle/game-player-talk.png") :split 40 44) game-player-talk-sheet (texture! (utils/get-texture "inside-castle/game-player-talk.png") :split 40 44)
@@ -549,7 +559,7 @@
:scripts #(condp = % :scripts #(condp = %
:wool (actions/get-script entities :wool (actions/get-script entities
(walk-to-player entities) (walk-to-player entities)
(if (= :wool (get-in @entities [:state :current-riddle])) (when (offer-solution entities :wool)
(do (actions/play-animation entities :ego :idea) (do (actions/play-animation entities :ego :idea)
(brian-pause-from-work entities) (brian-pause-from-work entities)
(actions/update-state entities (fn [s] (assoc s :current-riddle :balloon))) (actions/update-state entities (fn [s] (assoc s :current-riddle :balloon)))
@@ -559,11 +569,10 @@
:game-player "Good job, Tick! Now for your second riddle:" :game-player "Good job, Tick! Now for your second riddle:"
:game-player "\"Filled with air, light as a feather,\nWant to keep it? Best have a tether.\"" :game-player "\"Filled with air, light as a feather,\nWant to keep it? Best have a tether.\""
:ego "Okay. Be back soon.") :ego "Okay. Be back soon.")
(brian-get-to-work entities)) (brian-get-to-work entities))))
(actions/do-dialogue entities :ego "What about this?" :game-player "No, that's not the solution. Keep looking.")))
:balloon (actions/get-script entities :balloon (actions/get-script entities
(walk-to-player entities) (walk-to-player entities)
(if (= :balloon (get-in @entities [:state :current-riddle])) (when (offer-solution entities :baloon)
(do (actions/play-animation entities :ego :idea) (do (actions/play-animation entities :ego :idea)
(brian-pause-from-work entities) (brian-pause-from-work entities)
(actions/update-state entities (fn [s] (assoc s :current-riddle :frog-legs))) (actions/update-state entities (fn [s] (assoc s :current-riddle :frog-legs)))
@@ -573,30 +582,30 @@
:game-player "That's right, Tick! Now for your third riddle:" :game-player "That's right, Tick! Now for your third riddle:"
:game-player "\"Hippity-hop, I'd jump so high,\nWithout these springs, can't harm a fly.\"" :game-player "\"Hippity-hop, I'd jump so high,\nWithout these springs, can't harm a fly.\""
:ego "Okay. Be back soon.") :ego "Okay. Be back soon.")
(brian-get-to-work entities)) (brian-get-to-work entities))))
(actions/do-dialogue entities :ego "What about this?" :game-player "No, that's not the solution. Keep looking.")))
:frog-legs (actions/get-script entities :frog-legs (actions/get-script entities
(walk-to-player entities) (walk-to-player entities)
(if (= :frog-legs (get-in @entities [:state :current-riddle])) (when (offer-solution entities :frog-legs)
(do (actions/play-animation entities :ego :idea) (if (= :frog-legs (get-in @entities [:state :current-riddle]))
(brian-pause-from-work entities) (do (actions/play-animation entities :ego :idea)
(actions/update-state entities (fn [s] (assoc s :current-riddle :done))) (brian-pause-from-work entities)
(actions/update-state entities (fn [s] (assoc s :current-riddle :done)))
(actions/remove-item entities :frog-legs) (actions/remove-item entities :frog-legs)
(actions/do-dialogue entities (actions/do-dialogue entities
:ego "What about these frog legs? They jump pretty far." :ego "What about these frog legs? They jump pretty far."
:game-player "Wow! That's right!" :game-player "Wow! That's right!"
:game-player "You, Tick, have proven yourself worthy of my trophy." :game-player "You, Tick, have proven yourself worthy of my trophy."
:game-player "Even I, Brian O'Brainy, am impressed with your wisdom." :game-player "Even I, Brian O'Brainy, am impressed with your wisdom."
:game-player "Take it, and go in wisdom.") :game-player "Take it, and go in wisdom.")
(actions/give entities :trophy) (actions/give entities :trophy)
(actions/remove-entity entities :trophy) (actions/remove-entity entities :trophy)
(actions/glad entities) (actions/glad entities)
(actions/talk entities :ego "Thanks!") (actions/talk entities :ego "Thanks!")
(steam/set-achievement "WISE_UP") (steam/set-achievement "WISE_UP")
) )
(actions/do-dialogue entities :ego "What about this?" :game-player "No, that's not the solution. Keep looking.")) ))
(brian-get-to-work entities)) (brian-get-to-work entities))
:trophy (actions/get-script entities :trophy (actions/get-script entities
(walk-to-player entities) (walk-to-player entities)