Progress on ending.

This commit is contained in:
2015-05-16 11:04:28 -07:00
parent 8cf69e5b77
commit 772c3da3f6
34 changed files with 738 additions and 10 deletions

View File

@@ -622,8 +622,8 @@
old-music (get-music (get-in entities [:room :music]) (get-in entities [:state :time]))
entities (as-> entities e
(assoc-in e [:room] (get-in entities [:rooms new-background]))
(if between (between screen e) e)
(assoc-in e [:room :entities :ego] ego)
(if between (between screen e) e)
(assoc-in e [:state :last-room] new-background)
(assoc-in e [:tweens :fade-in] (tween/tween :fade-in screen [:fade :opacity] 1.0 0.0 time))
(if-not (get-in entities [:cam :paused?])

View File

@@ -5,6 +5,7 @@
[advent.screens.items :as items]
[advent.utils :as utils]
[advent.pathfind]
[advent.tween :as tween]
[clojure.zip :as zip]
[play-clj.core :refer :all]
[play-clj.ui :refer :all]
@@ -96,6 +97,70 @@
((rand-nth [listen-1 listen-2 listen-3]) entities))
(defn explode [entities]
(actions/run-action entities
(begin [this screen entities]
(-> entities
(update-in [:room :entities :bloodclot] #(actions/start-animation screen % :explode))
(update-in [:room :entities] dissoc :bloodclot-head)
(assoc-in [:room :entities :ego :facing] :right)
(update-in [:room :entities :ego] #(actions/start-animation screen % :crawl))))
(continue [this screen entities]
(if (= 170 (get-in entities [:room :entities :bloodclot :current-frame-index]))
(particle-effect! (get-in entities [:room :entities :grow-explode]) :start))
(let [move-speed (* 0.17
(/ (:delta-time screen)
(/ 1.0 60.0)))
entities (update-in entities [:room :entities :ego :x] #(max 80 (- % move-speed)))]
(if (= 80 (get-in entities [:room :entities :ego :x]))
(update-in entities [:room :entities :ego] #(actions/start-animation screen % :crawl-hide))
entities )))
(done? [this screen entities]
(= (get-in entities [:room :entities :bloodclot :current-frame-index]) 176))
(terminate [this screen entities]
(-> entities
(update-in [:room :entities] dissoc :bloodclot)
(assoc-in [:tweens :flash] (tween/tween :flash screen [:white-fade :opacity] 0.0 1.0 0.2 :ease tween/ease-in-cubic))))
(can-skip? [this screen entities]
false))
(actions/run-action entities
(begin [this screen entities]
entities)
(continue [this screen entities]
entities)
(done? [this screen entities]
(not (get-in entities [:tweens :flash])))
(terminate [this screen entities]
entities)
(can-skip? [this screen entities]
false))
(actions/run-action entities
(begin [this screen entities]
(assoc-in entities [:tweens :flash] (tween/tween :flash screen [:white-fade :opacity] 1.0 0.0 4.0 :ease tween/ease-in-cubic)))
(continue [this screen entities]
entities)
(done? [this screen entities]
(not (get-in entities [:tweens :flash])))
(terminate [this screen entities]
(update-in entities [:room :entities :ego] dissoc :stand-override))
(can-skip? [this screen entities]
false)))
(defn win []
(actions/get-script entities
(actions/do-dialogue entities
@@ -103,13 +168,17 @@
:ego "I have this potion which will make me as strong as you!"
:bloodclot-head "What?!"
:bloodclot-head "Give it here!")
(actions/transition-background entities :space [200 45])
(actions/transition-background entities :space [200 45] :between (fn [s e]
(-> e
(assoc-in [:room :entities :ego :stand-override] :crawl-stand)
(update-in [:room :entities :ego] #(actions/start-animation s % :crawl-stand)))
))
(actions/do-dialogue entities
:bloodclot-head "Yes!"
:bloodclot-head "Ultimate power is mine!"
:bloodclot-head "If I drink this entire bottle, I'll be as powerful as a god!")
(actions/remove-entity entities :bloodclot-head)
#_(particle-effect! (get-in @entities [:room :entities :blowup] ) :start)
(actions/play-animation entities :bloodclot :explode)
(Thread/sleep 15000)))
(explode entities)
(actions/play-animation entities :ego :standup)
(Thread/sleep 15000)
))

View File

@@ -182,7 +182,8 @@
bloodclot-explode (utils/make-anim "space/bloodclot-explode.png" [106 165] 0.075 [0 0 0 0 0 0 0 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 5 5 5 4 4 4 4 5 5 5 5 5 4 4 4 4 5 5 4 4 4 4 5 5 5 4 5 5 5 5 5 5 5 5 6 5 5 5 5 6 6 5 5 5 5 5 5 5 6 6 6 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 7 6 7 7 5 6 6 6 6 6 7 7 7 7 6 6 6 6 6 6 6 6 6 6 7 7 7 7 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 9 10 11 12 13 14 15 16 17 18 19])
bullet (utils/make-anim "space/bullet.png" [24 24] 0.0075 [0 1 2 0 1 2 0 1 2 0 1 2 0 1 2 3 3 3 4 4 5 5 6 5 4 7])
effect (particle-effect "space/appear")
blowup-effect (particle-effect "space/blowup")]
blowup-effect (particle-effect "space/blowup")
grow-explode (particle-effect "space/grow-explode")]
(rooms/make :music :fight
:interactions
{}
@@ -192,6 +193,9 @@
:entities {:appear (assoc effect
:x 240 :y 50
:baseline 200)
:grow-explode (assoc grow-explode
:x 240 :y 130
:baseline 200)
:blowup (assoc blowup-effect
:x 225 :y 175
:baseline 240)

View File

@@ -364,7 +364,11 @@ void main()
axe (utils/make-anim "ego/axe.png" [60 70] 0.10 (flatten [1 1 1 1 1 0 0 0 1 1 1 1 1 0 0 0 0 (range 7)]))
axe-wood (utils/make-anim "ego/axe-wood.png" [60 70] 0.10 (flatten [1 1 1 1 1 0 0 0 1 1 1 1 1 0 0 0 0 (range 11)]))
suspended (utils/make-anim "ego/suspended.png" [18 36] 0.10 [0])
suspended-talk (utils/make-anim "ego/suspended.png" [18 36] 0.20 [0 1])
suspended-talk (utils/make-anim "ego/suspended.png" [18 36] 0.20 (range 7))
crawl (utils/make-anim "ego/crawl.png" [39 25] 0.2 (range 4))
crawl-stand (utils/make-anim "ego/crawl.png" [39 25] 0.2 [0])
crawl-hide (utils/make-anim "ego/crawl.png" [39 25] 0.1 (flatten [(repeat 10 3) (range 4 7) (repeat 50 6) (reverse (range 4 7) ) (repeat 20 3)]))
standup (utils/make-anim "ego/standup.png" [45 55] 0.2 (range 5))
ego {:right {:walk walk-right
:stand stand-anim
@@ -411,6 +415,10 @@ void main()
:axe-wood axe-wood
:suspended suspended
:suspended-talk suspended-talk
:crawl crawl
:crawl-stand crawl-stand
:crawl-hide crawl-hide
:standup standup
}
:left {:walk (utils/flip walk-right)
:stand (utils/flip stand-anim)
@@ -448,6 +456,10 @@ void main()
:axe-wood (utils/flip axe-wood)
:suspended (utils/flip suspended)
:suspended-talk (utils/flip suspended-talk)
:crawl (utils/flip crawl)
:crawl-stand (utils/flip crawl-stand)
:crawl-hide (utils/flip crawl-hide)
:standup (utils/flip standup)
}
:baseline (- 240 (last start-pos))
:facing :right
@@ -534,6 +546,10 @@ void main()
:anim-merges {(get-in ego [:right :shock]) {:origin-x 15}
(get-in ego [:left :swing-shovel]) {:origin-x 26}
(get-in ego [:right :swing-shovel]) {:origin-x 26}
(get-in ego [:right :standup]) {:origin-x 32}
(get-in ego [:right :crawl]) {:origin-x 32}
(get-in ego [:right :crawl-hide]) {:origin-x 32}
(get-in ego [:right :crawl-stand]) {:origin-x 32}
(get-in ego [:right :axe]) {:origin-x 17}
(get-in ego [:right :axe-wood]) {:origin-x 17}
(get-in ego [:left :love]) {:origin-x 36}