diff --git a/TODO.md b/TODO.md index 2743701..f7d26f8 100644 --- a/TODO.md +++ b/TODO.md @@ -1,11 +1,12 @@ +## TODO: - finish game image - desktop (landscape) orientation -- background music - change quest animation - button hover animation - make docs/ -## done +## Done +- background music [c814f77] - several correct answer [498ab55] - loading all quest images with loading [b8aa4b6] - splash (loading) screen [b8aa4b6] diff --git a/app/config.json b/app/config.json index a5eb6d4..c733da0 100644 --- a/app/config.json +++ b/app/config.json @@ -3,5 +3,5 @@ "gameVersion": [0, 0, 1], "debug": true, "loaderWidth": 200, - "music": "music.mp3" + "music": { "src": "music.mp3", "autoplay": true } } diff --git a/js/music.js b/js/music.js index e1d49f8..4802401 100644 --- a/js/music.js +++ b/js/music.js @@ -1,7 +1,7 @@ export function playMusic(config, music) { let request = new XMLHttpRequest(); - request.open("GET", `assets/sfx/${config.music}`, true); + request.open("GET", `assets/sfx/${config.music.src}`, true); request.responseType = "arraybuffer"; request.onload = function(){ music.decodeAudioData(request.response, onDecoded); @@ -12,7 +12,9 @@ export function playMusic(config, music) { bufferSource.buffer = buffer; bufferSource.connect(music.destination); bufferSource.loop = true; - bufferSource.start(); + + if (config.music.autoplay) + bufferSource.start(); } request.send();