A totally different approach to night.

This commit is contained in:
2015-05-05 08:41:30 -07:00
parent b8c47d674d
commit e233c67004
5 changed files with 212 additions and 27 deletions

View File

@@ -482,7 +482,7 @@
entities)
(if (and (not (actions/has-item? entities :walkie-talkies))
(actions/has-obtained? entities :walkie-talkies))
entities
(update-in entities [:room :entities] dissoc :walkie-talkie)
(update-in entities [:room :entities] dissoc :walkie-talkie))
(if (#{:night :sunrise} (get-in entities [:state :time]))
(make-night entities)

View File

@@ -16,20 +16,37 @@
(defn dawn-fade [screen entities]
(as-> entities entities
(assoc-in entities
[:tweens :dawn-fade]
(tween/tween :dawn-fade screen [:dawn :opacity] 1.0 0.0 12.5))
(assoc-in entities
[:dawn :opacity]
1.0)))
(defn dawn-fade [entities]
(actions/run-action entities
(begin [this screen entities]
(-> entities
(assoc-in [:tweens :dawn-r] (tween/tween :dawn-r screen [:time-profiles :default :r] :current 0.63 50.0 :entities entities))
(assoc-in [:tweens :dawn-g] (tween/tween :dawn-g screen [:time-profiles :default :g] :current 0.36 50.0 :entities entities))
(assoc-in [:tweens :dawn-b] (tween/tween :dawn-b screen [:time-profiles :default :b] :current 0.23 50.0 :entities entities))
(assoc-in [:tweens :hue-amount-v] (tween/tween :hue-amount-v screen [:time-profiles :default :hue-amount] :current 0.0 50.0 :entities entities))
(assoc-in [:tweens :multiply-amount-v] (tween/tween :multiply-amount-v screen [:time-profiles :default :multiply-amount] :current 0.0 50.0 :entities entities))
(assoc-in [:tweens :dawn-r-s] (tween/tween :dawn-r-s screen [:time-profiles :sprite :r] :current 0.63 50.0 :entities entities))
(assoc-in [:tweens :dawn-g-s] (tween/tween :dawn-g-s screen [:time-profiles :sprite :g] :current 0.36 50.0 :entities entities))
(assoc-in [:tweens :dawn-b-s] (tween/tween :dawn-b-s screen [:time-profiles :sprite :b] :current 0.23 50.0 :entities entities))
(assoc-in [:tweens :hue-amount-v-s] (tween/tween :hue-amount-v-s screen [:time-profiles :sprite :hue-amount] :current 0.0 50.0 :entities entities))
(assoc-in [:tweens :multiply-amount-v-s] (tween/tween :multiply-amount-v-s screen [:time-profiles :sprite :multiply-amount] :current 0.0 50.0 :entities entities)))
)
(continue [this screen entities]
entities)
(done? [this screen entities]
true)
(terminate [this screen entities]
entities)))
(defn walk-to-castle [entities dawn?]
(actions/walk-to entities :ego [0 80])
(actions/walk-straight-to entities :ego [-20 80])
(if dawn?
(actions/transition-background entities :outside-castle [330 80] :between dawn-fade)
(actions/transition-background entities :outside-castle [330 80])
(actions/transition-background entities :outside-castle [330 80]))
(actions/walk-straight-to entities :ego [310 80]))
@@ -81,6 +98,7 @@
(if (is-ready-for-slingshot entities)
(do
(actions/walk-to entities :ego [141 90] :face :right)
(dawn-fade entities)
(actions/talk entities :ego "Here goes!")
(actions/play-animation entities :ego :reach-start :stop? false)
(magic entities)
@@ -359,14 +377,14 @@
(assoc (texture "outsidehouse/background-trees.png") :x 0 :y 0 :baseline 44)
(assoc (texture "outsidehouse/fg1.png") :x 0 :y 0 :baseline 1000 :parallax 1.5)
(assoc (texture "outsidehouse/fg2.png") :x (- 320 55) :y 0 :baseline 1000 :parallax 1.5)
#_(assoc (texture "outsidehouse/fg1.png") :x 0 :y 0 :baseline 1000 :parallax 1.5)
#_(assoc (texture "outsidehouse/fg2.png") :x (- 320 30) :y 0 :baseline 1000 :parallax 1.5)]
:night [(assoc (texture "outsidehouse/background-dark.png") :x 0 :y 0 :baseline 0)
(assoc (texture "outsidehouse/house-dark.png") :x 0 :y 0 :baseline 122)
(assoc (texture "outsidehouse/fence-dark.png") :x 0 :y 0 :baseline 93)
(assoc (texture "outsidehouse/fg2.png") :x (- 320 55) :y 0 :baseline 1000 :parallax 1.5)]
:night [(assoc (texture "outsidehouse/background.png") :x 0 :y 0 :baseline 0)
(assoc (texture "outsidehouse/house.png") :x 0 :y 0 :baseline 122)
(assoc (texture "outsidehouse/fence.png") :x 0 :y 0 :baseline 93)
(assoc (texture "outsidehouse/background-trees-dark.png") :x 0 :y 0 :baseline 44)]}
(assoc (texture "outsidehouse/background-trees.png") :x 0 :y 0 :baseline 44)
(assoc (texture "outsidehouse/fg1.png") :x 0 :y 0 :baseline 1000 :parallax 1.5)
(assoc (texture "outsidehouse/fg2.png") :x (- 320 55) :y 0 :baseline 1000 :parallax 1.5)]}
:entities {:sheep (actions/start-animation screen
(assoc (animation->texture screen sheep-stand) :x 38 :y 160 :baseline 80
:scale-x (scaler [38 160])
@@ -463,6 +481,7 @@
:x 139 :y 73 :baseline 167
:anim cauldron
:anim-start 0
:night-profile :none
:script (actions/get-script entities (actions/talk entities :ego "That's a big cauldron!"))
:scripts put-something-in-cauldron))
:wizard (rooms/make-entity :wizard (common/make-wizard screen {:x 190 :y 78 :baseline 162 :scale-x 1.2 :scale-y 1.2