From b29d96bab8cabdf2cf61e097f071a162d1ce8bd3 Mon Sep 17 00:00:00 2001 From: Aaron Fischer Date: Thu, 31 Aug 2017 12:56:40 +0200 Subject: [PATCH] Fix the bubble stuff finally --- src/bubble.js | 11 ++++++++--- src/entity.js | 2 ++ src/mouse.js | 2 ++ src/stasis.js | 2 ++ 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/bubble.js b/src/bubble.js index 82f3dcb..40a49ad 100644 --- a/src/bubble.js +++ b/src/bubble.js @@ -4,7 +4,6 @@ var bubble = {}; var dom = document.getElementById('bubble'); - var resolveFn, fragmentTimer, delayTimer = null; var show = function(text, position) { return new Promise(function(resolve) { @@ -30,6 +29,7 @@ bubble.skip = function(what) { clearTimeout(fragmentTimer); clearTimeout(delayTimer); + dom.innerHTML = ''; if (resolveFn) resolveFn(what || 'line'); }; @@ -38,10 +38,13 @@ dom.innerHTML = ''; return; } + bubble.skip('talk'); var text = texts.shift(); return show(text, position || [5, 44]) .then(function(what) { - if (what !== undefined) return Promise.resolve(what); + if (what === 'talk') { + return Promise.resolve(what); + } return bubble.talk(texts, position); }); }; @@ -55,7 +58,9 @@ var params = talkList.shift(); return bubble.talk(params[0], params[1]) .then(function(what) { - if (what === 'story') return Promise.resolve(); + if (what === 'story') { + return Promise.resolve(what); + } return bubble.story(talkList); }); }; diff --git a/src/entity.js b/src/entity.js index f3f7cb5..e0a5b17 100644 --- a/src/entity.js +++ b/src/entity.js @@ -1,4 +1,6 @@ (function() { + "use strict"; + var entity = {}; var allEntities = []; diff --git a/src/mouse.js b/src/mouse.js index 972f7f6..4f47eb1 100644 --- a/src/mouse.js +++ b/src/mouse.js @@ -1,4 +1,6 @@ (function() { + "use strict"; + var mouse = {}; var isEnabled = true; var canvas = document.getElementById('js13k-2017'); diff --git a/src/stasis.js b/src/stasis.js index 2947036..f06f23c 100644 --- a/src/stasis.js +++ b/src/stasis.js @@ -1,4 +1,6 @@ (function() { + "use strict"; + var stasis = {}; var background, backgroundDark = null;