able to get back to blergh.

This commit is contained in:
2015-01-08 16:36:27 -08:00
parent f41a9deae1
commit 16639ef14c
11 changed files with 106 additions and 71 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

@@ -123,10 +123,11 @@
:spell-component {:name "Spell component" :value :spell-component :cursor :spell-component} :spell-component {:name "Spell component" :value :spell-component :cursor :spell-component}
:money {:name "Money" :value :money :cursor :money} :money {:name "Money" :value :money :cursor :money}
:watch {:name "Watch" :value :watch :cursor :watch} :watch {:name "Watch" :value :watch :cursor :watch}
:broken-watch {:name "Halved watch" :value :broken-watch :cursor :broken-watch} :broken-clock {:name "Sliced time-keeping device" :value :broken-clock :cursor :broken-clock}
:slingshot {:name "The Slinger's Shot" :value :slingshot :cursor :slingshot} :slingshot {:name "The Slinger's Shot" :value :slingshot :cursor :slingshot}
:note-2 {:name "Another note from Gandarf" :value :note-2 :cursor :note} :note-2 {:name "Bingo card" :value :note-2 :cursor :note-2}
:camera {:name "Image taking device" :value :camera :cursor :camera} :camera {:name "Image taking device" :value :camera :cursor :camera}
:walkie-talkies {:name "Communication devices" :value :walkie-talkies :cursor :walkie-talkies} :walkie-talkies {:name "Communication devices" :value :walkie-talkies :cursor :walkie-talkies}
:walkie-talkie {:name "Communication device" :value :walkie-talkie :cursor :walkie-talkie} :walkie-talkie {:name "Communication device" :value :walkie-talkie :cursor :walkie-talkie}
:flashlight {:name "Lighting device" :value :flashlight :cursor :flashlight}}) :alarm-clock {:name "Time-keeping device" :value :alarm-clock :cursor :alarm-clock}
:magic-slingshot {:name "The Slinger's Shot" :value :magic-slingshot :cursor :magic-slingshot}})

View File

@@ -221,9 +221,9 @@
(actions/play-animation entities :ego :squat) (actions/play-animation entities :ego :squat)
(actions/do-dialogue entities (actions/do-dialogue entities
:ego "Hey! A little lever." :ego "Hey! A little lever."
:ego "I think this is Gandarf's stash of helpful stuff.") :ego "I think this is Gandarf's secret stash of helpful stuff.")
(actions/play-animation entities :ego :squat) (actions/play-animation entities :ego :squat)
(actions/give entities :flashlight) (actions/give entities :alarm-clock)
(actions/do-dialogue entities :ego "What is this?") (actions/do-dialogue entities :ego "What is this?")
(actions/play-animation entities :ego :squat) (actions/play-animation entities :ego :squat)
(actions/give entities :camera) (actions/give entities :camera)

View File

