openable window.
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
[advent.actions :as actions]
|
||||
[advent.screens.items :as items]
|
||||
[advent.utils :as utils]
|
||||
[advent.tween :as tween]
|
||||
[clojure.zip :as zip]
|
||||
[play-clj.core :refer :all]
|
||||
[play-clj.ui :refer :all]
|
||||
@@ -136,6 +137,19 @@
|
||||
(and (actions/has-item? entities :teddy)
|
||||
(not (get-in @entities [:state :allowed-to-keep-teddy?]))))
|
||||
|
||||
(defn choose-correct-blind-state [e]
|
||||
(if (get-in e [:state :opened-blinds?])
|
||||
(-> e
|
||||
(assoc-in [:room :entities :closed-blinds :opacity] 0.0)
|
||||
(assoc-in [:room :entities :open-blinds :opacity] 1.0)
|
||||
(assoc-in [:room :entities :darken :opacity] 0.0)
|
||||
(assoc-in [:room :entities :glow :opacity] 0.25))
|
||||
(-> e
|
||||
(assoc-in [:room :entities :closed-blinds :opacity] 1.0)
|
||||
(assoc-in [:room :entities :open-blinds :opacity] 0.0)
|
||||
(assoc-in [:room :entities :darken :opacity] 0.4)
|
||||
(assoc-in [:room :entities :glow :opacity] 0.0))))
|
||||
|
||||
(defn make [screen]
|
||||
(let [shopkeep-sheet (texture! (texture "inside-antique/shopkeep-talk.png") :split 18 21)
|
||||
shopkeep-stand (animation 0.1 (for [i (flatten [(repeat 30 0) 1 (repeat 50 0) 1 0 1 0 1])]
|
||||
@@ -191,9 +205,29 @@
|
||||
(return-teddy entities))
|
||||
:portrait (actions/get-script entities
|
||||
(return-portrait entities))}}
|
||||
:window {:box [210 125 256 183]
|
||||
:window {:box [195 121 256 190]
|
||||
:script (actions/get-script entities
|
||||
(actions/talk entities :ego "It's a nice, big window."))
|
||||
|
||||
(actions/walk-to entities :ego [207 68])
|
||||
(actions/play-animation entities :ego :reach)
|
||||
(actions/update-state entities (fn [s] (assoc s :opened-blinds? (not (:opened-blinds? s)))))
|
||||
(actions/update-entities entities (fn [screen e]
|
||||
(if (get-in e [:state :opened-blinds?])
|
||||
(-> e
|
||||
(assoc-in [:room :entities :closed-blinds :opacity] 0.0)
|
||||
(assoc-in [:room :entities :open-blinds :opacity] 1.0)
|
||||
(assoc-in [:tweens :fade-darken-out]
|
||||
(tween/tween :fade-darken-out screen [:room :entities :darken :opacity] 0.4 0.0 0.75 :ease tween/ease-out-quadratic))
|
||||
(assoc-in [:tweens :fade-glow-in]
|
||||
(tween/tween :fade-glow-in screen [:room :entities :glow :opacity] 0.0 0.3 0.75 :ease tween/ease-out-quadratic)))
|
||||
(-> e
|
||||
(assoc-in [:room :entities :closed-blinds :opacity] 1.0)
|
||||
(assoc-in [:room :entities :open-blinds :opacity] 0.0)
|
||||
(assoc-in [:tweens :fade-darken-in]
|
||||
(tween/tween :fade-darken-in screen [:room :entities :darken :opacity] 0.0 0.4 0.75 :ease tween/ease-out-quadratic))
|
||||
(assoc-in [:tweens :fade-glow-out]
|
||||
(tween/tween :fade-glow-out screen [:room :entities :glow :opacity] 0.3 0.0 0.75 :ease tween/ease-out-quadratic)))))
|
||||
:use-screen? true))
|
||||
:scripts {:portrait (actions/get-script entities
|
||||
(actions/walk-to entities :ego [142 49] :face :left)
|
||||
(actions/play-animation entities :ego :hold-up-to-window)
|
||||
@@ -220,8 +254,9 @@
|
||||
}
|
||||
:layers [(assoc (texture "inside-antique/background.png") :x 0 :y 0 :baseline 0)
|
||||
(assoc (texture "inside-antique/desk.png") :x 0 :y 0 :baseline 113)
|
||||
|
||||
(assoc (texture "inside-antique/fg.png") :x 0 :y 0 :baseline 320 :parallax 1.5)
|
||||
(assoc (texture "inside-antique/glow.png") :x 0 :y 0 :baseline 240 :additive? true :opacity 0.3)]
|
||||
]
|
||||
:entities {:shopkeep (actions/start-animation screen (assoc (animation->texture screen shopkeep-stand) :x 148 :y 122 :baseline 112
|
||||
:stand shopkeep-stand
|
||||
:scale-x 1.6
|
||||
@@ -248,6 +283,10 @@
|
||||
(actions/get-script entities
|
||||
(actions/talk entities :shopkeep "No thanks, sonny."))))
|
||||
:stand)
|
||||
:glow (assoc (texture "inside-antique/glow.png") :x 0 :y 0 :baseline 240 :additive? true :opacity 0.3)
|
||||
:closed-blinds (assoc (texture "inside-antique/closed-blinds.png") :x 0 :y 0 :baseline 0 :opacity 1.0)
|
||||
:open-blinds (assoc (texture "inside-antique/open-blinds.png") :x 0 :y 0 :baseline 0 :opacity 0.0)
|
||||
:darken (assoc (texture "inside-antique/darken.png") :x 0 :y 0 :baseline 321 :opacity 0.4 )
|
||||
:beard (assoc (animation->texture screen beard)
|
||||
:anim beard
|
||||
:anim-start 0
|
||||
@@ -318,6 +357,8 @@
|
||||
|
||||
(if (actions/has-item? entities :portrait )
|
||||
entities
|
||||
(assoc-in entities [:room :entities :portrait] (get-in entities [:room :portrait])))))
|
||||
(assoc-in entities [:room :entities :portrait] (get-in entities [:room :portrait])))
|
||||
(choose-correct-blind-state entities)
|
||||
))
|
||||
:scale-fn (utils/scaler-fn-with-baseline 110 0.10 1.75)
|
||||
:start-pos [222 3])))
|
||||
|
||||
@@ -1145,7 +1145,7 @@ void main()
|
||||
:on-render
|
||||
(fn [{:keys [^FitViewport viewport] :as screen} [entities]]
|
||||
(.apply viewport)
|
||||
(render! screen [(:label entities)])
|
||||
#_(render! screen [(:label entities)])
|
||||
entities)
|
||||
|
||||
:on-resize
|
||||
|
||||
Reference in New Issue
Block a user