can return the portrait.

This commit is contained in:
Bryce Covert
2015-08-16 14:14:39 -07:00
parent 772e2bb0bf
commit d75693a910
3 changed files with 67 additions and 22 deletions

View File

@@ -19,10 +19,46 @@
+ you can drink the strength potion while in blood clots hand
+ try to have dialogue for every wrong interaction
+ Click on cauldron should tell you what you need to add
+can walk to top corner in house screen
+ can walk to top corner in house screen
+ outside castle trees need to be updated
+ gate z-index
+ Zounds!
+ Walking
+ blink
+ scratch
+ peddler scratch
+ sheep
+ candles
+ magic hands
+ gandarf explosion
+ crying
+ cat
+ pick up
+ strength potion
+ metal clanking
+ jail door sliding open
+ jail creak
+ jail crash
+ pit go down
+ ladder break
+ eavesdrop
+ milking
+ angus
+ writing
+ antique sigh
+ bloodclot grunt
+ bloodclot explode
+ fountain
+ crowbar
+ door
+ ambient forest
+ get sick
+ sigh
+ jump
+ chop wood
+ step backwards creep
+ snore
+ shoot slinger's
+

View File

@@ -86,6 +86,11 @@
:choices actions/previous-choices}
"Nevermind." {:run #(actions/respond entities % :shopkeep "Feel free to look around.")}]}))
(defn return-portrait [ entities]
(actions/walk-to entities :ego [143 64] :face :left)
(actions/play-animation entities :ego :reach)
(actions/add-entity entities :portrait (get-in @entities [:room :portrait]))
(actions/remove-item entities :portrait))
(defn has-to-return-teddy? [entities]
(and (actions/has-item? entities :teddy)
@@ -98,16 +103,7 @@
shopkeep-talk (animation 0.15 (for [i [0 2 0 2 0 3 1 0]]
(aget shopkeep-sheet 0 i)))
shopkeep-sigh (utils/make-anim "inside-antique/antique-sigh.png" [22 21] 0.2 (flatten [ (range 9) 0 0 0 0 0 0 ]))
portrait (rooms/make-entity :portrait (assoc (texture "inside-antique/portrait.png")
:x 112
:y 114
:baseline 120
:script (actions/get-script entities
(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 it's too dim to read.")
(actions/remove-entity entities :portrait)
(actions/give entities :portrait))))
beard (utils/make-anim "inside-antique/beard.png" [26 52] 0.5 [0 1 0 2])
teddy (assoc (texture "inside-antique/teddy.png")
:x 255
@@ -133,10 +129,7 @@
(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 [143 64] :face :left)
(actions/play-animation entities :ego :reach)
(actions/add-entity entities :portrait portrait)
(actions/remove-item entities :portrait))
(return-portrait entities))
(when (has-to-return-teddy? entities)
(actions/walk-to entities :ego [242 49] :face :right)
(actions/play-animation entities :ego :reach)
@@ -147,6 +140,10 @@
(actions/walk-straight-to entities :ego [320 -5])
(actions/transition-background entities :inside-castle [182 90])
(actions/walk-to entities :ego [187 75]))}
:return-portrait {:box [103 70 206 116]
:script (actions/get-script entities (actions/talk entities :ego "It's the shopkeep's desk."))
:scripts {:portrait (actions/get-script entities
(return-portrait entities))}}
:window {:box [210 125 256 183]
:script (actions/get-script entities
(actions/talk entities :ego "It's a nice, big window."))
@@ -202,7 +199,6 @@
(actions/get-script entities
(actions/talk entities :shopkeep "No thanks, sonny."))))
:stand)
:portrait portrait
:beard (assoc (animation->texture screen beard)
:anim beard
:anim-start 0
@@ -251,6 +247,17 @@
:shopkeep "Now be a good lad and tell Gandarf that I need some more brewed up."
:shopkeep "Pronto!"))))))
:teddy teddy}
:portrait (rooms/make-entity :portrait
(assoc (texture "inside-antique/portrait.png")
:x 112
:y 114
:baseline 120
:script (actions/get-script entities
(actions/walk-to entities :ego [140 61] :face :left)
(actions/play-animation entities :ego :reach)
(actions/remove-entity entities :portrait)
(actions/give entities :portrait)
(actions/talk entities :ego "It's a portrait. There's something on the back but it's too dim to read."))))
:collision "inside-antique/collision.png"
:apply-state (fn [_ entities]
(as-> entities entities
@@ -258,8 +265,9 @@
(actions/has-obtained? entities :balloon))
(update-in entities [:room :entities] #(dissoc % :teddy))
entities)
(if (actions/has-item? entities :portrait )
(update-in entities [:room :entities] #(dissoc % :portrait))
entities)))
entities
(assoc-in entities [:room :entities :portrait] (get-in entities [:room :portrait])))))
:scale-fn (utils/scaler-fn-with-baseline 110 0.10 1.75)
:start-pos [222 3])))

View File

@@ -252,7 +252,8 @@
out-of-bounds (not (contains-point? (.getScreenX viewport) (.getScreenY viewport)
(.getScreenWidth viewport) (.getScreenHeight viewport)
(first raw-pos) (last raw-pos)))
hovering-ego (hovering-ego entities last-pos)]
hovering-ego (hovering-ego entities last-pos)
current (get-in entities [:cursor :current])]
(cond
out-of-bounds
@@ -274,7 +275,7 @@
(assoc-in [:cursor :override] nil)
(assoc-in [:cursor :active] false))
(and hovering-ego (not= :main (get-in entities [:cursor :current])))
(and hovering-ego (not= :main current))
(-> entities
(assoc-in [:cursor :override] (or (:cursor mouse-override) (when (#{:main :active-main} (get-in entities [:cursor :last])) :active-main)))
(assoc-in [:cursor :active] true))