diff --git a/src/act1.js b/src/act1.js index f0f4e22..9d3ecab 100644 --- a/src/act1.js +++ b/src/act1.js @@ -3,11 +3,10 @@ muri.get('bubble') .story([ - [['Beep ...', 'Click, Click, Click ...'], [20, 15]], - [['Urgh ... ....', 'What is wrong with me? ...'], [5, 40]] - ]).then(function() { - console.log("asdf"); - }) + [['Beep', 'Bip, Bip'], [20, 15]], + [['Urgh ... ...', 'Where I am?', 'What happened?'], [35, 40]], + [['I can\'t see a thing ...', '... need to turn on the light ...'], [35, 40]] + ]); act1.update = function() { }; diff --git a/src/bubble.js b/src/bubble.js index 5636f57..d91c8b4 100644 --- a/src/bubble.js +++ b/src/bubble.js @@ -4,7 +4,7 @@ var isactive = false; var show = function(text, position) { return new Promise(function(resolve) { - isactive = true; + isActive = true; var dom = document.getElementById('bubble'); dom.style.display = ''; @@ -16,10 +16,10 @@ var show = function() { if (parts.length === 0) { setTimeout(function() { - isactive = false; + isActive = false; dom.style.display = 'none'; return resolve(); - }, 4000); + }, 2000); return; } dom.innerHTML += parts.shift() + ' '; @@ -30,26 +30,18 @@ }; bubble.talk = function(texts, position) { - return new Promise(function(resolve) { - if (texts.length === 0) { - return resolve(); - } - var text = texts.shift(); - show(text, position || [5, 40]).then(function() { - bubble.talk(texts, position); - }); + if (texts.length === 0) return; + var text = texts.shift(); + return show(text, position || [5, 40]).then(function() { + return bubble.talk(texts, position); }); }; bubble.story = function(talkList) { - return new Promise(function(resolve, reject) { - if (talkList.length === 0) { - return resolve(); - } - var params = talkList.shift(); - bubble.talk(params[0], params[1]).then(function() { - bubble.story(talkList); - }); + if (talkList.length === 0) return; + var params = talkList.shift(); + return bubble.talk(params[0], params[1]).then(function() { + return bubble.story(talkList); }); };