started process of night time exclusions.

This commit is contained in:
2014-12-27 22:59:50 -08:00
parent b20d8528ea
commit 8890961114
4 changed files with 37 additions and 23 deletions

View File

@@ -11,10 +11,11 @@
[play-clj.ui :refer :all]
[play-clj.utils :refer :all]
[play-clj.g2d :refer :all]))
(defn remove-lock [entities]
(-> entities
(update-in [:room :interactions]
(fn [i] (remove #(= :lock (:id %)) i)))
(utils/remove-interaction :lock)
(assoc-in [:room :collision] (get-in entities [:room :collision-free]))))
(defn open-lock [entities]

View File

@@ -119,6 +119,12 @@
(get-in @entities [:state :wants-toy]) (do-wants-toy-conversation entities)
:else (do-initial-peddler-conversation entities)))
(defn make-night [entities]
(-> entities
(update-in [:room :entities] #(dissoc % :peddler))
(update-in [:room :entities] #(dissoc % :balloons))
(utils/remove-interaction :wares)))
(defn make [screen]
(let [peddler-sheet (texture! (texture "outside-castle/peddler-talk.png" ) :split 18 36)
peddler-talk (animation 0.18 (for [i (flatten [2 3 2 3 2 3 6 1 0 1 0 1 0 1 0 1 2 3 2 3 2 3 6 4 5 4 5 4 5 4 5])]
@@ -166,31 +172,30 @@
(actions/talk entities :ego "Hey! Carrots.")
(actions/play-animation entities :ego :squat)
(actions/talk entities :ego "No one will notice one missing.")
(actions/give entities :carrot))))}
:peddler {:box [110 90 128 146]
:script (actions/get-script
entities
(walk-to-peddler entities)
(do-peddler-dialogue 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.")))}}
(actions/give entities :carrot))))}}
:layers {:day [(assoc (texture "outside-castle/background.png") :x 0 :y 0 :baseline 0)]
:night [(assoc (texture "outside-castle/background-dark.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
:talk peddler-talk :stand peddler-stand
:talk-color (color 1.0 0.9 0.4 1.0))
:talk-color (color 1.0 0.9 0.4 1.0)
:script (actions/get-script
entities
(walk-to-peddler entities)
(do-peddler-dialogue 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."))))
:stand)
:steer (actions/start-animation screen (assoc (animation->texture screen steer-stand) :x 203 :y 155 :baseline 80
@@ -237,4 +242,8 @@
:baseline 240)}
:collision "outside-castle/collision.png"
:scale-fn (utils/scaler-fn-with-baseline 110 0.10 1.00)
:start-pos [310 80])))
:start-pos [310 80]
:apply-state (fn [entities]
(if (= :night (get-in entities [:state :time]))
(make-night entities)
entities)))))

View File

@@ -298,6 +298,7 @@
{:object nil
:active? true
:last-room :outside-house
:time :day
:obtained-items #{}
:inventory []
:clues #{}

View File

@@ -111,3 +111,6 @@
(assoc-in entities [:cursor :override] (:cursor mouse-override))
(assoc-in entities [:cursor :override] nil)))
entities))
(defn remove-interaction [entities id]
(update-in entities [:room :interactions] (fn [i] (remove #(= id (:id %)) i))))