summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson@vistahigherlearning.com>2021-05-04 07:39:12 -0400
committerDavid Thompson <dthompson@vistahigherlearning.com>2021-05-04 08:31:06 -0400
commit6983a70c175659ca48df89bc4282c068d09ab430 (patch)
tree9054b6dee43271868db09e3a06a1b63d1a43e919
parent6d54bd44b004c77aa4fadd755c63a73c2629bbdf (diff)
Use background music functionality of the <scene> class.
-rw-r--r--test-subject/game.scm15
1 files changed, 6 insertions, 9 deletions
diff --git a/test-subject/game.scm b/test-subject/game.scm
index cb89559..0540215 100644
--- a/test-subject/game.scm
+++ b/test-subject/game.scm
@@ -49,8 +49,7 @@
(terminal-locked? #:accessor terminal-locked? #:init-value #t)
(terminal-channel #:accessor terminal-channel #:init-thunk make-channel)
(terminal-lines #:accessor terminal-lines #:init-form (make-ring-buffer 17))
- (key-pad-locked? #:accessor key-pad-locked? #:init-value #t)
- (audio-source #:accessor audio-source #:init-thunk make-source))
+ (key-pad-locked? #:accessor key-pad-locked? #:init-value #t))
(define-method (subject-name (game <game>))
(if (subject-name-known? game)
@@ -67,6 +66,7 @@
(audio-play (asset-ref device-sound)))
(define-method (reset-game (game <game>))
+ (set! (background-music game) #f)
(set! (subject-name-known? game) #f)
(set! (has-fridge-key? game) #f)
(set! (opened-notebook? game) #f)
@@ -962,9 +962,8 @@ if you would just open the door.")
#:position (vec2 109.0 40.0)
#:listeners
`((click . ,(run-on-left-click* game open-terminal)))))))
- (set-source-loop! (audio-source game) #t)
- (set-source-audio! (audio-source game) (asset-ref gameplay-music))
- (source-play (audio-source game))
+ (set! (background-music game) gameplay-music)
+ (set! (background-music-loop? game) #t)
(fade-in))
(define-method (good-ending (game <game>))
@@ -1040,9 +1039,8 @@ time?")
(set! (text (& game credits)) line)
(sleep 120))
(set! (state game) 'credits)
- (set-source-loop! (audio-source game) #f)
- (set-source-audio! (audio-source game) (asset-ref credits-music))
- (source-play (audio-source game))
+ (set! (background-music game) credits-music)
+ (set! (background-music-loop? game) #f)
(attach-to game
(make <sprite>
#:name 'background
@@ -1075,7 +1073,6 @@ time?")
(set! (tint (& game background)) color))
#:interpolate color-lerp)
(detach-all game)
- (source-stop (audio-source game))
(reset-game game)
(intro game))