lots of tweaks.

This commit is contained in:
Bryce Covert
2015-10-10 11:04:44 -07:00
parent 2feaf36c87
commit 5981c1d303
37 changed files with 1452 additions and 1024 deletions

View File

@@ -796,3 +796,66 @@
(play-animation entities :ego :love)
(actions/update-state entities (fn [s] (assoc s :has-seen-love? true)))
(transition-music entities nil :duration 1.0))))
(defn fade-in-georgia [entities]
(actions/run-action entities
(begin [this screen entities]
(particle-effect! (get-in entities [:room :entities :georgia-cloud]) :reset)
(particle-effect! (get-in entities [:room :entities :georgia-cloud]) :start)
(-> entities
(assoc-in [:room :entities :georgia-face :x] (- (get-in entities [:room :entities :ego :x]) 30))
(assoc-in [:room :entities :georgia-face :y] (+ (get-in entities [:room :entities :ego :y]) 30))
(assoc-in [:room :entities :georgia-cloud :x] (- (get-in entities [:room :entities :ego :x]) 30))
(assoc-in [:room :entities :georgia-cloud :y] (+ (get-in entities [:room :entities :ego :y]) 30))
(assoc-in [:tweens :fade-georgia]
(tween/tween :fade-georgia screen [:room :entities :georgia-face :opacity] 0.0 1.0 1.0 :ease tween/ease-in-cubic))))
(continue [this screen entities]
(assoc-in entities [:room :entities :georgia-cloud :opacity] (get-in entities [:room :entities :georgia-face :opacity])))
(done? [this screen entities]
(nil? (get-in entities [:tweens :fade-georgia])))
(terminate [this screen entities]
entities)
(skip-type [this screen entities]
:none)))
(defn fade-out-georgia [entities]
(actions/run-action entities
(begin [this screen entities]
(particle-effect! (get-in entities [:room :entities :georgia-cloud]) :allow-completion)
(-> entities
(assoc-in [:tweens :fade-georgia]
(tween/tween :fade-georgia screen [:room :entities :georgia-face :opacity] 1.0 0.0 1.0 :ease tween/ease-in-cubic))))
(continue [this screen entities]
entities)
(done? [this screen entities]
(nil? (get-in entities [:tweens :fade-georgia])))
(terminate [this screen entities]
entities)
(skip-type [this screen entities]
:none)))
(defn georgia-say [entities msg]
(fade-in-georgia entities)
(actions/talk entities :georgia-face msg)
(fade-out-georgia entities)
(transition-music entities nil :duration 1.0))
(defn in-love [entities]
(let [seen-love (get-in @entities [:state :has-seen-love?])]
(when (or (not seen-love)
(< (rand-int 10) 3))
(transition-music entities :love :duration 1.0)
(fade-in-georgia entities)
(play-animation entities :ego :love)
(actions/update-state entities (fn [s] (assoc s :has-seen-love? true)))
(fade-out-georgia entities)
(transition-music entities nil :duration 1.0))))

View File

