diff --git a/desktop/inv-todo.txt b/desktop/inv-todo.txt index 10af15a0..9624cf9d 100644 --- a/desktop/inv-todo.txt +++ b/desktop/inv-todo.txt @@ -5,7 +5,6 @@ sound duration on android choosing interaction feels wrong - flies hard to touch change hotspots as necessary turn off desk hotspots if you don't have inventory -Fade out needs to start at 100 opacity less common for gandarfs experiment delay in update with label causes jumpiness diff --git a/desktop/src-common/advent/screens/fade.clj b/desktop/src-common/advent/screens/fade.clj index 6c0b45db..ea5360cc 100644 --- a/desktop/src-common/advent/screens/fade.clj +++ b/desktop/src-common/advent/screens/fade.clj @@ -25,7 +25,7 @@ :scale-y 100 :x -1 :y -1 - :opacity 0.0 + :opacity 1.0 :origin-x 0 :origin-y 0)}) diff --git a/desktop/src-common/advent/screens/rooms/outside_house.clj b/desktop/src-common/advent/screens/rooms/outside_house.clj index 6a1ae376..2b79c7a5 100644 --- a/desktop/src-common/advent/screens/rooms/outside_house.clj +++ b/desktop/src-common/advent/screens/rooms/outside_house.clj @@ -646,7 +646,7 @@ :else (do (actions/play-animation entities :door :open) (actions/transition-background entities :inside-house [237 0] :between (fn [s e] - (if (= 1 (rand-int 2)) + (if (= 1 (rand-int 5)) (assoc-in e [:room :entities :experiment] (get-in e [:room :experiment])) e))) (when (get-in @entities [:room :entities :experiment]) diff --git a/desktop/src-common/advent/screens/scene.clj b/desktop/src-common/advent/screens/scene.clj index 45ba6c1e..e593472d 100644 --- a/desktop/src-common/advent/screens/scene.clj +++ b/desktop/src-common/advent/screens/scene.clj @@ -182,7 +182,6 @@ void main () maximum-x (- 320 margin-width) label-width (label! l :get-width) label-right (+ (:x l) (/ label-width 2)) - _ (println label-right) l (cond (> label-right maximum-x) (assoc l :x (- maximum-x label-width)) (< (:x l) minimum-x) (assoc l :x minimum-x) :else l)] @@ -984,15 +983,17 @@ void main () (if (not (get-in entities [:started? :value])) (do (music! (utils/get-current-music entities) :set-volume (utils/current-music-volume (get-in entities [:volume :value]))) (utils/play-music (get-in entities [:musics (actions/get-music (get-in entities [:room :music]) (get-in entities [:state :time]))])) - (assoc entities - :tweens {:fade-in (tween/tween :fade-in screen [:fade :opacity] 1.0 0.0 1.0 :ease tween/ease-in-cubic - :finish #(if (not (get-in % [:state :seen-intro?])) - (do ((actions/get-script % (rooms.dream/do-intro %)) entities) - %) - %)) - :fade-in-music (tween/tween :fade-in-music screen [:volume :value] 0.0 1.0 1.0 :ease tween/ease-in-cubic)} - :started? {:value true - :object nil})) + (-> entities + (assoc + :tweens {:fade-in (tween/tween :fade-in screen [:fade :opacity] 1.0 0.0 1.0 :ease tween/ease-in-cubic + :finish #(if (not (get-in % [:state :seen-intro?])) + (do ((actions/get-script % (rooms.dream/do-intro %)) entities) + %) + %)) + :fade-in-music (tween/tween :fade-in-music screen [:volume :value] 0.0 1.0 1.0 :ease tween/ease-in-cubic)} + :started? {:value true + :object nil}) + (assoc-in [:fade :opacity] 1.0))) entities)) (defn play-sound-if-necessary [screen entities target {:keys [previous-frame-index current-frame-index anim-sound-frames anim x y] :as e :or {anim-sound-frames {}}}] @@ -1907,14 +1908,12 @@ void main () :on-give-item (fn [screen entities {:keys [item]}] - (doto - (-> entities - (update-in [:inv-fsm :pending-states] conj [:acquire item]) - (update-in [:inv-fsm] (fn [{:keys [state state-data] :as fsm}] - (if (and (= state :selected) (= item state-data)) - (update-in fsm [:pending-states] conj [:none state-data]) - (update-in fsm [:pending-states] conj [:none state-data]))))) - (#(println (get-in % [:inv-fsm :pending-states]))))) + (-> entities + (update-in [:inv-fsm :pending-states] conj [:acquire item]) + (update-in [:inv-fsm] (fn [{:keys [state state-data] :as fsm}] + (if (and (= state :selected) (= item state-data)) + (update-in fsm [:pending-states] conj [:none state-data]) + (update-in fsm [:pending-states] conj [:none state-data])))))) :on-remove-item (fn [screen entities {:keys [item]}] diff --git a/desktop/src-common/advent/tween.clj b/desktop/src-common/advent/tween.clj index f0991a6b..4c6ed359 100644 --- a/desktop/src-common/advent/tween.clj +++ b/desktop/src-common/advent/tween.clj @@ -6,8 +6,8 @@ (fn ^double [^double t ^double start ^double delta ^double duration] (let [pct-done (/ t duration) pct-done (Math/pow pct-done power)] - (+ start - (* delta pct-done))))) + (+ start + (* delta pct-done))))) (def ease-linear (ease-in-expo-maker 1.0)) (def ease-in-quadratic (ease-in-expo-maker 2.0)) @@ -42,9 +42,9 @@ (defn ease-out-quadratic ^double [^double t ^double start ^double delta ^double duration] (let [t (/ t duration)] - (unchecked-add (-> (unchecked-subtract 1 delta) + (unchecked-add (-> (unchecked-subtract 0.0 delta) (unchecked-multiply t) - (unchecked-multiply (unchecked-subtract t 2))) + (unchecked-multiply (unchecked-subtract t 2.0))) start))) (defn ease-out-cubic ^double [^double t ^double start ^double delta ^double duration]