chorus. cool.

This commit is contained in:
2015-03-03 13:51:54 -08:00
parent 81c3d702aa
commit 820aa48f4a
3 changed files with 70 additions and 38 deletions

View File

@@ -8,13 +8,13 @@ lowMax: 3000.0
min: 0 min: 0
max: 200 max: 200
- Emission - - Emission -
lowMin: 1.0 lowMin: 40.0
lowMax: 1.0 lowMax: 40.0
highMin: 20.0 highMin: 80.0
highMax: 20.0 highMax: 80.0
relative: false relative: false
scalingCount: 2 scalingCount: 2
scaling0: 0.0 scaling0: 0.42857143
scaling1: 1.0 scaling1: 1.0
timelineCount: 2 timelineCount: 2
timeline0: 0.0 timeline0: 0.0
@@ -23,7 +23,7 @@ timeline1: 1.0
lowMin: 0.0 lowMin: 0.0
lowMax: 0.0 lowMax: 0.0
highMin: 1000.0 highMin: 1000.0
highMax: 1000.0 highMax: 3000.0
relative: false relative: false
scalingCount: 3 scalingCount: 3
scaling0: 1.0 scaling0: 1.0
@@ -46,8 +46,8 @@ side: both
- Spawn Width - - Spawn Width -
lowMin: 0.0 lowMin: 0.0
lowMax: 0.0 lowMax: 0.0
highMin: 20.0 highMin: 35.0
highMax: 20.0 highMax: 35.0
relative: false relative: false
scalingCount: 1 scalingCount: 1
scaling0: 1.0 scaling0: 1.0
@@ -56,40 +56,44 @@ timeline0: 0.0
- Spawn Height - - Spawn Height -
lowMin: 0.0 lowMin: 0.0
lowMax: 0.0 lowMax: 0.0
highMin: 30.0 highMin: 45.0
highMax: 30.0 highMax: 45.0
relative: false relative: false
scalingCount: 1 scalingCount: 1
scaling0: 1.0 scaling0: 1.0
timelineCount: 1 timelineCount: 1
timeline0: 0.0 timeline0: 0.0
- Scale - - Scale -
lowMin: 0.0 lowMin: 3.0
lowMax: 0.0 lowMax: 3.0
highMin: 15.0 highMin: 11.0
highMax: 5.0 highMax: 20.0
relative: false relative: false
scalingCount: 4 scalingCount: 4
scaling0: 0.0 scaling0: 0.0
scaling1: 1.0 scaling1: 1.0
scaling2: 0.877551 scaling2: 0.6938776
scaling3: 0.0 scaling3: 0.0
timelineCount: 4 timelineCount: 4
timeline0: 0.0 timeline0: 0.0
timeline1: 0.07534247 timeline1: 0.23972602
timeline2: 0.6164383 timeline2: 0.63013697
timeline3: 1.0 timeline3: 1.0
- Velocity - - Velocity -
active: true active: true
lowMin: 0.0 lowMin: 3.0
lowMax: 0.0 lowMax: 3.0
highMin: 10.0 highMin: 10.0
highMax: 20.0 highMax: 20.0
relative: false relative: false
scalingCount: 1 scalingCount: 3
scaling0: 1.0 scaling0: 1.0
timelineCount: 1 scaling1: 0.85714287
scaling2: 0.0
timelineCount: 3
timeline0: 0.0 timeline0: 0.0
timeline1: 0.6712329
timeline2: 0.96575344
- Angle - - Angle -
active: true active: true
lowMin: 90.0 lowMin: 90.0
@@ -100,11 +104,11 @@ relative: false
scalingCount: 3 scalingCount: 3
scaling0: 1.0 scaling0: 1.0
scaling1: 1.0 scaling1: 1.0
scaling2: 1.0 scaling2: 0.0
timelineCount: 3 timelineCount: 3
timeline0: 0.0 timeline0: 0.0
timeline1: 0.48630136 timeline1: 0.48630136
timeline2: 1.0 timeline2: 0.9931507
- Rotation - - Rotation -
active: false active: false
- Wind - - Wind -
@@ -113,12 +117,12 @@ active: false
active: false active: false
- Tint - - Tint -
colorsCount: 6 colorsCount: 6
colors0: 0.5019608 colors0: 0.24705882
colors1: 0.94509804 colors1: 0.31764707
colors2: 1.0 colors2: 0.8156863
colors3: 0.047058824 colors3: 0.5529412
colors4: 0.7137255 colors4: 0.34901962
colors5: 1.0 colors5: 0.7019608
timelineCount: 2 timelineCount: 2
timeline0: 0.0 timeline0: 0.0
timeline1: 1.0 timeline1: 1.0
@@ -130,12 +134,12 @@ highMax: 1.0
relative: false relative: false
scalingCount: 4 scalingCount: 4
scaling0: 0.0 scaling0: 0.0
scaling1: 0.8947368 scaling1: 1.0
scaling2: 0.49122807 scaling2: 0.49122807
scaling3: 0.0 scaling3: 0.0
timelineCount: 4 timelineCount: 4
timeline0: 0.0 timeline0: 0.0
timeline1: 0.30136988 timeline1: 0.1849315
timeline2: 0.84931505 timeline2: 0.84931505
timeline3: 1.0 timeline3: 1.0
- Options - - Options -

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -11,6 +11,12 @@
[play-clj.ui :refer :all] [play-clj.ui :refer :all]
[play-clj.utils :refer :all] [play-clj.utils :refer :all]
[play-clj.g2d :refer :all])) [play-clj.g2d :refer :all]))
(defn get-chorus-volume [entities]
(let [ego (get-in entities [:room :entities :ego])]
(if (> (:y ego) 112)
0.0
(* (max 0.0 (- 1.0 (/ (utils/dist 45 97 (:x ego) (:y ego)) 50.0)))
(- 1.0 (get-in entities [:fade :opacity]))))))
(defn bloodclot-appear [entities] (defn bloodclot-appear [entities]
(actions/run-action entities (actions/run-action entities
@@ -302,12 +308,13 @@
:fn (fn [screen entities] :fn (fn [screen entities]
(let [magic (get-in entities [:room :entities :magic])] (let [magic (get-in entities [:room :entities :magic])]
(cond (nil? magic) (cond (nil? magic)
(assoc-in entities [:room :entities :magic] (assoc (doto (particle-effect "inside-castle/magic") (do
(particle-effect! :reset) (assoc-in entities [:room :entities :magic] (assoc (doto (particle-effect "inside-castle/magic")
) (particle-effect! :reset)
:x 25 )
:y 112 :x 25
:baseline 240)) :y 108
:baseline 240)))
(particle-effect! magic :is-complete) (particle-effect! magic :is-complete)
(do (do
(doto magic (doto magic
@@ -414,6 +421,7 @@
(actions/give entities :monocle) (actions/give entities :monocle)
(actions/talk entities :ego "It looks like a monocle."))})) (actions/talk entities :ego "It looks like a monocle."))}))
:chorus {:sound (sound "inside-castle/chorus.wav")}
:collision "inside-castle/collision.png" :collision "inside-castle/collision.png"
:scale-fn (utils/scaler-fn-from-image "inside-castle/scale.png" 0.25 1.00) :scale-fn (utils/scaler-fn-from-image "inside-castle/scale.png" 0.25 1.00)
:apply-state (fn [entities] :apply-state (fn [entities]
@@ -426,5 +434,25 @@
entities) entities)
(if (= :night (get-in entities [:state :time])) (if (= :night (get-in entities [:state :time]))
(make-night entities) (make-night entities)
entities))) entities)
#_(let [chorus
instance (sound! chorus :loop 0.0)]
(-> entities
(assoc-in [:room :chorus :sound] chorus)
(assoc-in [:room :chorus :instance] instance)))))
:update-fn (fn [screen entities]
(let [chorus-volume (get-chorus-volume entities)]
(if (= 0.0 chorus-volume)
(if (get-in entities [:room :chorus :instance])
(do (sound! (get-in entities [:room :chorus :sound]) :stop)
(update-in entities [:room :chorus] dissoc :instance))
entities)
(let [chorus (get-in entities [:room :chorus])]
(if (:instance chorus)
(do (sound! (:sound chorus) :set-volume
(:instance chorus)
chorus-volume)
entities)
(assoc-in entities [:room :chorus :instance] (sound! (:sound chorus) :loop
chorus-volume)))))))
:start-pos [245 90]))) :start-pos [245 90])))