@@ -46,7 +46,7 @@
(actions/has-obtained? entities :sword)
0.0
:else
(max 0.0 (- 1.0 (/ (utils/dist 45 97 (:x ego) (:y ego)) 50.0))))))
(* 0.2 (max 0.0 (- 1.0 (/ (utils/dist 45 97 (:x ego) (:y ego)) 50.0)))))))
(defn bloodclot-appear [entities]
(actions/run-action entities
@@ -341,7 +341,7 @@
game-player-stand-up (animation 0.15 (for [i [0 0 0 0 0 0 0 0 0 0 0 1]]
(aget game-player-talk-sheet 0 i)))
game-player-stand-down (utils/make-anim "inside-castle/brian-working.png" [40 44] 0.1 [0 1 1 2 0 2 2 1 0 2 2 2 2 2 1 1 ])
game-player-stand-down (utils/make-anim "inside-castle/brian-working.png" [40 44] 0.1 (flatten (repeat 4 [0 1 1 2 0 2 2 1 0 2 2 2 2 2 1 1 ])))
game-player-talk-down (utils/make-anim "inside-castle/brian-working.png" [40 44] 0.2 [2 3 2 2 3 2 3 2])
game-player-pause-from-work (utils/make-anim "inside-castle/brian-working.png" [40 44] 0.15 [2 3 4 5 6 7])
game-player-get-to-work (utils/make-anim "inside-castle/brian-working.png" [40 44] 0.15 (reverse [2 3 4 5 6 7]))
@@ -426,8 +426,8 @@
:script (actions/get-script entities
(actions/do-dialogue entities
:ego "That's Georgia McGorgeous' house."
:ego "One day, when I'm a knight, I'll ask her to be my girlfriend.")
(actions/in-love entities))}}
:ego "One day, when I'm a knight, she'll say...")
(actions/georgia-say entities "Kiss me, brave Sir Tick!"))}}
:layers {:day [(assoc (utils/get-texture "inside-castle/background.png") :x 0 :y 0 :baseline 0)
(assoc (utils/get-texture "inside-castle/way-back-tree.png") :x 0 :y 0 :baseline 97)
(assoc (utils/get-texture "inside-castle/roof.png") :x (- 320 57) :y 0 :baseline 240 :parallax 1.5)
@@ -485,7 +485,7 @@
:x 160 :y 97 :baseline 99
:open door
:door-sound (utils/load-sound "door.ogg")
:anim-sound-frames {door {1 [:door-sound 1.0]}}
:anim-sound-frames {door {1 [:door-sound 0.1]}}
)
:sword (assoc (utils/get-texture "inside-castle/sword.png")
:x 22
@@ -526,6 +526,7 @@
:game-player (assoc (utils/get-texture "inside-castle/gameplayer.png") :x 266 :y 49 :baseline 191
:talk-color (color 1.0 0.3 0.2 1.0)
:script (actions/get-script entities (do-game-player-dialogue entities))
:writing-sound (utils/load-sound "inside-castle/writing.ogg")
:facing :left
:scripts #(condp = %
:wool (actions/get-script entities
@@ -602,7 +603,8 @@
:talk game-player-talk-up}
:get-to-work game-player-get-to-work
:pause-from-work game-player-pause-from-work
:anim-sound-frames {game-player-stand-up {11 [:blink 0.3] }}
:anim-sound-frames {game-player-stand-up {11 [:blink 0.3] }
game-player-stand-down {1 [:writing-sound 0.07]}}
:flex game-player-flex)}
:monocle (rooms/make-entity :monocle (assoc (animation->texture screen monocle)
:x 209 :y 160 :baseline 240

View File

@@ -14,7 +14,7 @@
(defn flies-vol [entities]
(utils/proximity-volume entities [201 175] :scale 0.5))
(utils/proximity-volume entities [201 175] :scale 0.20))
(defn do-initial-peddler-conversation [entities]
(actions/do-dialogue entities
@@ -361,6 +361,8 @@
:steer (actions/start-animation screen (assoc (animation->texture screen steer-stand) :x 203 :y 155 :baseline 80
:stand steer-stand
:night-profile :sprite
:moo (utils/load-sound "outside-castle/moo.ogg")
:anim-sound-frames {steer-stand {10 [:moo 0.2]}}
:script (actions/get-script entities
(actions/walk-to entities :ego [168 150] :face :right)
(actions/do-dialogue entities

View File

@@ -705,7 +705,9 @@
nil)
:eat-sound (utils/load-sound "outsidehouse/sheep-eat.ogg")
:anim-sound-frames {sheep-stand {11 [:eat-sound 1.0]}}
:bleet-sound (utils/load-sound "outsidehouse/sheep-bleet.ogg")
:anim-sound-frames {sheep-stand {11 [:eat-sound 0.3]
35 [:bleet-sound 0.5]}}
:left {:walk (utils/flip sheep-walk)
:stand (utils/flip sheep-stand)}
:right {:walk sheep-walk
@@ -722,7 +724,7 @@
:x 253 :y 88 :baseline 122
:open door
:door-sound (utils/load-sound "door.ogg")
:anim-sound-frames {door {1 [:door-sound 1.0]}}
:anim-sound-frames {door {1 [:door-sound 0.1]}}
)
:lamb (assoc (utils/get-texture "outsidehouse/lamb.png")
:x 10 :y 163 :baseline 77

View File

@@ -283,7 +283,7 @@
(as-> entities entities
(utils/play-sound! screen entities (get-in entities [:room :fountain-sound :sound])
(utils/sourced-volume-fn :fountain 0.25 [172 120])
(utils/sourced-volume-fn :fountain 0.15 [172 120])
(utils/get-sound-pan 172)
:loop)

View File

@@ -657,10 +657,10 @@ void main()
:x (first start-pos) :y (last start-pos)
:id "ego"}
ego (assoc ego :anim-sound-frames {(get-in ego [:left :walk]) {2 [choose-step-sound 0.6]
6 [choose-step-sound 0.6]}
(get-in ego [:right :walk]) {2 [choose-step-sound 0.6]
6 [choose-step-sound 0.6]}
ego (assoc ego :anim-sound-frames {(get-in ego [:left :walk]) {2 [choose-step-sound 0.3]
6 [choose-step-sound 0.3]}
(get-in ego [:right :walk]) {2 [choose-step-sound 0.3]
6 [choose-step-sound 0.3]}
(get-in ego [:left :talk] ) {2 [:blink 0.15]}
(get-in ego [:right :talk] ) {2 [:blink 0.15]}
@@ -841,7 +841,7 @@ void main()
[{:keys [id sound volume-fn]} & rest] (get-in entities [:current-sounds :value])]
(if id
(do
(sound! sound :set-volume id (volume-fn entities))
(sound! sound :set-volume id (utils/scale-vol-from-fade entities (volume-fn entities)))
(recur entities rest))
entities)))
@@ -926,6 +926,30 @@ void main()
(defn mouse-moved [{:keys [input-x input-y viewport] :as screen} [entities]]
(utils/update-override screen (assoc-in entities [:cursor :last-pos] [input-x input-y])))
(defn add-georgia-to-all-rooms [screen rooms]
(let [georgia-talk (utils/make-anim "ego/georgia.png" [30 30] 0.2 [0 1 0 1 0 0 1 0 1 2])
georgia-stand (utils/make-anim "ego/georgia.png" [30 30] 0.3 [0 0 0 0 0 0 0 2 0 0 0 0 2])
georgia-face (rooms/make-entity :georgia-face
(assoc (animation->texture screen georgia-stand)
:talk georgia-talk
:anim georgia-stand
:stand georgia-stand
:talk-color (Color/valueOf "ffabe0ff")
:anim-start 0
:x 100 :y 100 :baseline 242 :origin-x 15 :origin-y 15
:opacity 0.0))
georgia-cloud (assoc (particle-effect "particles/cloud-georgia") :x 100 :y 100 :baseline 241 :opacity 0.0)]
(reduce (fn [rooms room-key]
(update-in rooms [room-key :entities]
assoc
:georgia-face georgia-face
:georgia-cloud georgia-cloud))
rooms
(keys rooms))))
(defscreen scene
:on-timer
(fn [screen [entities]]
@@ -958,11 +982,13 @@ void main()
:castle-gate (rooms.castle-gate/make screen)
:outside-jail (rooms.outside-jail/make screen)
:outside-castle (rooms.outside-castle/make screen)}
rooms (add-georgia-to-all-rooms screen rooms)
entities {:rooms rooms
:step-particles (assoc (particle-effect "particles/step") :x 100 :y 100 :baseline 241)
:cam {:zoom 0.95
:paused? false
:object nil}
:current-sounds {:object nil
:value []}
:musics {:object nil
@@ -1061,6 +1087,7 @@ void main()
entities (update-from-room screen entities)
entities (update-from-hotspots screen entities)
entities (assoc-in entities [:room :entities :ego :last-frame] (get-in entities [:room :entities :ego :object]))
entities (update-in entities [:room :entities] (fn [entities]
(into entities
(for [[id entity] entities]

View File

@@ -68,7 +68,10 @@
(defn snapshot-state [entities name]
(doto (.getPreferences (Gdx/app) "ticks-tales-saves")
(.putString (saves/saves name) (pr-str (entities :state)))
(.putString "snapshot-list" (pr-str (filter (complement #{"Autosave"} ) (cons (saves/saves name) (snapshot-list)))))
(.putString "snapshot-list" (pr-str (filter (complement #{"Autosave"})
(cons (saves/saves name)
(filter (complement #{(saves/saves name)})
(snapshot-list))))))
.flush))
(defn save [entities]
@@ -257,7 +260,8 @@
(defn load-sound [f]
(try
(sound f)
(catch Exception _
(catch Exception e
(println e)
(sound (str f ".mp3")))))
@@ -405,13 +409,16 @@
(defn sourced-volume-fn [target vol-scale [x y]]
(fn [entities]
(* (if (= target :ego)
(-> (* (/ (get-in entities [:room :entities :ego :scale-x]) 1.5) 0.75)
(* (or vol-scale 1.0))
(clamp-volume))
(proximity-volume entities [x y] :scale vol-scale))
(- 1.0 (get-in entities [:fade :opacity])))))
(if (= target :ego)
(-> (* (/ (get-in entities [:room :entities :ego :scale-x]) 1.5) 0.75)
(* (or vol-scale 1.0))
(clamp-volume))
(proximity-volume entities [x y] :scale vol-scale))
))
(defn scale-vol-from-fade [entities vol]
(* vol
(- 1.0 (get-in entities [:fade :opacity]))))
(defn play-sound!
([screen entities snd volume-fn]
@@ -423,8 +430,8 @@
([screen entities snd volume-fn pan type]
(let [vol (volume-fn entities)
sound-id (if (= :once type)
(sound! snd :play (current-sound-volume vol) 1.0 pan)
(sound! snd :loop (current-sound-volume vol) 1.0 pan)) ]
(sound! snd :play (scale-vol-from-fade entities (current-sound-volume vol)) 1.0 pan)
(sound! snd :loop (scale-vol-from-fade entities (current-sound-volume vol)) 1.0 pan)) ]
(update-in entities [:current-sounds :value]
conj {:id sound-id
:sound snd