This commit is contained in:
2015-02-23 19:18:26 -08:00
13 changed files with 55 additions and 33 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
<dict>
<key>duration</key>
<real>1</real>
</dict>
<dict>
<key>duration</key>
<real>1</real>
</dict>
<dict>
<key>duration</key>
<real>1</real>
</dict>
</array>
</plist>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

@@ -91,22 +91,22 @@
shopkeep-talk (animation 0.15 (for [i [0 2 0 2 0 3 1 0]]
(aget shopkeep-sheet 0 i)))
portrait (rooms/make-entity :portrait (assoc (texture "inside-antique/portrait.png")
:x 109
:y 120
:x 112
:y 114
:baseline 120
:script (actions/get-script entities
(actions/walk-to entities :ego [136 80] :face :left)
(actions/walk-to entities :ego [140 61] :face :left)
(actions/play-animation entities :ego :reach)
(actions/talk entities :ego "It's a portrait. There's something on the back but I can't read it.")
(actions/remove-entity entities :portrait)
(actions/give entities :portrait))))
beard (utils/make-anim "inside-antique/beard.png" [12 32] 0.5 [0 1 0 2])
beard (utils/make-anim "inside-antique/beard.png" [26 52] 0.5 [0 1 0 2])
teddy (assoc (texture "inside-antique/teddy.png")
:x 250
:y 80
:x 255
:y 95
:baseline 160
:script (actions/get-script entities
(actions/walk-to entities :ego [220 35] :face :right)
(actions/walk-to entities :ego [242 49] :face :right)
(actions/play-animation entities :ego :reach)
(actions/give entities :teddy)
(actions/remove-entity entities :teddy)
@@ -117,48 +117,49 @@
:shopkeep "That teddy bear does not leave my store."))))]
(rooms/make :music :inside-antique
:interactions
{:down {:box [60 0 290 25]
:cursor :down
{:right {:box [250 0 320 75]
:cursor :right
:script (actions/get-script entities
(when (or (actions/has-item? entities :portrait)
(has-to-return-teddy? entities))
(actions/walk-to entities :ego [222 3])
(actions/walk-to entities :ego [235 15])
(actions/talk entities :shopkeep "Excuse me sonny. Please return my belongings before you leave.")
(when (actions/has-item? entities :portrait)
(actions/walk-to entities :ego [136 80] :face :left)
(actions/walk-to entities :ego [143 64] :face :left)
(actions/play-animation entities :ego :reach)
(actions/add-entity entities :portrait portrait)
(actions/remove-item entities :portrait))
(when (has-to-return-teddy? entities)
(actions/walk-to entities :ego [220 35] :face :right)
(actions/walk-to entities :ego [242 49] :face :right)
(actions/play-animation entities :ego :reach)
(actions/add-entity entities :teddy teddy)
(actions/remove-item entities :teddy)))
(actions/walk-to entities :ego [222 3])
(actions/walk-to entities :ego [235 15])
(actions/walk-straight-to entities :ego [320 -5])
(actions/transition-background entities :inside-castle [182 90])
(actions/walk-to entities :ego [187 75]))}
:window {:box [212 130 256 180]
:window {:box [210 125 256 183]
:script (actions/get-script entities
(actions/talk entities :ego "It's a nice, big window."))
:scripts {:portrait (actions/get-script entities
(actions/walk-to entities :ego [151 60] :face :right)
(actions/walk-to entities :ego [142 49] :face :left)
(actions/play-animation entities :ego :hold-up-to-window)
(actions/talk entities :ego "The portrait says 'Herb' on the back.")
(actions/update-state entities (fn [state] (update-in state [:clues] #(conj % :name)) )))}}
:grandfather-clock {:box [50 137 90 185]
:grandfather-clock {:box [55 70 103 185]
:script (actions/get-script entities
(actions/do-dialogue entities :ego "Cool grandfather clock!"
:shopkeep "It's quite the exquisit piece, isn't it?"))}
:shelf {:box [0 40 48 210]
:shelf {:box [0 60 52 199]
:script (actions/get-script entities
(actions/walk-to entities :ego [55 35])
(actions/walk-to entities :ego [48 58])
(actions/talk entities :ego "All of these trinkets seem too bulky to fit in my pack."))}
:flowers {:box [171 125 181 155]
:flowers {:box [178 115 188 143]
:script (actions/get-script entities
(actions/update-state entities (fn [s] (assoc s :mints-eaten 0)))
(actions/talk entities :ego "I've never been a fan of flowers."))}
:lian {:box [272 100 313 160]
:lian {:box [264 103 317 198]
:script (actions/get-script entities
(actions/walk-to entities :ego [220 35] :face :right)
(actions/do-dialogue entities
@@ -166,8 +167,10 @@
:ego "He's the town of Remington's mascot."))}
}
:layers [(assoc (texture "inside-antique/background.png") :x 0 :y 0 :baseline 0)]
:entities {:shopkeep (actions/start-animation screen (assoc (animation->texture screen shopkeep-stand) :x 137 :y 128 :baseline 112
:entities {:shopkeep (actions/start-animation screen (assoc (animation->texture screen shopkeep-stand) :x 148 :y 122 :baseline 112
:stand shopkeep-stand
:scale-x 1.6
:scale-y 1.6
:talk-color (color 0.2 1.0 0.2 1.0)
:talk shopkeep-talk
:script (actions/get-script entities (do-antique-dialogue entities))
@@ -190,20 +193,20 @@
:beard (assoc (animation->texture screen beard)
:anim beard
:anim-start 0
:x 65
:y 109
:x 70
:y 86
:baseline 120)
:bowl (assoc (texture "inside-antique/bowl.png")
:x 155
:y 125
:x 165
:y 110
:baseline 125
:script (actions/get-script entities
(if (= 3 (get-in @entities [:state :mints-eaten]))
(do (actions/walk-to entities :ego [145 80] :face :right)
(do (actions/walk-to entities :ego [159 62] :face :right)
(actions/do-dialogue entities
:ego "She's all out."
:ego "Maybe Gandarf can brew her up another batch."))
(do (actions/walk-to entities :ego [145 80] :face :right)
(do (actions/walk-to entities :ego [159 62] :face :right)
(actions/talk entities :ego "I'll just try one of these mints.")
(actions/play-animation entities :ego :reach)
(actions/update-state entities (fn [s] (assoc s :mints-eaten (inc (s :mints-eaten)))))
@@ -224,5 +227,5 @@
(if (actions/has-item? entities :portrait )
(update-in entities [:room :entities] #(dissoc % :portrait))
entities)))
:scale-fn (utils/scaler-fn-with-baseline 110 0.10 1.50)
:scale-fn (utils/scaler-fn-with-baseline 110 0.10 1.75)
:start-pos [222 3])))

View File

@@ -240,8 +240,8 @@
(actions/play-animation entities :ego :reach)
(if (= :night (get-in @entities [:state :time]))
(actions/talk entities :ego "It's locked.")
(do (actions/transition-background entities :inside-antique [228 -30])
(actions/walk-straight-to entities :ego [222 15] :face :left)
(do (actions/transition-background entities :inside-antique [325 -30])
(actions/walk-straight-to entities :ego [235 15] :face :left)
(if (get-in @entities [:state :allowed-to-keep-teddy?])
(actions/do-dialogue entities :shopkeep "Hello there, sonny."
:shopkeep "Have you seen Herb lately?"

View File

@@ -67,6 +67,7 @@
(defn left-click [screen entities]
(let [[x y] (utils/unproject screen)]
(println "clicked " x y)
(let [interaction (first (filter #((:mouse-in? %) entities x y)
(get-in entities [:room :interactions])))
interacting-entity (first (sort-by (comp - :baseline) (filter #(and (:mouse-in? %)
@@ -577,7 +578,7 @@
:on-mouse-moved
(fn [{:keys [input-x input-y viewport] :as screen} [entities]]
(if (utils/contains? (.getScreenX viewport) (.getScreenY viewport)
(if (utils/contains-point? (.getScreenX viewport) (.getScreenY viewport)
(.getScreenWidth viewport) (.getScreenHeight viewport)
input-x input-y)
@@ -586,7 +587,7 @@
(assoc-in entities [:cursor :override] nil)))
:on-touch-up (fn [{:keys [input-x input-y viewport] :as screen} [entities]]
(when (utils/contains? (.getScreenX viewport) (.getScreenY viewport)
(when (utils/contains-point? (.getScreenX viewport) (.getScreenY viewport)
(.getScreenWidth viewport) (.getScreenHeight viewport)
input-x input-y)
(if (= (button-code :right)

View File

@@ -165,6 +165,6 @@
y (.y pj)]
[x y]))
(defn contains? [x1 y1 width height x y]
(defn contains-point? [x1 y1 width height x y]
(and (< x1 x (+ x1 width))
(< y1 y (+ y1 height))))