Progress on ending.
This commit is contained in:
@@ -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)
|
||||
))
|
||||
|
||||
Reference in New Issue
Block a user