another candle.

This commit is contained in:
2015-07-26 20:28:32 -07:00
parent 8200f4e43f
commit b09f530c54
8 changed files with 76 additions and 28 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,22 @@
<?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>
<dict>
<key>duration</key>
<real>1</real>
</dict>
</array>
</plist>

View File

@@ -26,7 +26,7 @@
(if (= :main cursor) (if (= :main cursor)
(:script entity) (:script entity)
(when-let [scripts (:scripts entity)] (when-let [scripts (:scripts entity)]
(scripts (:value cursor)))))}))) (or (scripts (:value cursor)) (scripts :default)))))})))
(defn make [& {:keys [collision interactions entities] :as params}] (defn make [& {:keys [collision interactions entities] :as params}]
(let [interactions-as-list (for [[id spec] interactions] (let [interactions-as-list (for [[id spec] interactions]
(merge spec {:mouse-in? (fn [_ x y] (merge spec {:mouse-in? (fn [_ x y]
@@ -35,7 +35,7 @@
(if (= :main cursor) (if (= :main cursor)
(:script spec) (:script spec)
(when-let [scripts (:scripts spec)] (when-let [scripts (:scripts spec)]
(scripts (:value cursor))))) (or (scripts (:value cursor)) (scripts :default)))))
:id id})) :id id}))
entities (into {} (for [[id entity] entities] entities (into {} (for [[id entity] entities]
[id (make-entity id entity)]))] [id (make-entity id entity)]))]

View File

@@ -24,11 +24,11 @@
(defn explore-chest [entities] (defn explore-chest [entities]
(cond (cond
(actions/has-item? entities :slingshot) (actions/has-item? entities :slingshot)
(do (actions/walk-to entities :ego [152 95]) (do (actions/walk-to entities :ego [152 95] :face :right)
(actions/talk entities :ego "It's empty now.")) (actions/talk entities :ego "It's empty now."))
(get-in @entities [:state :broke-lock?]) (get-in @entities [:state :broke-lock?])
(do (do
(actions/walk-to entities :ego [152 95]) (actions/walk-to entities :ego [152 95] :face :right)
(actions/talk entities :ego "Let's see what's inside now.") (actions/talk entities :ego "Let's see what's inside now.")
(actions/play-animation entities :ego :reach) (actions/play-animation entities :ego :reach)
(actions/do-dialogue entities (actions/do-dialogue entities
@@ -40,7 +40,7 @@
(actions/give entities :slingshot)) (actions/give entities :slingshot))
:else :else
(do (do
(actions/walk-to entities :ego [152 95]) (actions/walk-to entities :ego [152 95] :face :right)
(actions/talk entities :ego "Maybe my stuff is in here...") (actions/talk entities :ego "Maybe my stuff is in here...")
(actions/play-animation entities :ego :reach) (actions/play-animation entities :ego :reach)
(actions/talk entities :ego "It's locked tight!")))) (actions/talk entities :ego "It's locked tight!"))))
@@ -48,28 +48,54 @@
(defn make [screen] (defn make [screen]
(rooms/make :music {:day :secret-hideout :night :secret-hideout} (let [candle-flame (utils/make-anim "inside-stash/candle.png" [4 4] 0.1 (range 4))
:interactions candle-aura (utils/make-anim (texture "inside-house/candle-aura.png") [27 27] 0.2 [0 1 2 3 2 1] )
{:left-dir {:box [91 60 125 140] ]
(rooms/make :music {:day :secret-hideout :night :secret-hideout}
:interactions
{:left-dir {:box [91 60 125 140]
:script (actions/get-script
entities
(actions/walk-straight-to entities :ego [118 96])
(actions/transition-background entities :outside-jail [200 97])
(actions/walk-straight-to entities :ego [167 100]))
:cursor :left}
:candle {:box [160 130 170 140]
:script (actions/get-script :script (actions/get-script
entities entities
(actions/walk-straight-to entities :ego [118 96]) (actions/talk entities :ego "Just a candle."))
(actions/transition-background entities :outside-jail [200 97]) :scripts {:note-1 (actions/get-script entities
(actions/walk-straight-to entities :ego [167 100])) (actions/talk entities :ego "Why would I want to burn Gandarf's note?"))
:cursor :left} :note-2 (actions/get-script entities
:chest {:box [151 107 180 124] (actions/talk entities :ego "Why would I want to burn Gandarf's note?"))
:script (actions/get-script entities (explore-chest entities)) :recipe (actions/get-script entities
:scripts {:sword (actions/get-script entities (actions/talk entities :ego "There's not enough room to swing my sword here.")) (actions/walk-to entities :ego [152 95] :face :right)
:crowbar (actions/get-script entities (actions/play-animation entities :ego :reach)
(bust-chest entities))}}} (actions/remove-item entities :recipe)
:layers [(assoc (texture "inside-stash/background.png") :x 0 :y 0 :baseline 0 :night-profile :none)] (actions/give entities :ash)
:entities {:lid (assoc (texture "inside-stash/lid.png") (actions/talk entities :ego "It burned up into ash."))
:x 156 :y 116 :baseline 125 :night-profile :none) :default (actions/get-script entities
} (actions/talk entities :ego "Momma always told me not to play with fire."))}}
:collision "inside-stash/collision.png" :chest {:box [151 107 180 124]
:scale-fn (utils/scaler-fn-with-baseline 110 0.10 1.00) :script (actions/get-script entities (explore-chest entities))
:start-pos [143 96] :scripts {:sword (actions/get-script entities (actions/talk entities :ego "There's not enough room to swing my sword here."))
:apply-state (fn [_ entities] :crowbar (actions/get-script entities
(if (get-in entities [:state :broke-lock?]) (bust-chest entities))}}}
(update-in entities [:room :entities] #(dissoc % :lid)) :layers [(assoc (texture "inside-stash/background.png") :x 0 :y 0 :baseline 0 :night-profile :none)]
entities)))) :entities {:lid (assoc (texture "inside-stash/lid.png")
:x 156 :y 116 :baseline 125 :night-profile :none)
:candle-flame (assoc (animation->texture screen candle-flame)
:x 165 :y 135 :baseline 1
:anim candle-flame
:anim-start 0
:night-profile :none)
:candle-aura (assoc (animation->texture screen candle-aura) :x 166 :y 138 :baseline 2 :additive? true :origin-x 13 :origin-y 13 :opacity 0.5 :anim candle-aura :anim-start 0 :night-profile :none)
}
:collision "inside-stash/collision.png"
:scale-fn (utils/scaler-fn-with-baseline 110 0.10 1.00)
:start-pos [143 96]
:apply-state (fn [_ entities]
(if (get-in entities [:state :broke-lock?])
(update-in entities [:room :entities] #(dissoc % :lid))
entities)))))