From 4ba5457d2eb7ebe2644668466071c38fe012e2d0 Mon Sep 17 00:00:00 2001 From: Bryce Covert Date: Thu, 30 Jul 2015 09:14:36 -0700 Subject: [PATCH] Goon dropping --- desktop/src-common/advent/actions.clj | 21 ++++++++++++------- .../advent/screens/rooms/castle_gate.clj | 10 ++++++--- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/desktop/src-common/advent/actions.clj b/desktop/src-common/advent/actions.clj index 93a57686..cd73316e 100644 --- a/desktop/src-common/advent/actions.clj +++ b/desktop/src-common/advent/actions.clj @@ -338,7 +338,7 @@ (defn get-text-duration [text] (max 1.5 (* (count (s/split text #" ")) 0.5))) -(defn talk [entities target-id text & {:keys [stop? animate? anim]}] +(defn talk [entities target-id text & {:keys [stop? animate? anim wait] :or {wait true}}] (let [initial-time (atom nil) stop? (if (nil? stop?) true stop?) animate? (if (nil? animate?) true animate?)] @@ -371,15 +371,20 @@ (continue [this screen entities] entities) (done? [this screen entities] - (> (- (:total-time screen) - @initial-time) - (get-text-duration text))) + (if wait + (> (- (:total-time screen) + @initial-time) + (get-text-duration text)) + true)) (terminate [this screen entities] - (screen! dialogue/talking-screen :stop-talk :target-id target-id) - (if stop? - (stop screen entities target-id) - entities)) + (if wait + (do + (screen! dialogue/talking-screen :stop-talk :target-id target-id) + (if stop? + (stop screen entities target-id) + entities)) + entities)) (can-skip? [this screen entities] true)))) diff --git a/desktop/src-common/advent/screens/rooms/castle_gate.clj b/desktop/src-common/advent/screens/rooms/castle_gate.clj index 6a6c1978..8589bef2 100644 --- a/desktop/src-common/advent/screens/rooms/castle_gate.clj +++ b/desktop/src-common/advent/screens/rooms/castle_gate.clj @@ -4,6 +4,7 @@ [advent.screens.items :as items] [advent.screens.rooms.common :as common] [advent.utils :as utils] + [advent.screens.dialogue :as dialogue] [advent.tween :as tween] [clojure.zip :as zip] @@ -148,11 +149,13 @@ :script (actions/get-script entities (if (get-in @entities [:tweens :coin-y]) (do - + (actions/talk entities :ego "Hey goon!" :wait false) (actions/update-entities entities (fn [entities] (update-in entities [:tweens] dissoc :coin-y))) (actions/walk-straight-to entities :coin-flip [212 90] :update-baseline? false :speed 3.0) + (screen! dialogue/talking-screen :stop-talk :target-id :ego) + (actions/do-stop entities :ego) (actions/walk-straight-to entities :coin-flip [210 105] :update-baseline? false :speed 1.0) (Thread/sleep 50) @@ -165,7 +168,8 @@ (actions/walk-straight-to entities :coin-flip [192 70] :update-baseline? false :speed 0.5) (Thread/sleep 50) (actions/walk-straight-to entities :coin-flip [185 44] :update-baseline? false :speed 0.5) - (actions/update-state entities (fn [s] (assoc s :has-dropped-coin? true)))) + (actions/update-state entities (fn [s] (assoc s :has-dropped-coin? true))) + (actions/talk entities :frankie "You made me lose my coin, Dipstick!")) (actions/talk entities :ego "Hey goon!"))) :night-profile :sprite :anim-start 0 @@ -196,7 +200,7 @@ walkie-visible (animation 1.0 [(last (utils/split-texture "castle-gate/throw-walkie.png" [205 136] (range 9)))]) walkie-invisible (animation 1.0 [(first (utils/split-texture "castle-gate/throw-walkie.png" [205 136] (range 9)))])] (rooms/make :music {:day :town-2 :night :night} - :timers {:taunt [4.0 8.0 flip-coin]} + :timers {:taunt [4.0 11.0 flip-coin]} :interactions {:right-dir {:box [300 40 320 83] :script (actions/get-script entities (actions/walk-to entities :ego [301 46] :face :right)