inventory item for song.
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
[advent.actions :as actions]
|
||||
[advent.screens.dialogue :as dialogue]
|
||||
[advent.utils :as utils]
|
||||
[advent.screens.rooms :as rooms]
|
||||
[advent.tween :as tween]
|
||||
[advent.tween :as tween]
|
||||
[clojure.core.async :refer [put! <! <!! >! >!! chan go thread take! alts!!]])
|
||||
@@ -283,7 +284,7 @@
|
||||
(done? [this screen entities]
|
||||
(animation! (find-animation (get-in entities [:room :entities target-id ]) anim)
|
||||
:is-animation-finished
|
||||
(- (:total-time screen) (get-in entities [:room :entities target-id :anim-start]))))
|
||||
(- (:total-time screen) (doto (get-in entities [:room :entities target-id :anim-start]) println))))
|
||||
|
||||
(terminate [this screen entities]
|
||||
(if continue?
|
||||
@@ -964,3 +965,55 @@
|
||||
(actions/talk entities :ego (first msgs) :anim :squat-talk :stop? false)
|
||||
(Thread/sleep 200)
|
||||
(recur entities (rest msgs)))))
|
||||
|
||||
(defn wait [entities time]
|
||||
(let [initial-time (atom nil)]
|
||||
(run-action entities
|
||||
(begin [this screen entities]
|
||||
(reset! initial-time (:total-time screen))
|
||||
entities)
|
||||
|
||||
(continue [this screen entities] entities)
|
||||
|
||||
(done? [this screen entities]
|
||||
(> (* 1000 (- (:total-time screen)
|
||||
@initial-time))
|
||||
time))
|
||||
|
||||
(terminate [this screen entities]
|
||||
entities)
|
||||
(skip-type [this screen entities]
|
||||
:none))))
|
||||
|
||||
(defn play-safe [entities]
|
||||
(let [safe-song-anim (utils/make-anim-seq "safe-song/safe-song" [100 35] 0.05 (flatten
|
||||
[
|
||||
[1 2 3]
|
||||
(repeat 2 [
|
||||
[5 6 7 8 8 7 6 6 6 6 6]
|
||||
(map (partial + 4) [5 6 7 8 8 7 6 6 6 6 6])
|
||||
(map (partial + 8) [5 6 7 8 8 7 6 6 6 6 6])
|
||||
(map (partial + 12) [5 6 7 8 8 7 6 6 6 6 6])
|
||||
18 18 18 18
|
||||
(map (partial + 16) [5 6 7 8 8 7 6 6 6 6 6])
|
||||
(repeat 45 22)])
|
||||
|
||||
[22 22 22 22 22 22 22 22 26 27 28]
|
||||
|
||||
]))]
|
||||
(Thread/sleep 200)
|
||||
(add-entity entities :safe-song
|
||||
(rooms/make-entity :safe-song
|
||||
(assoc (utils/get-texture "safe-song/safe-song-1")
|
||||
:x 130
|
||||
:y 120
|
||||
:baseline 241
|
||||
:anim nil
|
||||
:anim-start 0
|
||||
:play safe-song-anim)))
|
||||
|
||||
(begin-animation entities :safe-song :play)
|
||||
(wait entities 100)
|
||||
(play-sound entities "safe-sound.ogg" 0.1 false)
|
||||
(wait entities 10000)
|
||||
(remove-entity entities :safe-song)))
|
||||
|
||||
Reference in New Issue
Block a user