can only open the safe when gandarf isn't around.

This commit is contained in:
2014-11-09 10:29:27 -08:00
parent 8a8a9fe270
commit 86d1f7273d

View File

@@ -9,6 +9,19 @@
[play-clj.utils :refer :all]
[play-clj.g2d :refer :all]))
(defn do-wizard-dialogue [entities]
(actions/do-dialogue entities :wizard "What can I do for you boy?")
(actions/present-choices entities
{:choices [(when (= 3 (get-in @entities [:state :mints-eaten]))
"The antique shopkeeper needs more fire mints.")
{:run #(do (actions/respond entities %
:wizard "Already?"
:wizard "Ok, I'll deliver them myself. Don't touch anything while I'm gone.")
(actions/update-state entities (fn [s] (assoc s :mints-eaten 0)))
(actions/remove-entity entities :wizard))}
"Goodbye, Gandarf."
{:run #(actions/respond entities % :wizard "Goodbye, boy.")}]}))
(defn make [screen]
(let [wizard-sheet (texture! (texture "wizard/talk.png") :split 20 46)
wizard-stand (animation 0.2 (for [i (flatten [(repeat 10 0) 1])]
@@ -24,19 +37,23 @@
:safe {:box [34 70 70 115]
:script (actions/get-script entities
(actions/walk-to entities :ego [59 65])
(actions/play-animation entities :ego :squat)
(actions/give entities items/frog-legs)
(actions/talk entities :ego "I found some frog legs inside."))}
(if (get-in @entities [:room :entities :wizard])
(actions/talk entities :wizard "Don't touch my MagiSafe!!")
(do
(actions/play-animation entities :ego :squat)
(actions/give entities items/frog-legs)
(actions/talk entities :ego "I found some frog legs inside."))))}
}
:layers [(assoc (texture "inside-house/background.png") :x 0 :y 0 :baseline 0)
(assoc (texture "inside-house/desk.png") :x 0 :y 0 :baseline 200)
(assoc (texture "inside-house/sillhoute.png") :x 0 :y 0 :baseline 240)]
:entities {:wizard (actions/start-animation screen (assoc (animation->texture (doto screen) wizard-stand) :x 228 :y 80 :baseline 160 :scale-x 1.75 :scale-y 1.75
:entities {:wizard (actions/start-animation screen (assoc (animation->texture screen wizard-stand) :x 228 :y 80 :baseline 160 :scale-x 1.75 :scale-y 1.75
:left {:talk (utils/flip wizard-talk)
:stand (utils/flip wizard-stand)}
:right {:talk wizard-talk
:stand wizard-stand}
:facing :left)
:facing :left
:script (actions/get-script entities (do-wizard-dialogue entities)))
:stand)
:flask (assoc (texture "inside-house/flask.png")
:x 265 :y 80 :baseline 240