kind of nice sequence.

This commit is contained in:
2015-02-18 12:52:55 -08:00
parent c7591dd3f2
commit 0c8dc65575
6 changed files with 49 additions and 14 deletions

View File

@@ -469,11 +469,12 @@
music
(time music)))
(defn transition-music [entities new-music]
(let [current-volume (atom 1.0)]
(defn transition-music [entities new-music & {:keys [duration]}]
(let [current-volume (atom 1.0)
duration (or duration 2.0)]
(run-action entities
(begin [this screen entities]
(assoc-in entities [:tweens :fade-out-music] (utils/tween :fade-out-music screen [:volume :value] 1.0 0.0 2.0)))
(assoc-in entities [:tweens :fade-out-music] (utils/tween :fade-out-music screen [:volume :value] 1.0 0.0 duration)))
(continue [this screen entities]
entities)

View File

@@ -14,11 +14,14 @@
(defn bloodclot-appear [entities]
(actions/run-action entities
(begin [this screen entities]
(particle-effect! (get-in entities [:room :entities :appear]) :reset)
(particle-effect! (get-in entities [:room :entities :appear]) :start)
(sound! (sound "inside-house/disappear.ogg") :play)
(-> entities
(assoc-in [:tweens :bloodclot-head-appear]
(utils/tween :bloodclot-head-appear screen [:room :entities :bloodclot-head :opacity] 0.0 1.0 0.2 :power 4.0))
(utils/tween :bloodclot-head-appear screen [:room :entities :bloodclot-head :opacity] 0.0 1.0 1.0 :power 4.0))
(assoc-in [:tweens :bloodclot-appear]
(utils/tween :bloodclot-appear screen [:room :entities :bloodclot :opacity] 0.0 1.0 0.2 :power 4.0))))
(utils/tween :bloodclot-appear screen [:room :entities :bloodclot :opacity] 0.0 1.0 1.0 :power 4.0))))
(continue [this screen entities]
entities)
@@ -119,8 +122,9 @@
(actions/walk-to entities :ego [85 145] :face :right)
(actions/transition-background entities :space [0 65] :transition-music? false)
(actions/walk-straight-to entities :ego [160 45] :face :right)
(actions/transition-music entities nil)
(bloodclot-appear entities))
(bloodclot-appear entities)
(actions/transition-music entities nil :duration 0.15))
(defn pull-sword [entities]
(actions/play-animation entities :ego :reach)

View File

@@ -37,6 +37,29 @@
(assoc-in e [:tweens :flash] (utils/tween :flash screen [:white-fade :opacity] 0.0 1.0 0.5 :power 3.0))
e))
(defn bloodclot-disappear [entities]
(actions/run-action entities
(begin [this screen entities]
(particle-effect! (get-in entities [:room :entities :appear]) :reset)
(particle-effect! (get-in entities [:room :entities :appear]) :start)
(sound! (sound "inside-house/disappear.ogg") :play)
(-> entities
(assoc-in [:tweens :bloodclot-head-appear]
(utils/tween :bloodclot-head-appear screen [:room :entities :bloodclot-head :opacity] 1.0 0.0 1.0 :power 4.0))
(assoc-in [:tweens :bloodclot-appear]
(utils/tween :bloodclot-appear screen [:room :entities :bloodclot :opacity] 1.0 0.0 1.0 :power 4.0))))
(continue [this screen entities]
entities)
(done? [this screen entities]
(= 0.0 (get-in entities [:room :entities :bloodclot :opacity])))
(terminate [this screen entities]
entities)
(can-skip? [this screen entities]
false)))
(defn swing-at-blergh [entities]
(let [jump-path (bezier (map #(apply vector-2* %) [[35 45] [110 145] [195 180]]))
swing-path (bezier (map #(apply vector-2* %) [[195 180] [205 45]]))
@@ -146,13 +169,17 @@
blergh-swing (utils/make-anim "space/blergh-swing.png" [106 165] 0.1 [0 0 1 2 3 4 ])
blergh-appear (utils/make-anim "space/blergh-appear.png" [106 165] 0.05 (flatten [(range 13) 12 12 12 12 12 12 12 12 12 12 12 12 12 ]))
blergh-grow (utils/make-anim "space/blergh-grow.png" [106 165] 0.10 [0 1 0 1 0 1 0 1 1 1 1 0 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 2 2 2 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 3 3 3 3 3 3 3 3 3 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 5 6 7 8 9 10 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11])
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])]
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")]
(rooms/make :music :fight
:interactions
{}
:layers [(assoc (texture "space/background.png") :x 0 :y 0 :baseline 0)]
:timers {:taunt [10.0 8.0 taunt]}
:entities {:bloodclot-head (assoc (animation->texture screen bloodclot-head-stand-anim)
:entities {:appear (assoc effect
:x 240 :y 50
:baseline 200)
:bloodclot-head (assoc (animation->texture screen bloodclot-head-stand-anim)
:x 195 :y 138 :baseline 195
:opacity 0.0
:anim bloodclot-head-stand-anim
@@ -170,7 +197,8 @@
:appear blergh-appear
:grow blergh-grow
:script (actions/get-script entities (actions/do-dialogue entities :bloodclot-head "Come on! Try and hit me!"))
:script (actions/get-script entities
(actions/do-dialogue entities :bloodclot-head "Come on! Try and hit me!"))
:scripts {:sword (actions/get-script entities
(swing-at-blergh entities)
@@ -189,9 +217,9 @@
:bloodclot-head "Tomorrow, I will return with my legion of goblins."
:bloodclot-head "And THEN the feast will begin."
:bloodclot-head "Starting with his precious Georgia McGorgeous.")
(bloodclot-disappear entities)
(common/go-to-jail entities)
#_(actions/do-dialogue entities :ego "Hey!"
:ego "What's going on? I was just about to teach Blergh a lesson!"))
(actions/do-dialogue entities :ego "Hey!" :ego "What's going on? I was just about to teach Bloodclot a lesson!"))
:magic-slingshot (actions/get-script entities
(actions/do-dialogue entities
:ego "Hey Blergh!"

View File

@@ -37,6 +37,7 @@
[java.lang Object]
[com.badlogic.gdx Gdx]))
(def default-interaction
{:get-script (fn [cursor [x y]] (if (= :main cursor)
(actions/get-script entities
@@ -487,6 +488,7 @@
(when m
(music! m :set-volume (get-in entities [:volume :value]) )))
(label! (:fps entities) :set-text (str (game :fps)))
(render! screen (sort-by :baseline all-entities))
#_(render! screen [(:fps entities)])

View File

@@ -60,7 +60,7 @@
:on-render
(fn [screen [entities]]
(let [entities (utils/apply-tweens screen entities (:tweens entities))]
(music! (:music entities) :set-volume (:volume entities))
(music! (:music entities) :set-volume 0.0 #_(:volume entities))
(render! screen [(:overlay entities) (:start-playing entities) (:quit entities) (:fade entities)])
entities))