Procházet zdrojové kódy

Audio can be preloaded before the game begins

tags/v0.1.1
Fen Dweller před 6 roky
rodič
revize
2f6e27bd1e
4 změnil soubory, kde provedl 14 přidání a 3 odebrání
  1. +1
    -1
      audio.js
  2. +6
    -2
      satiate.js
  3. +3
    -0
      stories/demo.js
  4. +4
    -0
      stories/fen-snack.js

+ 1
- 1
audio.js Zobrazit soubor

@@ -226,7 +226,7 @@ function checkCache(type, name, hit, miss) {
}
}

function initAudio(story, state) {
function initAudio(story) {
if (!audioContext)
audioContext = new (window.AudioContext || window.webkitAudioContext)();



+ 6
- 2
satiate.js Zobrazit soubor

@@ -84,7 +84,6 @@ function init(story) {
};

initWorld(story, state);
initAudio(story, state);
initGame(story, state);

story.intro.setup(state);
@@ -122,7 +121,12 @@ function initStart() {

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 => {
const div = document.createElement("div");


+ 3
- 0
stories/demo.js Zobrazit soubor

@@ -16,6 +16,9 @@ stories.push({
},
"sounds": [
"sfx/oof.ogg"
],
"preload": [

],
"world": {
"Stairs": {


+ 4
- 0
stories/fen-snack.js Zobrazit soubor

@@ -21,6 +21,10 @@ stories.push({
"loop/fen-intestines.ogg",
"loop/fen-bowels.ogg"
],
preload: [
"sfx/stomach-churn.ogg",
"loop/fen-stomach.ogg"
],
intro: {
start: "stomach",
setup: state => {


Načítá se…
Zrušit
Uložit