refinement.

This commit is contained in:
2014-12-10 13:07:08 -08:00
parent bb7dcb3628
commit 3639e4fd06
4 changed files with 72 additions and 50 deletions

View File

@@ -24,7 +24,31 @@
(doseq [scenario (take 2 (shuffle scenarios))]
(scenario))))
(defn nice-trophy-dialogue [entities]
{:run #(actions/respond entities %
:game-player "Thanks. I was nominated the Riddlemaster of Remington for the 7th straight year!"
:game-player "I guess I'm pretty wise."
:game-player "And with my sharp intellect, I'm guessing you want my trophy?")
:choices ["Yes."
{:run #(do (actions/update-state entities (fn [state] (assoc state :current-riddle :wool)))
(actions/respond entities %
:game-player "Well, if you want my trophy, you'll have to earn it."
:game-player "There are a few riddles that even I, the wisest in all of Remington, cannot solve."
:game-player "How about you help me?"
:game-player "Bring me the answer:"
:game-player "White as snow, but not as cold,"
:game-player "Keeps you warm, or so I'm told."
:ego "Okay."))}
"No."
{:run #(actions/respond entities %
:game-player "That's exactly what I'd expect a dummy like you to say.")
}]})
(defn walk-to-player [entities]
(actions/walk-to entities :ego [210 73] :face :right))
(defn do-game-player-dialogue [entities]
(walk-to-player entities)
(actions/do-dialogue entities :ego "You there!" :game-player "... Yes?")
(actions/present-choices entities
{:choices ["Do you know anything about the sword in the stone up there?"
@@ -46,24 +70,7 @@
{:choices actions/something-else}]}
(when (= nil (get-in @entities [:state :current-riddle]))
"Nice trophy.")
{:run #(actions/respond entities %
:game-player "Thanks. I was nominated the Riddlemaster of Remington for the 7th straight year!"
:game-player "I guess I'm pretty wise."
:game-player "And with my sharp intellect, I'm guessing you want my trophy?")
:choices ["Yes."
{:run #(do (actions/update-state entities (fn [state] (assoc state :current-riddle :wool)))
(actions/respond entities %
:game-player "Well, if you want my trophy, you'll have to earn it."
:game-player "There are a few riddles that even I, the wisest in all of Remington, cannot solve."
:game-player "How about you help me?"
:game-player "Bring me the answer:"
:game-player "White as snow, but not as cold,"
:game-player "Keeps you warm, or so I'm told."
:ego "Okay."))}
"No."
{:run #(actions/respond entities %
:game-player "That's exactly what I'd expect a dummy like you to say.")
:choices actions/something-else}]}
(nice-trophy-dialogue entities)
(when (= :wool (get-in @entities [:state :current-riddle]))
"What was that riddle again?")
@@ -91,7 +98,8 @@
(defn make [screen]
(let [game-player-talk-sheet (texture! (texture "inside-castle/game-player-talk.png") :split 40 44)
game-player-talk (animation 0.15 (for [i [0 2 0 2 0 2 0 3 0 2 0 1 0 0 0 0 2 0 2 0 3 0 1 0 1 0 0 1 0 2 0 3 0]]
(aget game-player-talk-sheet 0 i)))]
(aget game-player-talk-sheet 0 i)))
trophy (utils/make-anim "inside-castle/trophy.png" [16 16] 0.1 (flatten [(repeat 50 0) 1 2 3 3 3 3 2 1]))]
(rooms/make :music :town-1
:interactions
{:right-door {:box [286 140 306 160]
@@ -132,9 +140,22 @@
(actions/talk entities :ego "Ye Ol' Antique Shoppe."))}}
:layers [(assoc (texture "inside-castle/background.png") :x 0 :y 0 :baseline 0)
(assoc (texture "inside-castle/pedestal-overlay.png") :x 0 :y 0 :baseline 135)]
:entities {:game-player (assoc (texture "inside-castle/gameplayer.png") :x 266 :y 49 :baseline 191
:entities {:trophy (assoc (animation->texture screen trophy)
:x 253 :y 69 :baseline 191
:anim trophy
:anim-start 0
:script (actions/get-script entities
(walk-to-player entities)
(if (= nil (get-in @entities [:state :current-riddle]))
(let [{:keys [run choices]} (nice-trophy-dialogue entities)]
(run "Nice trophy.")
(actions/present-choices entities {:choices choices}))
(actions/do-dialogue entities :ego "Can't you give me your trophy of wisdom?"
:game-player "If you want my trophy, you'll have to help me with my riddles."))))
:game-player (assoc (texture "inside-castle/gameplayer.png") :x 266 :y 49 :baseline 191
:script (actions/get-script entities (do-game-player-dialogue entities))
:scripts {:wool (actions/get-script entities
(walk-to-player entities)
(if (= :wool (get-in @entities [:state :current-riddle]))
(do (actions/update-state entities #(assoc % :current-riddle :balloon))
(actions/remove-item entities :wool)
@@ -144,6 +165,7 @@
:game-player "If you want to keep it, best have a tether."))
(actions/talk entities :ego "He doesn't need it.")))
:balloon (actions/get-script entities
(walk-to-player entities)
(if (= :balloon (get-in @entities [:state :current-riddle]))
(do (actions/update-state entities #(assoc % :current-riddle :frog-legs))
(actions/remove-item entities :balloon)
@@ -153,6 +175,7 @@
:game-player "Now I'm dead, or at least a have a scar."))
(actions/talk entities :ego "He doesn't need it.")))
:frog-legs (actions/get-script entities
(walk-to-player entities)
(if (= :frog-legs (get-in @entities [:state :current-riddle]))
(do (actions/update-state entities #(assoc % :current-riddle :done))
@@ -161,7 +184,8 @@
:game-player "Wow! That's right!"
:game-player "I guess I'm not the wisest person in Remington."
:game-player "You have earned my trophy.")
(actions/give entities :trophy))
(actions/give entities :trophy)
(actions/remove-entity entities :trophy))
(actions/talk entities :ego "He doesn't need it.")))}
:anim nil
:talk game-player-talk)}