Add background music!
Thanks Vivi!
This commit is contained in:
parent
e2a23f7820
commit
fb3da196df
4 changed files with 11 additions and 2 deletions
1
Makefile
1
Makefile
|
@ -65,6 +65,7 @@ bundle: game.wasm
|
|||
rm cirkoban.zip || true
|
||||
zip cirkoban.zip -r assets/images/cirkoban-onesheet.png \
|
||||
assets/sounds/*.wav \
|
||||
assets/music/*.ogg \
|
||||
assets/fonts/*.woff2 \
|
||||
reflect.js \
|
||||
game.js \
|
||||
|
|
BIN
assets/music/cirkoban.ogg
Normal file
BIN
assets/music/cirkoban.ogg
Normal file
Binary file not shown.
12
game.scm
12
game.scm
|
@ -80,7 +80,7 @@
|
|||
320 240
|
||||
(inexact->exact tile-width)
|
||||
(inexact->exact tile-height)))
|
||||
(define* (load-sound-effect name #:key (volume 0.25))
|
||||
(define* (load-sound-effect name #:key (volume 0.75))
|
||||
(make-sound-effect (string-append "assets/sounds/" name ".wav")))
|
||||
(define audio:bump (load-sound-effect "bump"))
|
||||
(define audio:push (load-sound-effect "push"))
|
||||
|
@ -99,6 +99,13 @@
|
|||
(define audio:electric-switch-off (load-sound-effect "electric-switch-off"))
|
||||
(define audio:explosion (load-sound-effect "explosion"))
|
||||
|
||||
(define* (load-music name #:key (volume 0.5))
|
||||
(let ((music (make-audio (string-append "assets/music/" name ".ogg"))))
|
||||
(set-media-loop! music 1)
|
||||
(set-media-volume! music volume)
|
||||
music))
|
||||
(define audio:bg-music (load-music "cirkoban"))
|
||||
|
||||
;; Game state
|
||||
(define *state* #f)
|
||||
|
||||
|
@ -265,7 +272,8 @@
|
|||
(set! *level-idx* idx)
|
||||
(set! *gems* gems)
|
||||
(pk 'load *level-idx*)
|
||||
(load-level! *level-idx*)))))
|
||||
(load-level! *level-idx*)
|
||||
(media-play audio:bg-music)))))
|
||||
|
||||
(define (reset-game!)
|
||||
(run-script
|
||||
|
|
Loading…
Add table
Reference in a new issue