diff options
Diffstat (limited to 'scenes')
-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) |