diff --git a/text_horror/app.js b/text_horror/app.js index c6643a3..b4d2cb3 100644 --- a/text_horror/app.js +++ b/text_horror/app.js @@ -1,7 +1,7 @@ var speed = 50; var typeindex = 0; var dlgFile = {}; -var dlgLines = [""]; +let dlgLines; var dlgPointer = 0; function load() { @@ -15,15 +15,15 @@ function load() { } function typeWriter() { - if (document.getElementById("bubble").innerHTML.length - 1 < dlgLines[dlgPointer].length) { - document.getElementById("bubble").innerHTML += dlgLines[dlgPointer].charAt(typeindex); + if (document.getElementById("bubble").innerHTML.length - 1 < dlgLines[dlgPointer].toString().length) { + document.getElementById("bubble").innerHTML += dlgLines[dlgPointer].toString().charAt(typeindex); typeindex++; setTimeout(typeWriter, speed);//loops because of running "typeWriter" after waiting } } function mouseClick() { - if (document.getElementById("bubble").innerHTML.length == dlgLines[dlgPointer].length) { + if (document.getElementById("bubble").innerHTML.length == dlgLines[dlgPointer].toString().length) { if (dlgPointer < dlgLines.length - 1) { dlgPointer++; typeindex = 0; diff --git a/text_horror/dialogue.json b/text_horror/dialogue.json index 8bf071a..5621811 100644 --- a/text_horror/dialogue.json +++ b/text_horror/dialogue.json @@ -1,5 +1,6 @@ [ "Hello welcome to TextHorror!", "This is the second line", + 1, "Aand a third line" ] \ No newline at end of file