From 275a679f4703f4714efa52bf9ca1aeafc19f4b50 Mon Sep 17 00:00:00 2001 From: Bryce Covert Date: Sat, 5 Sep 2015 09:34:55 -0700 Subject: [PATCH] openable window. --- .../inside-antique/closed-blinds.png | Bin 0 -> 2420 bytes desktop/resources/inside-antique/darken.png | Bin 0 -> 1523 bytes .../resources/inside-antique/open-blinds.png | Bin 0 -> 2765 bytes .../advent/screens/rooms/inside_antique.clj | 49 ++++++++++++++++-- desktop/src-common/advent/screens/scene.clj | 2 +- 5 files changed, 46 insertions(+), 5 deletions(-) create mode 100644 desktop/resources/inside-antique/closed-blinds.png create mode 100644 desktop/resources/inside-antique/darken.png create mode 100644 desktop/resources/inside-antique/open-blinds.png diff --git a/desktop/resources/inside-antique/closed-blinds.png b/desktop/resources/inside-antique/closed-blinds.png new file mode 100644 index 0000000000000000000000000000000000000000..af5405c733d049b4fb9c6982122bd290b11e030a GIT binary patch literal 2420 zcmbtWe^3*57T?6B7deFhEg%QSPHbyANp=(RgH4HqB!C$RQhuD!iX~Gi3uYpK z5G|QPKx#dLYX>cgRUe*AP^M88_*Sl#Vn&c0??N%%o%-n(2!a^hS;5C9uJ~S}3|?uoW}Hd>#Vp z_4d40tj$ym@oyThv^K|O83{OsFq4@kobE^J)-`9kc0V1+Zb-9{?lS4$j*7T}S~1F%peQ0CM1nv95wGFA${!V~6leg- z7b=lJK0j0xC_u!@Fj`6^XrMr%T=P{M%oJw8iM7}|I`*nB@{_(&rHQ~O(iBIM2iB$_ zI*p`Aa~f%cl**N^L+@xXTxYN={p^i;k++I4=?)UwFcYbVRw^yky@CaS3jzc91j#TqnXn z?~sXJmOJmZW&?o3DYYsj&N?tT*kf=D_ioE@Rvg*jP|b<2m78F6H0@{rEFa1*vYE43 zLmas6uv?7N=O4Lw{Mr3i@s73EHfD^oYmR;?ZkZdn(DK>fa_*bH`99A#v_3nrPhaGD zAKZJ~V08o-AX~m}@joG)(MV(t(a8%L*`GK02LG*T@Jhm02mUCX8Y?=<`*HmK6nS-d zehdDj-fQC9sfpl-{&R`?p_=Xz{nPJ@f_LZT&5mC=);aU6DHvq;``NlaC|_Rexz@97 z{*ed%<)+DA-$#_|--kPbPFKCp+%W3+-hhEi#n6-mh?LmdY$(17P?*$^tM<& zsTs|l@68<@Yo7THXjm=)6sI0fPcD1iDRyxrGVa{V>udIHf5#Txee(%YvB*hcvMwJ> zcDgs)Tm>i&mflUdaP|y!zOr#s-G}wM7@*qeXWfp_k>t+y9ilq1yf~^MOc3FxvTuE)J5;1M)j>~m<5dp3Bo0U0fu#6ZvYf$-7t^7)?koP@b$u@ zv-Nwfr?#F{0o6I3k7FZ}7@(>6_~0H!!K7$QZD_70i^=-b$$?$S{`e0&oPuXEKnB=2 z%=TmyT=&*E=a^X^o~r{C?sfR@+6#}+6d)U*C@*OqncT0ND6Mf|zqaKzFW=AB*4&TD zQ+$8f1Tb%1*zRwWJD1&OvPNFt8nO4xq4RfVe&6`r;B?E|@-w~A$6;d=9WE1>oUOO7 z9YL4wj(F5dQZVr=0NjDY_n%Guqpt^l#N%(Md zWVoTcxu`GUM@NXN{bBqsnadUJu&r%RMy+FCp>qgp@s1Odl^BubYwW&xEWB6A0L4+5 zy263%Y4zU~Kd@x=2iX^!b7lUKUIRYAjU*3m@5I16XH1|IMb&cF1in5V`dJeB7Ql!tDP+>d+`vonmkPzW~neLbw0` literal 0 HcmV?d00001 diff --git a/desktop/resources/inside-antique/darken.png b/desktop/resources/inside-antique/darken.png new file mode 100644 index 0000000000000000000000000000000000000000..69f6f01e2ae0c00fa1b91d14dcc151864d3929c8 GIT binary patch literal 1523 zcmbtUF>ljA7}m-}~No=U3}%4;SZe&T|~M zSX(t495=PX=0E19+5Pw9d&}%`gH~E}gLG&Q1(++@q>cHSi?(qCBYXepC(J-Ik<)C^ zR{fD~5jTxuOgeIX7R_HzSgOJLaoyQ4SE>L?d`D+pameO;1zyDu#AWltCvaW-X|Sc{>M14MLz{Rmo$JOL!*58|5;TD`qKcfU+!C z)Vu<6MwQ()4dxZiNMdVVNRemZB)7wIk7D7uvAPjpL`l#jWH;Fb>s>-g*d;!17=y0! zck0M;ym;|$+^AvQCJvlu*scb|*XIagSi#} literal 0 HcmV?d00001 diff --git a/desktop/resources/inside-antique/open-blinds.png b/desktop/resources/inside-antique/open-blinds.png new file mode 100644 index 0000000000000000000000000000000000000000..907b6e3ce930e05c3ee3fc47f1ab1ab668550761 GIT binary patch literal 2765 zcmcgudsGuw9-f4V0TodcPyxp%uhnFdK*$54!2}CRzy&;DeIy|nBtjk}Ap}G~8edR~ zg)Sf#kzGYafmqatm4}ERD@s}9K(Po&MJXsK2jvlA2Nl~tJf5?=Jv)Egx%bZR`+o0x z=jc|yFBX_CHw6G-fsZ#Q002-dWIl{FM#d<7MFjF%rt%6=10pIWe8;wf?!65ppnQCGyr&P(8vYC2v`M%!h6J0CT{4* zDjX;lF>%2ZE|Du|!{K7@I0YOS=NBZ5ixAR9xDD$;4-Eq$kiaSdsF6fUl?)9N_l}o= z%xAVC9QaN|6~V;4H!6g?6=cg4Fi0U#@IoS)1XAe)5`{vglGlM`BFPmZk|2@`ocv?)Yki~!E254w;Q6Bn*h$r%t76B9#-aUsYQdms{>PKStOh)l*K5_n~- zR3*^hrOMT_3>;V~REXs&u}liiFbYCt(JCemvGlzQ5;>Rqkyxty5GW*MkVYVfNCYAz zk<9q@PFkr7fPXjRlhVqdSUC&@z)D%PLWtxeZ1pS{iQVTF%?KjaF#Hu_Bq@SOj!YOW zfu$-R4ikrbA&A5xBt$R;ri7T_i*a}#nk|}~@ zvdGyg*cvWV$&}$TIml+e%R1=96$r)BnN8=JM7{T$11rR8ShPtYlYs9c%@BXW3Rp;{ zxsYHwo-QJ~;9W&T3Z70ThT??+A=Q;c6NHMwsJIV!(SI932r&wpDVIN#&+HablQYwg z&44UEwi7HxdPspZ%cAC`S^zK}@Zop{X*vcwoA$2pvZ;P~d61Bjn>sJ~8gcjQ?}XK5 z5dTrl;h)MT%_|Q=-M2G!bLaT)Go3QJ>9x}w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K&> zZLO&+U2Xy{xs&G*PU;Aq22h+#Pk5jUdpZss)VgzFV literal 0 HcmV?d00001 diff --git a/desktop/src-common/advent/screens/rooms/inside_antique.clj b/desktop/src-common/advent/screens/rooms/inside_antique.clj index f6759482..c8547340 100644 --- a/desktop/src-common/advent/screens/rooms/inside_antique.clj +++ b/desktop/src-common/advent/screens/rooms/inside_antique.clj @@ -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]))) diff --git a/desktop/src-common/advent/screens/scene.clj b/desktop/src-common/advent/screens/scene.clj index 2ffa653f..d005d354 100644 --- a/desktop/src-common/advent/screens/scene.clj +++ b/desktop/src-common/advent/screens/scene.clj @@ -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