starting dialogue puzzle.

This commit is contained in:
Bryce Covert
2015-09-04 18:00:52 -07:00
parent 7b2ffa7ccc
commit 96c215605b
3 changed files with 70 additions and 4 deletions

View File

@@ -349,7 +349,7 @@
(defn get-text-duration [text]
(max 1.5 (* (count (s/split text #"[ \-]")) 0.5)))
(defn talk [entities target-id text & {:keys [stop? animate? anim wait] :or {wait true}}]
(defn talk [entities target-id text & {:keys [stop? animate? anim wait color] :or {wait true}}]
(let [initial-time (atom nil)
stop? (if (nil? stop?) true stop?)
animate? (if (nil? animate?) true animate?)]
@@ -371,7 +371,7 @@
(screen! dialogue/talking-screen :on-talk :text text
:scene-viewport (:viewport screen)
:x target-x :y (+ target-y height)
:color (get-in entities [:room :entities target-id :talk-color])
:color (or color (get-in entities [:room :entities target-id :talk-color]))
:target-id target-id
:scale scale)

View File

@@ -105,7 +105,73 @@
(actions/talk entities :ego "Am I right boys?" :animate? false :stop? false))
(defn listen-to-frankie [entities]
((rand-nth [listen-1 listen-2 listen-3]) entities))
(let [respond (fn [msg]
(actions/talk entities :ego msg :animate? false :stop? false :color (color 0.6 0.2 0.6 1.0))
(Thread/sleep 200))
talk (fn [msg]
(actions/talk entities :ego msg :animate? false :stop? false)
(Thread/sleep 200))]
(talk "Hello?")
(respond "Who said that?!")
(actions/present-choices entities
{:choices ["It's me, Tick!"
{:run #(do
(talk %)
(respond "I don't know where you are, Tick, but leave us alone!"))}
"It's me, Bubba!"
{:run #(do
(talk %)
(respond "Bubba!?")
(respond "What happened to your voice?"))
:choices ["(Higher pitch) I think I'm getting a cold."
{:run (fn [m]
(talk "I think I'm getting a cold.")
(respond "Wait a second...")
(respond "You're not Bubba!")
(respond "Bubba has a deep voice!"))}
"(Same pitch) I think I'm getting a cold."
{:run (fn [m]
(talk "I think I'm getting a cold.")
(respond "Wait a second...")
(respond "I recognize that voice!")
(respond "I don't know where you are, Dipstick, but quit fooling around!"))}
"(Lower pitch) I think I'm getting a cold."
{:run (fn [m]
(talk "I think I'm getting a cold.")
(respond "Sorry to hear that, Bubba.")
(respond "Whaddaya want?"))
:choices ["Where is our tree fort again?"
{:run (fn [m]
(talk m)
(respond "We don't have a tree fort, Bubba!")
(respond "You must be going crazy.")
(respond "Wait a second...")
(respond "You're not Bubba!")
(respond "I don't know who you are, mister, but quit fooling around!"))}
"Where is the secret stash again?"
{:run (fn [m]
(talk m)
(respond "We don't have a tree fort, Bubba!")
(respond "You must be going crazy.")
(respond "Wait a second...")
(respond "You're not Bubba!")
(respond "I don't know who you are, mister, but quit fooling around!"))}
"Maybe we should give Tick his stuff back."
{:run (fn [m]
(talk m)
(respond "Are you crazy!?")
(respond "We hit the jackpot, and you want to return it?!")
(respond "Wait a second...")
(respond "You're not Bubba!")
(respond "I don't know who you are, mister, but quit fooling around!"))}]}]
}
"It's me, Frankie!"
{:run #(do
(talk %)
(respond "Frankie?")
(respond "But, I'm Frankie!")
(respond "Are you my doppleganger?"))}]}))
)
(defn explode [entities]

View File

@@ -498,7 +498,7 @@
:baseline 0
:night-profile :sprite
:script (actions/get-script entities
(actions/talk entities :ego "Let's give it a listen.")
(actions/talk entities :ego "Let's see if this thing works.")
(actions/walk-to entities :ego [272 136] :face :left)
(actions/play-animation entities :ego :start-squat-2 :stop? false)
(common/listen-to-frankie entities)