diff --git a/index.html b/index.html
index 68f575a..0c78142 100644
--- a/index.html
+++ b/index.html
@@ -10,7 +10,7 @@
TextHorror
-
+
Thanks for playing
diff --git a/text_horror/app.js b/text_horror/app.js
index c54779f..eec1ef6 100644
--- a/text_horror/app.js
+++ b/text_horror/app.js
@@ -15,20 +15,27 @@ function load() {
}
function typeWriter() {
- if (document.getElementById("bubble").innerHTML.length - 1 < dlgLines[dlgPointer].toString().length) {
+ if (document.getElementById("bubble").innerHTML.length < dlgLines[dlgPointer].toString().length) {
document.getElementById("bubble").innerHTML += dlgLines[dlgPointer].toString().charAt(typeindex);
typeindex++;
- setTimeout(typeWriter, speed);//loops because of running "typeWriter" after waiting
+ document.getElementById("triangle").hidden = document.getElementById("bubble").innerHTML.length != dlgLines[dlgPointer].length
+ setTimeout(typeWriter, speed); //loops because of running "typeWriter" after waiting
}
}
-function mouseClick() {
- if (document.getElementById("bubble").innerHTML.length == dlgLines[dlgPointer].length) {
- if (dlgPointer < dlgLines.length - 1) {
- dlgPointer++;
- while (!(typeof dlgLines[dlgPointer] === 'string')) dlgPointer++;//again if it's not string
+function mouseDown() {
+ document.getElementById("triangle").hidden = true;
+}
+
+function mouseUp() {
+ if (document.getElementById("bubble").innerHTML.length == dlgLines[dlgPointer].length) { //check if text is typed out
+ if (dlgPointer < dlgLines.length - 1) { //check if dlgPointer is not at the array end
+ do
+ dlgPointer++;
+ while (!(typeof dlgLines[dlgPointer] === 'string')) //again if it's not string
typeindex = 0;
document.getElementById("bubble").innerHTML = "";
+ document.getElementById("triangle").hidden = true;
typeWriter();
} else {
document.getElementById("bubble").hidden = true;