From 2fcbe26ea291d16ca22ea670fb5d5fbee95e47be Mon Sep 17 00:00:00 2001 From: Remington Covert Date: Wed, 17 Dec 2014 12:49:14 -0800 Subject: [PATCH] expanding dialogue. --- desktop/project.clj | 16 ++-- .../advent/screens/rooms/inside_castle.clj | 81 ++++++++++--------- .../advent/screens/rooms/outside_castle.clj | 47 ++++++++--- .../advent/screens/rooms/outside_house.clj | 53 ++++++------ 4 files changed, 118 insertions(+), 79 deletions(-) diff --git a/desktop/project.clj b/desktop/project.clj index 88ad1b5e..c0ffc6bc 100644 --- a/desktop/project.clj +++ b/desktop/project.clj @@ -1,16 +1,16 @@ (defproject advent "0.0.1-SNAPSHOT" :description "FIXME: write description" - :dependencies [[com.badlogicgames.gdx/gdx "1.3.0"] - [com.badlogicgames.gdx/gdx-backend-lwjgl "1.3.0"] - [com.badlogicgames.gdx/gdx-box2d "1.3.0"] - [com.badlogicgames.gdx/gdx-tools "1.3.0"] - [com.badlogicgames.gdx/gdx-box2d-platform "1.3.0" + :dependencies [[com.badlogicgames.gdx/gdx "1.5.0"] + [com.badlogicgames.gdx/gdx-backend-lwjgl "1.5.0"] + [com.badlogicgames.gdx/gdx-box2d "1.5.0"] + [com.badlogicgames.gdx/gdx-tools "1.5.0"] + [com.badlogicgames.gdx/gdx-box2d-platform "1.5.0" :classifier "natives-desktop"] - [com.badlogicgames.gdx/gdx-bullet "1.3.0"] - [com.badlogicgames.gdx/gdx-bullet-platform "1.3.0" + [com.badlogicgames.gdx/gdx-bullet "1.5.0"] + [com.badlogicgames.gdx/gdx-bullet-platform "1.5.0" :classifier "natives-desktop"] - [com.badlogicgames.gdx/gdx-platform "1.3.0" + [com.badlogicgames.gdx/gdx-platform "1.5.0" :classifier "natives-desktop"] [org.clojure/clojure "1.6.0"] [play-clj "0.4.2"] diff --git a/desktop/src-common/advent/screens/rooms/inside_castle.clj b/desktop/src-common/advent/screens/rooms/inside_castle.clj index 23efa8cc..2cdae64c 100644 --- a/desktop/src-common/advent/screens/rooms/inside_castle.clj +++ b/desktop/src-common/advent/screens/rooms/inside_castle.clj @@ -208,44 +208,51 @@ :game-player (assoc (texture "inside-castle/gameplayer.png") :x 266 :y 49 :baseline 191 `:talk-color (color 1.0 0.3 0.2 1.0) :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) - (actions/do-dialogue entities - :game-player "That's right! Now for your second riddle:" - :game-player "'Filled with air, light as a feather,\nIf you want to keep it, best have a tether.'" - :ego "Okay. Be back soon.")) - (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) - (actions/do-dialogue entities - :game-player "That's right! Now for your third riddle:" - :game-player "'Hippity-hop, I'd jump so high,\nWithout these springs, can't harm a fly.'" - :ego "Okay. Be back soon.")) - (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)) - - (actions/remove-item entities :frog-legs) - (actions/do-dialogue entities - :game-player "Wow! That's right!" - :game-player "You, sir, have proven yourself worthy of my trophy." - :game-player "Even I, Brian O'Brainy, am impressed with your wisdom." - :game-player "Take it, and go in wisdom.") - (actions/give entities :trophy) - (actions/remove-entity entities :trophy) - (actions/talk entities :ego "Thanks!")) - (actions/talk entities :ego "He doesn't need it."))) - :trophy (actions/get-script entities + :scripts #(condp = % + :wool (actions/get-script entities (walk-to-player entities) - (actions/talk entities :game-player "You can keep the trophy. You've earned it."))} + (if (= :wool (get-in @entities [:state :current-riddle])) + (do (actions/update-state entities (fn [s] (assoc s :current-riddle :balloon))) + (actions/remove-item entities :wool) + (actions/do-dialogue entities + :game-player "That's right! Now for your second riddle:" + :game-player "'Filled with air, light as a feather,\nIf you want to keep it, best have a tether.'" + :ego "Okay. Be back soon.")) + (actions/do-dialogue entities :ego "What about this?" :game-player "No, that's not the solution. Keep looking."))) + :balloon (actions/get-script entities + (walk-to-player entities) + (if (= :balloon (get-in @entities [:state :current-riddle])) + (do (actions/update-state entities (fn [s] (assoc s :current-riddle :frog-legs))) + (actions/remove-item entities :balloon) + (actions/do-dialogue entities + :game-player "That's right! Now for your third riddle:" + :game-player "'Hippity-hop, I'd jump so high,\nWithout these springs, can't harm a fly.'" + :ego "Okay. Be back soon.")) + (actions/do-dialogue entities :ego "What about this?" :game-player "No, that's not the solution. Keep looking."))) + :frog-legs (actions/get-script entities + (walk-to-player entities) + (if (= :frog-legs (get-in @entities [:state :current-riddle])) + (do (actions/update-state entities (fn [s] (assoc s :current-riddle :done))) + + (actions/remove-item entities :frog-legs) + (actions/do-dialogue entities + :game-player "Wow! That's right!" + :game-player "You, sir, have proven yourself worthy of my trophy." + :game-player "Even I, Brian O'Brainy, am impressed with your wisdom." + :game-player "Take it, and go in wisdom.") + (actions/give entities :trophy) + (actions/remove-entity entities :trophy) + (actions/talk entities :ego "Thanks!")) + (actions/do-dialogue entities :ego "What about this?" :game-player "No, that's not the solution. Keep looking."))) + :trophy (actions/get-script entities + (walk-to-player entities) + (actions/talk entities :game-player "You can keep the trophy. You've earned it.")) + (actions/get-script entities + (walk-to-player entities) + (condp = (get-in @entities [:state :current-riddle]) + :done (actions/do-dialogue entities :game-player "I've gotten all the help I need with riddles today.") + nil (actions/do-dialogue entities :game-player "Why are you offering me this?") + (actions/do-dialogue entities :ego "What about this?" :game-player "No, that's not the solution. Keep looking.")))) :anim game-player-stand :anim-start 0 :stand game-player-stand diff --git a/desktop/src-common/advent/screens/rooms/outside_castle.clj b/desktop/src-common/advent/screens/rooms/outside_castle.clj index e000516e..6f86f766 100644 --- a/desktop/src-common/advent/screens/rooms/outside_castle.clj +++ b/desktop/src-common/advent/screens/rooms/outside_castle.clj @@ -106,6 +106,14 @@ :peddler "Remember - I have a one-day special going." :peddler "Every purchase comes with a free balloon!"))) +(defn walk-to-peddler [entities] + (actions/walk-to entities :ego [191 90] :face :left)) + +(defn no-returns [entities] + (walk-to-peddler entities) + (actions/do-dialogue entities :ego "Can I return this?" + :peddler "Sorry, no refunds.")) + (defn do-peddler-dialogue [entities] (cond (actions/has-obtained? entities :balloon) (do-completed-peddler-conversation entities) (get-in @entities [:state :wants-toy]) (do-wants-toy-conversation entities) @@ -161,11 +169,21 @@ :peddler {:box [110 90 128 146] :script (actions/get-script entities - (actions/walk-to entities :ego [191 90] :face :left) + (walk-to-peddler entities) (do-peddler-dialogue entities)) - :scripts {:teddy (actions/get-script entities - (actions/walk-to entities :ego [191 90] :face :left) - (give-teddy entities))}}} + :scripts #(condp = % + :teddy (actions/get-script entities + (walk-to-peddler entities) + (give-teddy entities)) + :glass-eye (actions/get-script entities (no-returns entities)) + :motivational-tapes (actions/get-script entities (no-returns entities)) + :used-earplugs (actions/get-script entities (no-returns entities)) + :balloon (actions/get-script entities (no-returns entities)) + (actions/get-script entities + (walk-to-peddler entities) + (actions/do-dialogue entities + :ego "Are you interested in this?" + :peddler "No, I have no use for it.")))}} :layers [(assoc (texture "outside-castle/background.png") :x 0 :y 0 :baseline 0)] :entities {:peddler (actions/start-animation screen (assoc (texture "outside-castle/peddler.png") :x 110 :y 90 :baseline 150 :anim nil @@ -179,15 +197,22 @@ (actions/walk-to entities :ego [168 150] :face :right) (actions/do-dialogue entities :ego "It's Angus, Remington's buff bull." + :ego "He's used in all of the town's rodeos." :ego "Farmer Doug feeds him an exclusive wild high-protein grass diet to keep him in tip top shape." :ego "He looks mean, I'd rather not pet him.")) - :scripts {:grass (actions/get-script entities - (actions/walk-to entities :ego [168 150] :face :right) - (actions/play-animation entities :ego :reach) - (actions/remove-item entities :grass) - (actions/talk entities :ego "Eww! He slobbered on my hand.") - (actions/give entities :slobber))} - ) + :scripts #(condp = % + :grass (actions/get-script entities + (actions/walk-to entities :ego [168 150] :face :right) + (actions/play-animation entities :ego :reach) + (actions/remove-item entities :grass) + (actions/talk entities :ego "Eww! He slobbered on my hand.") + (actions/give entities :slobber)) + :carrot (actions/get-script entities + (actions/walk-to entities :ego [168 150] :face :right) + (actions/do-dialogue entities + :ego "I don't thing Angus is interested." + :ego "Farmer Doug only feeds him a wild high-protein grass.")) + nil)) :stand) :balloons (actions/start-animation screen (assoc (animation->texture screen balloon-stand) diff --git a/desktop/src-common/advent/screens/rooms/outside_house.clj b/desktop/src-common/advent/screens/rooms/outside_house.clj index 5e1a54d8..fed62936 100644 --- a/desktop/src-common/advent/screens/rooms/outside_house.clj +++ b/desktop/src-common/advent/screens/rooms/outside_house.clj @@ -177,30 +177,37 @@ (actions/give entities :wool) (actions/talk entities :ego "I guess her wool is shedding.")) (actions/talk entities :ego "She's too far away for me to pet her.")))) - :scripts {:wool (actions/get-script entities - (actions/talk entities :ego "She doesn't need it back.")) - :carrot (actions/get-script entities - (actions/walk-to entities :ego ego-sheep-loc :face :left) - (actions/talk entities :ego "Come on girl, get the carrot!") - (actions/walk-straight-to entities :sheep [95 150]) + :scripts #(condp = % + :wool (actions/get-script entities + (actions/talk entities :ego "She doesn't need it back.")) + :grass (actions/get-script entities + (actions/walk-to entities :ego ego-sheep-loc :face :left) + (actions/talk entities :ego "Come on girl, get the grass!") + (actions/play-animation entities :ego :reach) + (actions/talk entities :ego "I think she's not interested.")) + :carrot (actions/get-script entities + (actions/walk-to entities :ego ego-sheep-loc :face :left) + (actions/talk entities :ego "Come on girl, get the carrot!") + (actions/walk-straight-to entities :sheep [95 150]) + (actions/play-animation entities :ego :reach) + (actions/remove-item entities :carrot) + (actions/update-state entities (fn [s] (assoc s :coaxed-sheep? true)))) + :flask-1 (actions/get-script entities + (if (is-sheep-close? @entities) + (do (actions/walk-to entities :ego ego-sheep-loc :face :left) + (actions/play-animation entities :ego :reach) + (actions/remove-item entities :flask-1) + (actions/give entities :flask-1-with-milk) + (actions/talk entities :ego "Sheeps milk.")) + (actions/talk entities :ego "She's too far away."))) + :flask-1-with-mushrooms + (actions/get-script entities + (if (is-sheep-close? @entities) + (do (actions/walk-to entities :ego ego-sheep-loc :face :left) (actions/play-animation entities :ego :reach) - (actions/remove-item entities :carrot) - (actions/update-state entities #(assoc % :coaxed-sheep? true))) - :flask-1 (actions/get-script entities - (if (is-sheep-close? @entities) - (do (actions/walk-to entities :ego ego-sheep-loc :face :left) - (actions/play-animation entities :ego :reach) - (actions/remove-item entities :flask-1) - (actions/give entities :flask-1-with-milk) - (actions/talk entities :ego "Sheeps milk.")) - (actions/talk entities :ego "She's too far away."))) - :flask-1-with-mushrooms - (actions/get-script entities - (if (is-sheep-close? @entities) - (do (actions/walk-to entities :ego ego-sheep-loc :face :left) - (actions/play-animation entities :ego :reach) - (items/make-cream-of-mushroom entities)) - (actions/talk entities :ego "She's too far away.")))} + (items/make-cream-of-mushroom entities)) + (actions/talk entities :ego "She's too far away."))) + nil) :left {:walk (utils/flip sheep-walk) :stand (utils/flip sheep-stand)} :right {:walk sheep-walk