cleaning up dialogue a bit.

This commit is contained in:
2014-10-03 21:11:14 -07:00
parent 098891dd42
commit 1b487edc2b
2 changed files with 17 additions and 15 deletions

View File

@@ -320,7 +320,8 @@
(defn do-dialogue [entities & pairs] (defn do-dialogue [entities & pairs]
(loop [pairs (partition 2 pairs)] (loop [pairs (partition 2 pairs)]
(let [[[target line]] pairs (let [[[target line]] pairs
result (actions/talk entities target line)] next-speaker-is-different (not= target (ffirst (next pairs)))
result (talk entities target line :stop? next-speaker-is-different)]
(if (seq (rest pairs)) (if (seq (rest pairs))
(recur (rest pairs)) (recur (rest pairs))
result)))) result))))

View File

@@ -34,20 +34,21 @@
:script (actions/get-script :script (actions/get-script
entities entities
(actions/walk-to entities :ego [191 90]) (actions/walk-to entities :ego [191 90])
(actions/talk entities :ego "Hello there, peddler.") (actions/do-dialogue entities
(actions/talk entities :peddler "Good day sir! Care to see any of my wares?" :stop? false) :ego "Hello there, peddler."
(actions/talk entities :peddler "I have only the choicest of wares.") :peddler "Good day sir! Care to see any of my wares?"
(actions/talk entities :ego "What 'wares' are you selling?") :peddler "I have only the choicest of wares."
(actions/talk entities :peddler "I have the choicest of all types of wares..." :stop? false) :ego "What 'wares' are you selling?"
(actions/talk entities :peddler "...I'm well stocked on used earplugs..." :stop? false) :peddler "I have the choicest of all types of wares..."
(actions/talk entities :peddler "...glass eyes, motivational tapes... " :stop? false) :peddler "...I'm well stocked on used earplugs..."
(actions/talk entities :peddler "...and useful books like this:" :stop? false) :peddler "...glass eyes, motivational tapes... "
(actions/talk entities :peddler "'Checkers Mastery in Less Than 10 Seconds'") :peddler "...and useful books like this:"
(actions/talk entities :ego "I sure am interested on that book on checkers.") :peddler "'Checkers Mastery in Less Than 10 Seconds'"
(actions/talk entities :peddler "An excellent selection! It is the choicest of checkers book you'll ever find." :stop? false) :ego "I sure am interested on that book on checkers."
(actions/talk entities :peddler "This book will only set you back 75 sheckels.") :peddler "An excellent selection! It is the choicest of checkers book you'll ever find."
(actions/talk entities :ego "But I haven't got any money!") :peddler "This book will only set you back 75 sheckels."
(actions/talk entities :peddler "Then you won't have the choicest of checkers books."))}} :ego "But I haven't got any money!"
:peddler "Then you won't have the choicest of checkers books."))}}
:layers [(assoc (texture "outside-castle/background.png") :x 0 :y 0 :baseline 0)] :layers [(assoc (texture "outside-castle/background.png") :x 0 :y 0 :baseline 0)]
:entities {:peddler (actions/start-animation screen :entities {:peddler (actions/start-animation screen
(assoc (texture "outside-castle/peddler.png") :x 110 :y 90 :baseline 150 :anim nil (assoc (texture "outside-castle/peddler.png") :x 110 :y 90 :baseline 150 :anim nil