-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnpc.js
More file actions
61 lines (54 loc) · 1.08 KB
/
npc.js
File metadata and controls
61 lines (54 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
var answers = new Array();
var answer = null;
var answerTarget = null;
function showDialog(s)
{
dialogWin = document.getElementById("dialog");
s2 = "<p>"+s+"<br>";
for (var i = 0; id < answers.length; i++)
{
s2 += (i+1)+". "+answers[i]+"<br>";
}
if (answers.length == 0) s2 += "[press Q]";
s2 += "</p>";
dialogWin.innerHTML = s2;
dialogWin.style.top = (gameHeight-200)/2+"px";
dialogWin.style.left = (gameWidth-200)/2+"px";
dialogWin.style.display = "inline";
freezeGame = true;
}
function hideDialog()
{
document.getElementById("dialog").style.display = "none";
freezeGame = false;
}
function clearAnswers()
{
answers.length = 0;
}
function addAnswer(s)
{
answers[answers.length] = s;
}
nteract = function(a)
{
clearAnswers();
addAnswer("Fuck you too!");
addAnswer("Love you!");
showDialog("Fuck you off!");
answerTarget = this;
answer = function(s)
{
if (s == "Fuck you too!")
{
clearAnswers();
answerTarget.HP = 0;
showDialog("Hate myself...");
}
if (s == "Love you!")
{
clearAnswers();
showDialog("Really?");
}
};
};