| @@ -226,7 +226,7 @@ function checkCache(type, name, hit, miss) { | |||||
| } | } | ||||
| } | } | ||||
| function initAudio(story, state) { | |||||
| function initAudio(story) { | |||||
| if (!audioContext) | if (!audioContext) | ||||
| audioContext = new (window.AudioContext || window.webkitAudioContext)(); | audioContext = new (window.AudioContext || window.webkitAudioContext)(); | ||||
| @@ -84,7 +84,6 @@ function init(story) { | |||||
| }; | }; | ||||
| initWorld(story, state); | initWorld(story, state); | ||||
| initAudio(story, state); | |||||
| initGame(story, state); | initGame(story, state); | ||||
| story.intro.setup(state); | story.intro.setup(state); | ||||
| @@ -122,7 +121,12 @@ function initStart() { | |||||
| holder.innerHTML = ""; | holder.innerHTML = ""; | ||||
| const tags = stories.filter(s => s.id == [event.target.value])[0].tags; | |||||
| const story = stories.filter(s => s.id == [event.target.value])[0]; | |||||
| const tags = story.tags; | |||||
| initAudio(story); | |||||
| story.preload.forEach(sound => loadAudio(sound)); | |||||
| tags.forEach(tag => { | tags.forEach(tag => { | ||||
| const div = document.createElement("div"); | const div = document.createElement("div"); | ||||
| @@ -16,6 +16,9 @@ stories.push({ | |||||
| }, | }, | ||||
| "sounds": [ | "sounds": [ | ||||
| "sfx/oof.ogg" | "sfx/oof.ogg" | ||||
| ], | |||||
| "preload": [ | |||||
| ], | ], | ||||
| "world": { | "world": { | ||||
| "Stairs": { | "Stairs": { | ||||
| @@ -21,6 +21,10 @@ stories.push({ | |||||
| "loop/fen-intestines.ogg", | "loop/fen-intestines.ogg", | ||||
| "loop/fen-bowels.ogg" | "loop/fen-bowels.ogg" | ||||
| ], | ], | ||||
| preload: [ | |||||
| "sfx/stomach-churn.ogg", | |||||
| "loop/fen-stomach.ogg" | |||||
| ], | |||||
| intro: { | intro: { | ||||
| start: "stomach", | start: "stomach", | ||||
| setup: state => { | setup: state => { | ||||