voice update
This commit is contained in:
@@ -7,6 +7,7 @@ var skipDlg = false;
|
||||
var answers;
|
||||
var keys;
|
||||
var allowNextDlg = true;
|
||||
var voice;
|
||||
|
||||
function load() {
|
||||
fetch("text_horror/dialogue.json") //Load json file here
|
||||
@@ -31,7 +32,6 @@ function changeDlg(dlgKey) {
|
||||
}
|
||||
|
||||
function updateDlg() {
|
||||
console.log(dlgLines[dlgPointer]);
|
||||
typeindex = 0;
|
||||
document.getElementById("dlg-text").innerHTML = "";
|
||||
document.getElementById("triangle").hidden = true;
|
||||
@@ -41,6 +41,10 @@ function updateDlg() {
|
||||
function typeWriter() {
|
||||
if (typeindex < dlgLines[dlgPointer].length) {
|
||||
document.getElementById("dlg-text").innerHTML += dlgLines[dlgPointer].charAt(typeindex);
|
||||
if (voice != null && typeindex % 3 == 1) {
|
||||
voice.load();
|
||||
voice.play();
|
||||
}
|
||||
typeindex++;
|
||||
setTimeout(typeWriter, speed);
|
||||
} else if (allowNextDlg)
|
||||
@@ -65,6 +69,13 @@ function nextDlg(dlgPointerIncrease = true) {
|
||||
document.getElementById("title").innerHTML = dlgLines[dlgPointer].split(':')[1];
|
||||
nextDlg();
|
||||
}
|
||||
if (dlgLines[dlgPointer].split(":")[0] === "_voice") {
|
||||
if (dlgLines[dlgPointer].split(':')[1].length != 0)
|
||||
voice = new Audio("text_horror/assets/voices/" + dlgLines[dlgPointer].split(':')[1] + ".wav");
|
||||
else
|
||||
voice = null;
|
||||
nextDlg();
|
||||
}
|
||||
} else
|
||||
updateDlg();
|
||||
}
|
||||
|
BIN
text_horror/assets/voices/spitzkopf.wav
Normal file
BIN
text_horror/assets/voices/spitzkopf.wav
Normal file
Binary file not shown.
@@ -15,6 +15,7 @@
|
||||
],
|
||||
"Also Yes": [
|
||||
"_title:Spitzkopf",
|
||||
"_voice:spitzkopf",
|
||||
"That was a weird answer... Is anything wrong with you?",
|
||||
{
|
||||
"Yes my name is Peter": [
|
||||
|
Reference in New Issue
Block a user