@@ -53,19 +53,21 @@
:ego "'And please hurry, because we're being forced into a karaoke competition.'" :ego "'And please hurry, because we're being forced into a karaoke competition.'"
:ego "'I'm about at my witt's end.'" :ego "'I'm about at my witt's end.'"
:ego "'P.S., Guard that slingshot with your life!'" :ego "'P.S., Guard that slingshot with your life!'"
:ego "'P.P.S., If anything goes wrong, you can look for supplies behind a nearby r...'" :ego "'P.P.S., If anything goes wrong, you can look for my secret stash of helpful stuff behind a nearby r...'"
:ego "It just cuts off there.")) :ego "It just cuts off there."))
(defn read-note-2 [entities] (defn read-note-2 [entities]
(actions/do-dialogue entities (actions/do-dialogue entities
:ego "It's another note from Gandarf. It's written on the back of a bingo card. It reads:" :ego "It's a Bingo card."
:ego "Look's like there's a note on the back."
:ego "'Boy, the situation is dire. I don't have much time. Please hurry.'" :ego "'Boy, the situation is dire. I don't have much time. Please hurry.'"
:ego "'We've been forced into playing bingo for the last 3 hours.'" :ego "'We've been forced into playing bingo for the last 3 hours.'"
:ego "'You are almost done with the spell to restore magic to The Slinger's Shot.'" :ego "'You are almost done with the spell to restore magic to The Slinger's Shot.'"
:ego "'You haven't lost it, right?'" :ego "'You haven't lost it, right?'"
:ego "'You need to add the root of all evil to the cauldron.'" :ego "'You need to add the root of all evil to the cauldron.'"
:ego "'Also, you'll need to add a split second.'" :ego "'Also, you'll need to add a split second.'"
:ego "'Then, dip the Slinger's Shot in to complete the spell.'")) :ego "'Then, dip the Slinger's Shot in to complete the spell.'"
:ego "'Don't forget about my secret stash of helpful stuff.'"))
(defn listen-1 [entities] (defn listen-1 [entities]

View File

@@ -95,6 +95,12 @@
"Nevermind." "Nevermind."
{:run #(actions/respond entities % :game-player "See you around.")}]})) {:run #(actions/respond entities % :game-player "See you around.")}]}))
(defn walk-to-blergh [entities]
(actions/walk-to entities :ego [85 145] :face :right)
(actions/transition-background entities :space [0 65])
(actions/walk-straight-to entities :ego [140 55] :face :right)
(actions/play-animation entities :blergh :appear :stop? false)
(actions/transition-music entities :town-1 :fight))
(defn pull-sword [entities] (defn pull-sword [entities]
(actions/play-animation entities :ego :reach) (actions/play-animation entities :ego :reach)
@@ -109,12 +115,10 @@
(actions/transition-music entities :pull-sword :town-1) (actions/transition-music entities :pull-sword :town-1)
(actions/do-dialogue entities :ego "That was weird." (actions/do-dialogue entities :ego "That was weird."
:ego "I have to go show my friends!") :ego "I have to go show my friends!")
(actions/walk-to entities :ego [85 145] :face :right)
(actions/transition-background entities :space [0 65])
(actions/walk-straight-to entities :ego [140 55] :face :right)
(actions/add-entity entities :blergh (get-in @entities [:room :blergh])) (actions/add-entity entities :blergh (get-in @entities [:room :blergh]))
(actions/play-animation entities :blergh :appear :stop? false)
(actions/transition-music entities :town-1 :fight)
(actions/do-dialogue entities :ego "Who are YOU?!?!?!" (actions/do-dialogue entities :ego "Who are YOU?!?!?!"
:blergh "I'm your worst nightmare." :blergh "I'm your worst nightmare."
:blergh "I am Blergh, and this is now my dimension." :blergh "I am Blergh, and this is now my dimension."
@@ -155,16 +159,12 @@
(update-in entities [:room :entities] #(assoc % :monocle (get-in entities [:room :monocle]))) (update-in entities [:room :entities] #(assoc % :monocle (get-in entities [:room :monocle])))
entities)) entities))
(defn add-watch-if-necessary [entities]
(if (not (actions/has-obtained? entities :watch))
(update-in entities [:room :entities] #(assoc % :watch (get-in entities [:room :watch])))
entities))
(defn make-night [entities] (defn make-night [entities]
(-> entities (-> entities
(update-in [:room :entities] #(dissoc % :game-player)) (update-in [:room :entities] #(dissoc % :game-player))
add-monocle-if-necessary add-monocle-if-necessary))
add-watch-if-necessary))
(defn make [screen] (defn make [screen]
(let [game-player-talk-sheet (texture! (texture "inside-castle/game-player-talk.png") :split 40 44) (let [game-player-talk-sheet (texture! (texture "inside-castle/game-player-talk.png") :split 40 44)
@@ -349,21 +349,7 @@
(actions/remove-entity entities :monocle) (actions/remove-entity entities :monocle)
(actions/give entities :monocle) (actions/give entities :monocle)
(actions/talk entities :ego "It looks like a monocle."))})) (actions/talk entities :ego "It looks like a monocle."))}))
:watch (rooms/make-entity :watch (assoc (texture "inside-castle/watch.png")
:x 282 :y 62 :baseline 140
:script (actions/get-script entities
(actions/talk entities :ego "There's something on that chair.")
(actions/walk-to entities :ego [265 90] :face :right)
(actions/walk-straight-to entities :ego [303 80])
(actions/walk-straight-to entities :ego [302 48])
(actions/play-animation entities :ego :squat)
(actions/remove-entity entities :watch)
(actions/give entities :watch)
(actions/do-dialogue entities :ego "It's a watch."
:ego "Brian O'Brainy must have left it behind.")
(actions/walk-straight-to entities :ego [303 80])
(actions/walk-straight-to entities :ego [265 90]))))
:collision "inside-castle/collision.png" :collision "inside-castle/collision.png"
:scale-fn (utils/scaler-fn-from-image "inside-castle/scale.png" 0.25 1.00) :scale-fn (utils/scaler-fn-from-image "inside-castle/scale.png" 0.25 1.00)
:apply-state (fn [entities] :apply-state (fn [entities]

View File

@@ -123,7 +123,8 @@
(defn should-block? [entities] (defn should-block? [entities]
(and (= :night (get-in @entities [:state :time])) (and (= :night (get-in @entities [:state :time]))
(actions/has-obtained? entities :flask-2))) (actions/has-obtained? entities :flask-2)
(not (actions/has-item? entities :magic-slingshot))))
(defn frankie-comment-on-item [entities] (defn frankie-comment-on-item [entities]
(cond (cond
@@ -370,6 +371,8 @@
:script (actions/get-script entities :script (actions/get-script entities
(actions/walk-to entities :ego [210 79] :face :left) (actions/walk-to entities :ego [210 79] :face :left)
(actions/play-animation entities :ego :squat) (actions/play-animation entities :ego :squat)
(actions/give entities :note-2)
(actions/remove-entity entities :note)
(common/read-note-2 entities)))) (common/read-note-2 entities))))
:collision "outside-castle/collision.png" :collision "outside-castle/collision.png"
:scale-fn (utils/scaler-fn-with-baseline 110 0.10 1.00) :scale-fn (utils/scaler-fn-with-baseline 110 0.10 1.00)

View File

@@ -2,6 +2,8 @@
(:require [advent.screens.items :as items] (:require [advent.screens.items :as items]
[advent.screens.rooms :as rooms] [advent.screens.rooms :as rooms]
[advent.screens.rooms.common :as common] [advent.screens.rooms.common :as common]
[advent.screens.rooms.outside-castle :as outside-castle]
[advent.screens.rooms.inside-castle :as inside-castle]
[advent.actions :as actions] [advent.actions :as actions]
[advent.utils :as utils] [advent.utils :as utils]
[clojure.zip :as zip] [clojure.zip :as zip]
@@ -11,6 +13,12 @@
[play-clj.utils :refer :all] [play-clj.utils :refer :all]
[play-clj.g2d :refer :all])) [play-clj.g2d :refer :all]))
(defn walk-to-castle [entities]
(actions/walk-to entities :ego [0 80])
(actions/walk-straight-to entities :ego [-20 80])
(actions/transition-background entities :outside-castle [330 80])
(actions/walk-straight-to entities :ego [310 80]))
(def ego-sheep-loc (def ego-sheep-loc
[132 140]) [132 140])
@@ -21,6 +29,53 @@
(defn is-sheep-close? [entities] (defn is-sheep-close? [entities]
(< (dist-to-sheep entities) 45)) (< (dist-to-sheep entities) 45))
(defn is-ready-for-slingshot [entities]
(and (actions/has-obtained? entities :broken-clock)
(not (actions/has-item? entities :broken-clock))
(actions/has-obtained? entities :money)
(not (actions/has-item? entities :money))))
(defn put-something-in-cauldron [item]
(condp = item
:money (actions/get-script entities
(actions/walk-to entities :ego [141 90] :face :right)
(actions/play-animation entities :ego :reach)
(actions/remove-item entities :money)
(actions/talk entities :ego "I guess that's what you could call 'money in the pot'."))
:slingshot (actions/get-script entities
(if (is-ready-for-slingshot entities)
(do
(actions/walk-to entities :ego [141 90] :face :right)
(actions/talk entities :ego "Here goes!")
(actions/play-animation entities :ego :reach)
(actions/remove-item entities :slingshot)
(actions/give entities :magic-slingshot)
(actions/do-dialogue entities
:ego "It worked!"
:ego "I now have The Slinger's Shot."
:ego "And just in time, too. It's getting light.")
(walk-to-castle entities)
(outside-castle/go-through-gate entities)
(inside-castle/walk-to-blergh entities))))
:broken-clock (actions/get-script entities
(actions/walk-to entities :ego [141 90] :face :right)
(actions/play-animation entities :ego :reach)
(actions/remove-item entities :broken-clock)
(actions/talk entities :ego "Just in the nick of time."))
:recipe (actions/get-script entities
(actions/walk-to entities :ego [151 90] :face :right)
(actions/play-animation entities :ego :squat)
(actions/remove-item entities :recipe)
(actions/give entities :ash)
(actions/talk entities :ego "It burned up into ash."))
:spell-component (actions/get-script entities
(actions/walk-to entities :ego [141 90] :face :right)
(actions/play-animation entities :ego :reach)
(actions/remove-item entities :spell-component)
(actions/talk entities :ego "I poured it in. Now what?"))
(actions/get-script entities
(actions/talk entities :ego "I don't want to put something in there unless I'm sure I need to."))))
(defn wizard-dialogue [entities] (defn wizard-dialogue [entities]
(actions/do-dialogue entities :ego "Hello there [RED]Gandarf[]!" :wizard "Oh no, not you again!") (actions/do-dialogue entities :ego "Hello there [RED]Gandarf[]!" :wizard "Oh no, not you again!")
(actions/present-choices entities (actions/present-choices entities
@@ -206,10 +261,8 @@
:left-dir {:box [0 40 20 140] :left-dir {:box [0 40 20 140]
:script (actions/get-script :script (actions/get-script
entities entities
(actions/walk-to entities :ego [0 80]) (walk-to-castle entities)
(actions/walk-straight-to entities :ego [-20 80])
(actions/transition-background entities :outside-castle [330 80])
(actions/walk-straight-to entities :ego [310 80])
) )
:cursor :left}} :cursor :left}}
:layers {:day [(assoc (texture "outsidehouse/background.png") :x 0 :y 0 :baseline 0) :layers {:day [(assoc (texture "outsidehouse/background.png") :x 0 :y 0 :baseline 0)
@@ -290,17 +343,7 @@
:anim cauldron :anim cauldron
:anim-start 0 :anim-start 0
:script (actions/get-script entities (actions/talk entities :ego "That's a big cauldron!")) :script (actions/get-script entities (actions/talk entities :ego "That's a big cauldron!"))
:scripts {:recipe (actions/get-script entities :scripts put-something-in-cauldron))
(actions/walk-to entities :ego [151 90] :face :right)
(actions/play-animation entities :ego :squat)
(actions/remove-item entities :recipe)
(actions/give entities :ash)
(actions/talk entities :ego "It burned up into ash."))
:spell-component (actions/get-script entities
(actions/walk-to entities :ego [141 90] :face :right)
(actions/play-animation entities :ego :reach)
(actions/remove-item entities :spell-component)
(actions/talk entities :ego "I poured it in. Now what?"))}))
:wizard (rooms/make-entity :wizard (common/make-wizard screen {:x 190 :y 78 :baseline 162 :scale-x 1.2 :scale-y 1.2 :wizard (rooms/make-entity :wizard (common/make-wizard screen {:x 190 :y 78 :baseline 162 :scale-x 1.2 :scale-y 1.2
:script (actions/get-script entities (talk-to-gandarf-outside entities))})) :script (actions/get-script entities (talk-to-gandarf-outside entities))}))
:note (rooms/make-entity :note (assoc (texture "outsidehouse/note.png") :note (rooms/make-entity :note (assoc (texture "outsidehouse/note.png")

View File

@@ -15,11 +15,11 @@
(assoc-in entities [:room :entities :spear] (get-in entities [:room :spear])) (assoc-in entities [:room :entities :spear] (get-in entities [:room :spear]))
entities)) entities))
(defn add-watch-if-necessary [entities] (defn add-clock-if-necessary [entities]
(if (and (not (actions/has-obtained? entities :broken-watch)) (if (and (not (actions/has-obtained? entities :broken-clock))
(not (actions/has-item? entities :watch)) (not (actions/has-item? entities :alarm-clock))
(actions/has-obtained? entities :watch)) (actions/has-obtained? entities :alarm-clock))
(assoc-in entities [:room :entities :watch] (get-in entities [:room :watch])) (assoc-in entities [:room :entities :alarm-clock] (get-in entities [:room :alarm-clock]))
entities)) entities))
(defn add-rope-if-necessary [entities] (defn add-rope-if-necessary [entities]
@@ -33,7 +33,7 @@
(-> entities (-> entities
(assoc-in [:room :entities :guard] (get-in entities [:room :guard])) (assoc-in [:room :entities :guard] (get-in entities [:room :guard]))
add-spear-if-necessary add-spear-if-necessary
add-watch-if-necessary add-clock-if-necessary
(assoc-in [:room :entities :stash] (get-in entities [:room :stash])) (assoc-in [:room :entities :stash] (get-in entities [:room :stash]))
add-rope-if-necessary)) add-rope-if-necessary))
@@ -131,21 +131,21 @@
:stump {:box [205 68 251 89] :stump {:box [205 68 251 89]
:script (actions/get-script entities :script (actions/get-script entities
(actions/do-dialogue entities :ego "It's a stump.")) (actions/do-dialogue entities :ego "It's a stump."))
:scripts {:watch (actions/get-script entities :scripts {:alarm-clock (actions/get-script entities
(actions/walk-to entities :ego [189 65] :face :right) (actions/walk-to entities :ego [189 65] :face :right)
(actions/play-animation entities :ego :reach) (actions/play-animation entities :ego :reach)
(actions/remove-item entities :watch) (actions/remove-item entities :alarm-clock)
(actions/add-entity entities :watch (get-in @entities [:room :watch]))) (actions/add-entity entities :alarm-clock (get-in @entities [:room :alarm-clock])))
:sword (actions/get-script entities :sword (actions/get-script entities
(when (get-in @entities [:room :entities :watch]) (when (get-in @entities [:room :entities :alarm-clock])
(actions/walk-to entities :ego [129 65] :face :right) (actions/walk-to entities :ego [129 65] :face :right)
(actions/talk entities :ego "I'll take a big swing!") (actions/talk entities :ego "I'll take a big swing!")
(actions/walk-straight-to entities :ego [189 65] :face :right :speed 3.5) (actions/walk-straight-to entities :ego [189 65] :face :right :speed 3.5)
(actions/play-animation entities :ego :swing) (actions/play-animation entities :ego :swing)
(actions/talk entities :ego "It's split right down the middle!") (actions/talk entities :ego "It's split right down the middle!")
(actions/play-animation entities :ego :reach) (actions/play-animation entities :ego :reach)
(actions/remove-entity entities :watch) (actions/remove-entity entities :alarm-clock)
(actions/give entities :broken-watch)))}} (actions/give entities :broken-clock)))}}
:lever {:box [10 72 17 85] :lever {:box [10 72 17 85]
:script (actions/get-script entities :script (actions/get-script entities
(interact-with-lever entities)) (interact-with-lever entities))
@@ -192,13 +192,13 @@
:spear (rooms/make-entity :spear (assoc (texture "outside-jail/spear.png") :spear (rooms/make-entity :spear (assoc (texture "outside-jail/spear.png")
:x 60 :y 65 :baseline 180 :x 60 :y 65 :baseline 180
:script (actions/get-script entities (grab-spear entities)))) :script (actions/get-script entities (grab-spear entities))))
:watch (rooms/make-entity :watch (assoc (texture "inside-castle/watch.png") :alarm-clock (rooms/make-entity :alarm-clock (assoc (texture "outside-jail/alarm-clock.png")
:x 217 :y 83 :baseline 160 :x 217 :y 83 :baseline 160
:script (actions/get-script entities :script (actions/get-script entities
(actions/walk-to entities :ego [189 65] :face :right) (actions/walk-to entities :ego [189 65] :face :right)
(actions/play-animation entities :ego :reach) (actions/play-animation entities :ego :reach)
(actions/remove-entity entities :watch) (actions/remove-entity entities :alarm-clock)
(actions/give entities :watch)))) (actions/give entities :alarm-clock))))
:stash (rooms/make-entity :stash (assoc (animation->texture screen open-stash) :stash (rooms/make-entity :stash (assoc (animation->texture screen open-stash)
:x 197 :y 94 :baseline 146 :x 197 :y 94 :baseline 146

View File

@@ -259,7 +259,7 @@
:note-1 (actions/get-script entities (common/read-note-1 entities)) :note-1 (actions/get-script entities (common/read-note-1 entities))
:note-2 (actions/get-script entities (common/read-note-2 entities)) :note-2 (actions/get-script entities (common/read-note-2 entities))
:camera (actions/get-script entities (actions/talk entities :ego "It's some sort of magical device that captures images.")) :camera (actions/get-script entities (actions/talk entities :ego "It's some sort of magical device that captures images."))
:flashlight (actions/get-script entities (actions/talk entities :ego "It's a magic device that gives off light.")) :alarm-clock (actions/get-script entities (actions/talk entities :ego "It's a magic device that tells the time."))
:walkie-talkies (actions/get-script entities (actions/do-dialogue entities :ego "If I talk in one of these devices, I can hear it in the other one!")) :walkie-talkies (actions/get-script entities (actions/do-dialogue entities :ego "If I talk in one of these devices, I can hear it in the other one!"))
:walkie-talkie (actions/get-script entities (common/listen-to-frankie entities)) :walkie-talkie (actions/get-script entities (common/listen-to-frankie entities))
nil)) nil))

View File

@@ -14,7 +14,7 @@
(let [{:keys [x y]} (input->screen screen {:x (:input-x screen) :y (:input-y screen)})] (let [{:keys [x y]} (input->screen screen {:x (:input-x screen) :y (:input-y screen)})]
(println (:input-x screen) (:input-y screen) "->" x y))) (println (:input-x screen) (:input-y screen) "->" x y)))
(def +all-cursors+ [:main :wool :mushrooms :carrot :right :down :left :up :flask :flask-with-contents :trophy :ladder :stick :cat-toy :balloon :frog-legs :teddy :portrait :recipe :glass-eye :motivational-tapes :used-earplugs :grass :slobber :flask-with-strength :medal :kiss :sword :hourglass :mandrake :ball-n-chain :key :rope :crowbar :note-1 :ash :sack-lunch :flies :spear :monocle :feather :spell-component :money :watch :broken-watch :slingshot :camera :walkie-talkies :flashlight :walkie-talkie :flask-water :flask-water-stuff :flask-water-stuff-2]) (def +all-cursors+ [:main :wool :mushrooms :carrot :right :down :left :up :flask :flask-with-contents :trophy :ladder :stick :cat-toy :balloon :frog-legs :teddy :portrait :recipe :glass-eye :motivational-tapes :used-earplugs :grass :slobber :flask-with-strength :medal :kiss :sword :hourglass :mandrake :ball-n-chain :key :rope :crowbar :note-1 :ash :sack-lunch :flies :spear :monocle :feather :spell-component :money :watch :broken-clock :slingshot :camera :walkie-talkies :alarm-clock :walkie-talkie :flask-water :flask-water-stuff :flask-water-stuff-2 :note-2 :magic-slingshot])
(defn cursor [filename which] (defn cursor [filename which]
(let [scale 2 (let [scale 2