diff --git a/index.html b/index.html index b200171..8ed5fdd 100644 --- a/index.html +++ b/index.html @@ -11,11 +11,14 @@ -
+

- +
+

Test

+
+

Thanks for playing

diff --git a/text_horror/app.js b/text_horror/app.js index bcee6a1..2cd255e 100644 --- a/text_horror/app.js +++ b/text_horror/app.js @@ -1,7 +1,7 @@ var speed = 50; var typeindex = 0; var dlgFile = {}; -let dlgLines; +let dlgLines = []; var dlgPointer = 0; function load() { @@ -22,22 +22,20 @@ function typeWriter() { } } -document.addEventListener('click', nextDlg, false) - function nextDlg() { document.getElementById("triangle").hidden = true; if (document.getElementById("dlg-text").innerHTML.length == dlgLines[dlgPointer].length) { //check if text is typed out document.getElementById("triangle").hidden = true; - if (dlgPointer < dlgLines.length - 1) { //check if dlgPointer is not at the array end + if (dlgPointer < dlgLines.length - 2) { //check if dlgPointer is not at the array end do { - if (String(dlgLines[dlgPointer]).startsWith("_")) { - switch (dlgLines[dlgPointer].split(":")[0]) { - case "_title": - document.getElementById("title").innerHTML = dlgLines[dlgPointer].split(':')[1]; - break; - } - } dlgPointer++; + if (typeof dlgLines[dlgPointer] === 'number') + speed = 50 / dlgLines[dlgPointer]; + else if (typeof dlgLines[dlgPointer] === 'object') { } + else if (typeof dlgLines[dlgPointer] === 'string' && String(dlgLines[dlgPointer]).startsWith("_")) { + if (dlgLines[dlgPointer].split(":")[0] === "_title") + document.getElementById("title").innerHTML = dlgLines[dlgPointer].split(':')[1]; + } } while (typeof dlgLines[dlgPointer] !== 'string' || String(dlgLines[dlgPointer]).startsWith("_")) //again if it's not string typeindex = 0; @@ -45,6 +43,7 @@ function nextDlg() { typeWriter(); } else { document.getElementById("bubble").hidden = true; + document.getElementById("answer-box").hidden = true; } } } diff --git a/text_horror/dialogue.json b/text_horror/dialogue.json index e8a76fb..ef70eba 100644 --- a/text_horror/dialogue.json +++ b/text_horror/dialogue.json @@ -2,9 +2,15 @@ "start": [ "Hello welcome to TextHorror!", "_title:NPC Name", - 1, "This is the second line", - 2, - "Aand a third line" + "Aand a third line", + 0.3, + "This text is slow", + 1, + "And again normal text", + { + "Yes": "CoooooooolllSADVwqavedWSDV", + "Also Yes": "MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMGGHWhudujwd" + } ] } \ No newline at end of file diff --git a/text_horror/style.css b/text_horror/style.css index 82e4a74..046ddfa 100644 --- a/text_horror/style.css +++ b/text_horror/style.css @@ -8,6 +8,7 @@ body { background-color: black; color: white; font-family: pixel-font; + user-select: none; } .thx-for-playing {