From 7177e8a6939b66594a6e8e1c87e86533ed3caadd Mon Sep 17 00:00:00 2001 From: David Thompson Date: Sun, 29 Oct 2023 21:43:48 -0400 Subject: Add simple background music. Wish I had more time!! --- Makefile | 2 +- audio/music.ogg | Bin 0 -> 1011954 bytes audio/music.xm | Bin 0 -> 702129 bytes game.scm | 21 ++++++++++----------- 4 files changed, 11 insertions(+), 12 deletions(-) create mode 100644 audio/music.ogg create mode 100644 audio/music.xm diff --git a/Makefile b/Makefile index a1faad0..80e78b8 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ level.scm: level.tmx compile-map.scm bundle: game.wasm rm strigoform.zip || true - zip strigoform.zip -r audio/*.wav images/*.png fonts/ js-runtime/ boot.js game.css game.wasm index.html + zip strigoform.zip -r audio/*.{wav,ogg} images/*.png fonts/ js-runtime/ boot.js game.css game.wasm index.html serve: guile web-server diff --git a/audio/music.ogg b/audio/music.ogg new file mode 100644 index 0000000..32ec3c4 Binary files /dev/null and b/audio/music.ogg differ diff --git a/audio/music.xm b/audio/music.xm new file mode 100644 index 0000000..1eeb0b0 Binary files /dev/null and b/audio/music.xm differ diff --git a/game.scm b/game.scm index 13e5bc8..97da850 100644 --- a/game.scm +++ b/game.scm @@ -351,18 +351,16 @@ (define sound:player-death (load-sound-effect "audio/player-death.wav")) (define sound:enemy-shoot (load-sound-effect "audio/enemy-shoot.wav")) (define sound:bullet-hit (load-sound-effect "audio/bullet-hit.wav")) - ;; (define music (load-audio "audio/music.wav")) - ;; (set-audio-loop! music 1) + (define music (load-audio "audio/music.ogg")) + (set-audio-loop! music 1) + (set-audio-volume! music 0.5) (define (music-play) - ;; (audio-play music) - #t) + (audio-play music)) (define (music-pause) - ;; (audio-pause music) - #t) + (audio-pause music)) (define (music-stop) - ;; (audio-pause music) - ;; (audio-seek music 0.0) - #t) + (audio-pause music) + (audio-seek music 0.0)) (define *debug?* #f) @@ -1367,7 +1365,7 @@ (wait 180) (phase-1)) (spawn-enemy - (make-enemy 'boss 1500 (vec2 x (- y 24.0)) (vec2 144.0 50.0) + (make-enemy 'boss 1500 (vec2 x (- y 32.0)) (vec2 144.0 50.0) (vec2 0.0 0.0) script 500000 #(0.0 144.0 288.0 432.0) image:boss (vec2 144.0 96.0)))) @@ -1570,10 +1568,11 @@ (do-splash))))) (define (do-game-over) (scheduler-reset! *countdown-scheduler*) - (music-stop) + (music-pause) (set! *game-state* 'game-over) (do-countdown)) (define (do-continue) + (music-play) (player-position-reset!) (set! *player-lives* 3) (set! *player-1cc?* #f) -- cgit v1.2.3