first puzzle complete
This commit is contained in:
@@ -82,7 +82,7 @@
|
||||
:on-touch-down (fn [screen [entities]]
|
||||
(let [{:keys [x y]} (input->screen screen {:x (:input-x screen) :y (:input-y screen)})]
|
||||
(when (seq entities)
|
||||
(when (< y (* 30 (count entities)))
|
||||
(when (< y (* 30 (dec (count entities))))
|
||||
((get-in entities [:state :callback]) (int (/ y 30)))
|
||||
{}))))
|
||||
|
||||
|
||||
@@ -53,16 +53,22 @@
|
||||
|
||||
(let [interaction (first (filter #(mouse-in? % [x y])
|
||||
(get-in entities [:background :interactions])))
|
||||
|
||||
current-action (get-in entities [:actions :current])
|
||||
;; TODO - hacky way of resetting queue
|
||||
entities (if-let [current-action (get-in entities [:actions :current])]
|
||||
(assoc (actions/terminate current-action screen entities)
|
||||
:actions {:channel (chan) :current nil :started? false})
|
||||
entities)
|
||||
script (or (when interaction
|
||||
(get-script interaction [x y]))
|
||||
(get-script default-interaction [x y]))]
|
||||
entities (if (and current-action (actions/can-skip? current-action screen entities))
|
||||
(let [terminated-entities (actions/terminate current-action screen entities)]
|
||||
(do (put! (actions/get-channel current-action) terminated-entities)
|
||||
(-> terminated-entities
|
||||
(assoc-in [:actions :current] nil)
|
||||
(assoc-in [:actions :started?] false))))
|
||||
(assoc-in entities [:actions :channel] (chan)))]
|
||||
|
||||
(script entities)
|
||||
(if current-action
|
||||
entities
|
||||
((or (when interaction
|
||||
(get-script interaction [x y]))
|
||||
(get-script default-interaction [x y])) entities))
|
||||
entities))))
|
||||
|
||||
(defn flip [anim]
|
||||
@@ -159,95 +165,97 @@
|
||||
(apply do-dialogue entities :ego line more))
|
||||
|
||||
(defn wizard-dialogue [entities]
|
||||
{:choices ["What do you mean, \"Not you again?\""
|
||||
{:run #(respond entities % :wizard "I mean, you've wrecked my life and I never want to see you again.")
|
||||
:choices ["You mean the time I set your house on fire with a fire mint?"
|
||||
{:run #(do
|
||||
(respond entities %
|
||||
:wizard "That was you!?"
|
||||
:wizard "My house was nearly destroyed!"
|
||||
:wizard "I spent weeks rebuilding my home!"
|
||||
:wizard "Leave, now, or I'll turn you into a ..."
|
||||
:wizard "... a ..."
|
||||
:wizard "... a frog!"
|
||||
:ego "Okay, okay! I'm leaving.")
|
||||
(actions/transition-background entities :outside-house [262 88])
|
||||
(actions/talk entities :ego "I guess he's really upset with me."))}
|
||||
"You're still cross about my stealing your magic cowboy hat?"
|
||||
{:run #(do (respond entities %
|
||||
:wizard "Of course I'm cross! It's irreplaceable!"
|
||||
:wizard "That cowboy hat accented my facial physique."
|
||||
:wizard "And complemented my skin color."
|
||||
:wizard "And you little cheat stole it from me!"
|
||||
:wizard "That's why I bought my MagiSafe 5000, to keep out intruders like you."
|
||||
:wizard "Now leave.")
|
||||
(actions/transition-background entities :outside-house [262 88]))}
|
||||
"Even an old hoot like you needs a kick in the pants every now and again."
|
||||
{:run #(respond entities % :wizard "What gives you the right to try to teach me a lesson?")
|
||||
:choices ["My good looks?"
|
||||
{:run #(do (respond entities %
|
||||
:wizard "You know, handsome looks aren't all they're chocked up to be."
|
||||
:wizard "Take me for example."
|
||||
:wizard "When you have a bod like man, you can hardly go to the grocery store without being noticed."
|
||||
:wizard "But no. Your looks, however good they may be, don't give you the right to teach me a lesson."
|
||||
:wizard "Now please leave me in peace.")
|
||||
(actions/transition-background entities :outside-house [262 88]))}
|
||||
"My good standing within the community?"
|
||||
{:run #(do (respond entities %
|
||||
:wizard "Ha! Good standing?"
|
||||
:wizard "You're the neighborhood cheat and everyone knows it."
|
||||
:wizard "Now please leave me in peace.")
|
||||
(actions/transition-background entities :outside-house [262 88]))}
|
||||
"I'm going to be a knight! That counts for something doesn't it?"
|
||||
{:run #(do (respond entities %
|
||||
:wizard "You are, are you?"
|
||||
:wizard "Pray tell, how do you, a mere wreckless youth, plan on becoming a knight?"))
|
||||
:choices ["By pulling the Sword of Blergh from its stone!"
|
||||
{:run #(respond entities %
|
||||
:wizard "Well, well. It sounds I was wrong about you."
|
||||
:wizard "Indeed, you are on the path of setting your destructive past behind you."
|
||||
:wizard "But know this, the stone cannot be cheated easily."
|
||||
:wizard "You must fulfill the age-old prophecy."
|
||||
:wizard "'The Sword of Blergh with magic sting,' ..."
|
||||
:wizard "... 'Shall yield to no earthly king.'"
|
||||
:wizard "'To draw from hardened, weathered stone,' ..."
|
||||
:wizard "... 'One must have valor, right to the bone.'"
|
||||
:wizard "'Worthy in courage, wisdom and might,' ..."
|
||||
:wizard "... 'only then with sword he'll fight.'"
|
||||
:wizard "'But a hero should he prove not be,' ..."
|
||||
:wizard "... 'Only ruin will fall on thee.'"
|
||||
:wizard "'I'll fall neither for guile nor guise'..."
|
||||
)
|
||||
:choices ["Is this almost over?"
|
||||
{:run #(do (respond entities %
|
||||
:wizard "Patience, boy."
|
||||
:wizard "... 'Such a man will have great surprise.'"
|
||||
:wizard "If this is truely your quest, boy, then I will help you in your quest. "
|
||||
:wizard "But heed the warning from the prophecy: No cheat can pull the Sword of Blergh."
|
||||
:ego "No cheating."
|
||||
:ego "Check.")
|
||||
(swap! entities (fn [e] (assoc-in e [:state :convinced-wizard?] true))))}
|
||||
"*cough* *cough* *ahem*"
|
||||
{:run #(do (respond entities %
|
||||
:wizard "Excuse you."
|
||||
:wizard "... 'Such a man will have great surprise.'"
|
||||
:wizard "If this is truely your quest, boy, then I will help you in your quest. "
|
||||
:wizard "But heed the warning from the prophecy: No cheat can pull the Sword of Blergh."
|
||||
:ego "No cheating."
|
||||
:ego "Check.")
|
||||
(swap! entities (fn [e] (assoc-in e [:state :convinced-wizard?] true))))}]}
|
||||
"By besting swamp, foe, and the occasional bizarre conversation tree."
|
||||
{:run #(do (respond entities %
|
||||
:wizard "While your goal sounds noble, no amount of bizarre conversation tree searching will earn my respect."
|
||||
:wizard "Now please leave.")
|
||||
(actions/transition-background entities :outside-house [262 88]))}]}]}]}
|
||||
"You're not happy to see me, Mr. Fangald?"
|
||||
{:run #(respond entities % :wizard "Of course not, you little brat. You've made my life a living hell!")
|
||||
:choices #(-> % zip/left)}
|
||||
"Good bye, Mr. Fangald!"
|
||||
{:run #(do
|
||||
(respond entities % :wizard "Now scram!")
|
||||
(actions/transition-background entities :outside-house [262 88]))}]})
|
||||
(do-dialogue entities :ego "Hello there Mr. Fangald!" :wizard "Oh no, not you again!")
|
||||
(actions/present-choices entities
|
||||
{:choices ["What do you mean, \"Not you again?\""
|
||||
{:run #(respond entities % :wizard "I mean, you've wrecked my life and I never want to see you again.")
|
||||
:choices ["You mean the time I set your house on fire with a fire mint?"
|
||||
{:run #(do
|
||||
(respond entities %
|
||||
:wizard "That was you!?"
|
||||
:wizard "My house was nearly destroyed!"
|
||||
:wizard "I spent weeks rebuilding my home!"
|
||||
:wizard "Leave, now, or I'll turn you into a ..."
|
||||
:wizard "... a ..."
|
||||
:wizard "... a frog!"
|
||||
:ego "Okay, okay! I'm leaving.")
|
||||
(actions/transition-background entities :outside-house [262 88])
|
||||
(actions/talk entities :ego "I guess he's really upset with me."))}
|
||||
"You're still cross about my stealing your magic cowboy hat?"
|
||||
{:run #(do (respond entities %
|
||||
:wizard "Of course I'm cross! It's irreplaceable!"
|
||||
:wizard "That cowboy hat accented my facial physique."
|
||||
:wizard "And complemented my skin color."
|
||||
:wizard "And you little cheat stole it from me!"
|
||||
:wizard "That's why I bought my MagiSafe 5000, to keep out intruders like you."
|
||||
:wizard "Now leave.")
|
||||
(actions/transition-background entities :outside-house [262 88]))}
|
||||
"Even an old hoot like you needs a kick in the pants every now and again."
|
||||
{:run #(respond entities % :wizard "What gives you the right to try to teach me a lesson?")
|
||||
:choices ["My good looks?"
|
||||
{:run #(do (respond entities %
|
||||
:wizard "You know, handsome looks aren't all they're chocked up to be."
|
||||
:wizard "Take me for example."
|
||||
:wizard "When you have a bod like man, you can hardly go to the grocery store without being noticed."
|
||||
:wizard "But no. Your looks, however good they may be, don't give you the right to teach me a lesson."
|
||||
:wizard "Now please leave me in peace.")
|
||||
(actions/transition-background entities :outside-house [262 88]))}
|
||||
"My good standing within the community?"
|
||||
{:run #(do (respond entities %
|
||||
:wizard "Ha! Good standing?"
|
||||
:wizard "You're the neighborhood cheat and everyone knows it."
|
||||
:wizard "Now please leave me in peace.")
|
||||
(actions/transition-background entities :outside-house [262 88]))}
|
||||
"I'm going to be a knight! That counts for something doesn't it?"
|
||||
{:run #(do (respond entities %
|
||||
:wizard "You are, are you?"
|
||||
:wizard "Pray tell, how do you, a mere wreckless youth, plan on becoming a knight?"))
|
||||
:choices ["By pulling the Sword of Blergh from its stone!"
|
||||
{:run #(respond entities %
|
||||
:wizard "Well, well. It sounds I was wrong about you."
|
||||
:wizard "Indeed, you are on the path of setting your destructive past behind you."
|
||||
:wizard "But know this, the stone cannot be cheated easily."
|
||||
:wizard "You must fulfill the age-old prophecy."
|
||||
:wizard "'The Sword of Blergh with magic sting,' ..."
|
||||
:wizard "... 'Shall yield to no earthly king.'"
|
||||
:wizard "'To draw from hardened, weathered stone,' ..."
|
||||
:wizard "... 'One must have valor, right to the bone.'"
|
||||
:wizard "'Worthy in courage, wisdom and might,' ..."
|
||||
:wizard "... 'only then with sword he'll fight.'"
|
||||
:wizard "'But a hero should he prove not be,' ..."
|
||||
:wizard "... 'Only ruin will fall on he.'"
|
||||
:wizard "'Should he use guile or guise'..."
|
||||
)
|
||||
:choices ["Is this almost over?"
|
||||
{:run #(do (actions/update-state (fn [state] (assoc state :convinced-wizard? true)))
|
||||
(respond entities %
|
||||
:wizard "Patience, boy."
|
||||
:wizard "... 'Such a man will have great surprise.'"
|
||||
:wizard "If this is truely your quest, boy, then I will help you in your quest. "
|
||||
:wizard "But heed the warning from the prophecy: No cheat can pull the Sword of Blergh."
|
||||
:ego "No cheating."
|
||||
:ego "Check."))}
|
||||
"*cough* *cough* *ahem*"
|
||||
{:run #(do (actions/update-state entities (fn [state] (assoc state :convinced-wizard? true)))
|
||||
(respond entities %
|
||||
:wizard "Excuse you. Moving on..."
|
||||
:wizard "... 'Such a man will have great surprise.'"
|
||||
:wizard "If this is truely your quest, boy, then I will help you in your quest. "
|
||||
:wizard "But heed the warning from the prophecy: No cheat can pull the Sword of Blergh."
|
||||
:ego "No cheating."
|
||||
:ego "Check."))}]}
|
||||
"By besting swamp, foe, and the occasional bizarre conversation tree."
|
||||
{:run #(do (respond entities %
|
||||
:wizard "While your goal sounds noble, no amount of bizarre conversation tree searching will earn my respect."
|
||||
:wizard "Now please leave.")
|
||||
(actions/transition-background entities :outside-house [262 88]))}]}]}]}
|
||||
"You're not happy to see me, Mr. Fangald?"
|
||||
{:run #(respond entities % :wizard "Of course not, you little brat. You've made my life a living hell!")
|
||||
:choices #(-> % zip/left)}
|
||||
"Good bye, Mr. Fangald!"
|
||||
{:run #(do
|
||||
(respond entities % :wizard "Now scram!")
|
||||
(actions/transition-background entities :outside-house [262 88]))}]}))
|
||||
|
||||
(defn backgrounds [screen]
|
||||
(let [sheep-sheet (texture! (texture "outsidehouse/sheep-anim.png") :split 33 21)
|
||||
@@ -270,10 +278,7 @@
|
||||
(actions/walk-to entities :ego [237 1])
|
||||
(actions/transition-background entities :outside-house [262 88]))
|
||||
:cursor :down}
|
||||
:wizard {:box [228 80 248 126]
|
||||
:script (actions/get-script entities
|
||||
(do-dialogue entities :ego "Hello there Mr. Fangald!" :wizard "Oh no, not you again!")
|
||||
(actions/present-choices entities (wizard-dialogue entities)))}}
|
||||
:wizard {:box [228 80 248 126]}}
|
||||
: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)]
|
||||
@@ -293,7 +298,10 @@
|
||||
entities
|
||||
(actions/walk-to entities :ego [262 88])
|
||||
(actions/talk entities :ego (str "Anyone home?"))
|
||||
(actions/transition-background entities :inside-house [237 0]))}
|
||||
(actions/transition-background entities :inside-house [237 0])
|
||||
(if (get-in @entities [:state :convinced-wizard?])
|
||||
(actions/talk entities :wizard (str "Oh, hello there boy."))
|
||||
(wizard-dialogue entities)))}
|
||||
:sword {:box [274 55 305 88]
|
||||
:script (actions/get-script
|
||||
entities
|
||||
|
||||
Reference in New Issue
Block a user