jail scene coming together

This commit is contained in:
2014-12-27 15:15:25 -08:00
parent 78f183d147
commit 04955000df
5 changed files with 64 additions and 4 deletions

View File

@@ -252,6 +252,13 @@
(assoc entities :actions {:channel channel :current current :started? false :script-running? (get-in entities [:actions :script-running?])}))))
(defn update-from-hotspots [screen entities]
(if-let [hot-spots (get-in entities [:room :hotspots])]
(if-let [hotspot-hit (first (filter #((apply zone/box (:box %)) (get-in entities [:room :entities :ego :x]) (get-in entities [:room :entities :ego :y])) hot-spots))]
((:fn hotspot-hit) screen entities)
entities)
entities))
(defn update-cursor [screen {{:keys [current override last]} :cursor :as entities}]
(let [new-current (or override current)]
(when-not (= new-current
@@ -349,6 +356,7 @@
(clear!)
(let [entities (update-cursor screen entities)
entities (update-from-script screen entities)
entities (update-from-hotspots screen entities)
entities (assoc-in entities [:room :entities :ego :last-frame] (get-in entities [:room :entities :ego :object]))
entities (update-in entities [:room :entities] (fn [entities]
(into entities