From d96dc56004402daefa2da99c5e6f753f6668bbd0 Mon Sep 17 00:00:00 2001 From: Fen Dweller Date: Mon, 7 Jan 2019 19:14:17 -0500 Subject: [PATCH] Sounds stop, log clears, and state resets when quitting --- satiate.js | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/satiate.js b/satiate.js index 7b06585..9d97f6d 100644 --- a/satiate.js +++ b/satiate.js @@ -4,18 +4,7 @@ let activeModal = null; const version = "pre-alpha"; -let state = { - player: { - items: { - keys: [ - - ] - }, - rooms: { - - } - } -} +let state; function print(lines) { (lines.concat([String.fromCharCode(160)])).forEach(line => { @@ -56,6 +45,9 @@ function openModal(modal) { } function returnToStart() { + stopAllSound(); + log.innerHTML = ""; + document.querySelector("#game").classList.remove("scene"); document.querySelector("#game").classList.add("hidden-scene"); document.querySelector("#pick").classList.remove("hidden-scene"); @@ -65,6 +57,19 @@ function returnToStart() { // set up the game function init(story) { + state = { + player: { + items: { + keys: [ + + ] + }, + rooms: { + + } + } + }; + initWorld(story, state); initAudio(story, state); initGame(story, state);