Fix the bubble stuff finally

This commit is contained in:
Aaron Fischer 2017-08-31 12:56:40 +02:00
parent 2243a5a788
commit b29d96bab8
4 changed files with 14 additions and 3 deletions

View file

@ -4,7 +4,6 @@
var bubble = {}; var bubble = {};
var dom = document.getElementById('bubble'); var dom = document.getElementById('bubble');
var resolveFn, fragmentTimer, delayTimer = null; var resolveFn, fragmentTimer, delayTimer = null;
var show = function(text, position) { var show = function(text, position) {
return new Promise(function(resolve) { return new Promise(function(resolve) {
@ -30,6 +29,7 @@
bubble.skip = function(what) { bubble.skip = function(what) {
clearTimeout(fragmentTimer); clearTimeout(fragmentTimer);
clearTimeout(delayTimer); clearTimeout(delayTimer);
dom.innerHTML = '';
if (resolveFn) resolveFn(what || 'line'); if (resolveFn) resolveFn(what || 'line');
}; };
@ -38,10 +38,13 @@
dom.innerHTML = ''; dom.innerHTML = '';
return; return;
} }
bubble.skip('talk');
var text = texts.shift(); var text = texts.shift();
return show(text, position || [5, 44]) return show(text, position || [5, 44])
.then(function(what) { .then(function(what) {
if (what !== undefined) return Promise.resolve(what); if (what === 'talk') {
return Promise.resolve(what);
}
return bubble.talk(texts, position); return bubble.talk(texts, position);
}); });
}; };
@ -55,7 +58,9 @@
var params = talkList.shift(); var params = talkList.shift();
return bubble.talk(params[0], params[1]) return bubble.talk(params[0], params[1])
.then(function(what) { .then(function(what) {
if (what === 'story') return Promise.resolve(); if (what === 'story') {
return Promise.resolve(what);
}
return bubble.story(talkList); return bubble.story(talkList);
}); });
}; };

View file

@ -1,4 +1,6 @@
(function() { (function() {
"use strict";
var entity = {}; var entity = {};
var allEntities = []; var allEntities = [];

View file

@ -1,4 +1,6 @@
(function() { (function() {
"use strict";
var mouse = {}; var mouse = {};
var isEnabled = true; var isEnabled = true;
var canvas = document.getElementById('js13k-2017'); var canvas = document.getElementById('js13k-2017');

View file

@ -1,4 +1,6 @@
(function() { (function() {
"use strict";
var stasis = {}; var stasis = {};
var background, backgroundDark = null; var background, backgroundDark = null;