paused
diff --git a/scenes/demo.md b/scenes/demo.md
index 46b960d..201da00 100644
--- a/scenes/demo.md
+++ b/scenes/demo.md
@@ -6,11 +6,11 @@ n: THIS IS A HUMAN
`publish("scene", ["add_beebee"])`
-(#act1b)
-
n: THIS IS YOU, THAT HUMAN'S ANXIETY
-h: oh, hello again. i'm sorry but i'd like to eat in peace today if that's not too m--
+h: oh, hello again.
+
+h: i don't mean to be rude, but i'd like to eat in peace today if that's not too m--
n: YOUR JOB IS TO PROTECT YOUR HUMAN FROM *DANGER*
@@ -26,9 +26,19 @@ n: QUICK, WARN THEM
# act1a_alone
-h: oh no
+b: Don't you know loneliness is as associated with premature death as smoking 15 cigarettes a day?-
-b: oh yes
+`Game.OVERRIDE_TEXT_SPEED = 2;`
+
+b: (Holt-Lunstad et al, 2010, PLoS Medicine)
+
+h: uh, thank you for citing your sources but--
+
+`Game.OVERRIDE_TEXT_SPEED = 2;`
+
+b: Which means if you don't hang out with someone *right now* you're gonna-
+
+b: DIEEEEEEEEEEEEEEEEEEEE
n: YOU USED *FEAR OF BEING UNLOVED*
@@ -46,9 +56,13 @@ n: YOU USED *FEAR OF BEING A BAD PERSON*
# act1a_bread
-h: oh no
+h: um, thank you for your concern but i--
-b: oh yes
+`Game.OVERRIDE_TEXT_SPEED = 2;`
+
+b: It'll spike your blood sugar and your health will be ruined and then they'll have to amputate all your limbs and then you'll-
+
+b: DIEEEEEEEEEEEEEEEEEEEE
n: YOU USED *FEAR OF BEING HURT*
diff --git a/scripts/game/Game.js b/scripts/game/Game.js
index 386bb05..0fcb5ed 100644
--- a/scripts/game/Game.js
+++ b/scripts/game/Game.js
@@ -7,6 +7,7 @@ Game.startSectionID = null;
Game.dom = document.querySelector("#game_container");
Game.wordsDOM = document.querySelector("#game_words");
Game.choicesDOM = document.querySelector("#game_choices");
+Game.canvas = document.querySelector("#game_canvas");
Game.startSectionID = null;
Game.queue = [];
@@ -92,21 +93,24 @@ Game.update = function(){
};
+// PAUSING THE GAME
Game.paused = false;
+Game.pausedDOM = document.querySelector("#paused");
Game.pause = function(){
Game.paused = true;
- document.querySelector("#paused").style.display = "block";
+ Game.pausedDOM.style.display = "block";
};
window.addEventListener("blur", Game.pause);
Game.onUnpause = function(){
if(Game.paused){
Game.paused = false;
- document.querySelector("#paused").style.display = "none";
+ Game.pausedDOM.style.display = "none";
}
};
window.addEventListener("click", Game.onUnpause);
window.addEventListener("touchstart", Game.onUnpause);
+// "SET TIMEOUT" for text and stuff
Game.timeoutCallbacks = [];
Game.setTimeout = function(callback, interval){
Game.timeoutCallbacks.push({
@@ -114,6 +118,15 @@ Game.setTimeout = function(callback, interval){
timeLeft: interval
});
};
+// TODO: SKIP TEXT WHEN CLICK ANYWHERE (but NOT capture in choice)
+Game.clearAllTimeouts = function(){
+ Game.timeoutCallbacks.forEach(function(tc){
+ tc.callback();
+ });
+ Game.timeoutCallbacks = [];
+};
+Game.canvas.addEventListener("click", Game.clearAllTimeouts);
+Game.canvas.addEventListener("touchstart", Game.clearAllTimeouts);
Game.goto = function(sectionID){
@@ -209,6 +222,7 @@ Game.updateText = function(){
};
// Execute text! Just add it to text DOM.
+Game.TEXT_SPEED = 40;
Game.OVERRIDE_TEXT_SPEED = 1;
Game.executeText = function(line){
@@ -245,7 +259,7 @@ Game.executeText = function(line){
// Add the text
var interval = 0;
- var SPEED = Math.round(40 / Game.OVERRIDE_TEXT_SPEED);
+ var SPEED = Math.round(Game.TEXT_SPEED / Game.OVERRIDE_TEXT_SPEED);
if(speaker!="n"){
// If not narrator, add letter by letter...
@@ -327,10 +341,12 @@ Game.executeText = function(line){
})(word, interval);
// Interval
- interval += SPEED*5;
+ interval += SPEED*6.5;
// Larger interval if punctuation...
if(bareWord.slice(-1)==",") interval += SPEED*5;
+ if(bareWord.slice(-1)==":") interval += SPEED*5;
+ if(bareWord.slice(-1)==".") interval += SPEED*10;
if(bareWord.slice(-3)=="...") interval += SPEED*15;
}
@@ -338,6 +354,9 @@ Game.executeText = function(line){
}
+ // Return overrides to default
+ Game.OVERRIDE_TEXT_SPEED = 1;
+
// Return promise
var nextLineDelay = SPEED*7;
if(dialogue.slice(-1)=="-") nextLineDelay=0; // sudden interrupt!
@@ -495,7 +514,6 @@ Game.parseLine = function(line){
// WHERE STUFF WILL BE DRAWN ///////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////
-Game.canvas = document.querySelector("#game_canvas");
Game.canvas.width = 360 * 2;
Game.canvas.height = 450 * 2;
Game.canvas.style.width = Game.canvas.width/2 + "px";
diff --git a/styles/game.css b/styles/game.css
index 2b4063b..e813cc5 100644
--- a/styles/game.css
+++ b/styles/game.css
@@ -7,7 +7,7 @@ body{
background: #000;
}
-.no_select{
+#game_words, #game_choices, #paused{
-webkit-user-select: none; /* Safari 3.1+ */
-moz-user-select: none; /* Firefox 2+ */
-ms-user-select: none; /* IE 10+ */