diff options
author | Ricardo Wurmus <rekado@elephly.net> | 2023-11-06 13:33:38 +0100 |
---|---|---|
committer | Ricardo Wurmus <rekado@elephly.net> | 2023-11-06 13:33:38 +0100 |
commit | c53efe4e4f8c3c08ac3d0e256013785f54498f73 (patch) | |
tree | afd9f0781a5a68210821b878538e755e6d40b59c | |
parent | 0a07f6d4a9c163fe34312f60b57bab2b24d8f7c5 (diff) |
death: Detune music on end.
-rw-r--r-- | scenes/death.scm | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/scenes/death.scm b/scenes/death.scm index 7ee3674..afa3981 100644 --- a/scenes/death.scm +++ b/scenes/death.scm @@ -19,6 +19,7 @@ #:use-module (chickadee) #:use-module (chickadee audio) #:use-module (chickadee math) + #:use-module (chickadee math easings) #:use-module (chickadee math vector) #:use-module ((chickadee graphics color) #:select (make-color)) #:use-module (chickadee graphics text) @@ -139,11 +140,11 @@ quite short.")) (define (load-scene) + (define background-music + (make-source #:audio (asset-ref music) + #:loop? #true)) (set! death-text (list-ref texts (random (length texts)))) - (source-play - (make-source #:audio (asset-ref music) - #:loop? #true)) - + (source-play background-music) (set! *player* (lorenzo #:start-position (vec2 (+ (/ %width 2) 25) (- (/ %height 2) 20)) @@ -157,6 +158,8 @@ quite short.")) (update-animated-sprite *reaper*) (set! (walk-speed *reaper*) 0.3) + (define detune-music (make-channel)) + (with-agenda agenda (spawn-script @@ -170,6 +173,19 @@ quite short.")) (make-color 0 0 0 alpha)))) (abort-game))) + (spawn-script + (lambda () + (wait-until (channel-get detune-music)) + (tween 20 1.0 0.0 + (lambda (a) + (set-source-pitch! background-music a) + (set-source-volume! background-music a) + (set! fade-box-fill + (make-color 0 0 0 a))) + #:ease ease-out-sine) + (source-stop background-music) + (abort-game))) + (script ;; Fade in (tween 0.25 1.0 0.0 @@ -220,7 +236,6 @@ quite short.")) labels))) credits) (sleep 5) - (for-each (lambda (text) (let ((label (make <label> @@ -255,7 +270,8 @@ quite short.")) "Please just turn it off." "I'm begging you." "You're not listening, huh?" - "Well, I guess I'll just stop talking then.")))) + "Well, I guess I'll just stop talking then.")) + (channel-put detune-music 'now!))) (current-agenda agenda)) (define (draw-scene alpha) |