-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbasicgameoutline.html
More file actions
147 lines (107 loc) · 3.16 KB
/
basicgameoutline.html
File metadata and controls
147 lines (107 loc) · 3.16 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
var questions = ["Which of these features suggest that a pulsation in the neck is arterial?","A palpable left parasternal impulse suggests which abnormality?"];
var answers = [["No variation with posture","Positive for hepatojugular reflux", "A waggling earlobe","Banter","Pressure in the root of the neck reduces the impulse"],["2No variation with posture","Positive for hepatojugular reflux","A waggling earlobe","No variation with posture","Pressure in the root of the neck reduces the impulse"]]
var score1 = 0;
var score2 = 0;
var turn = 0;
$(document).ready(function(){
function newQuestion(){
var i = 0; // the index of the current item to show
document
.getElementById('quest') //updates question
.innerHTML = questions[turn];
ans = answers[turn]
//displays answers
setInterval(function() {
var watch = turn;
document
.getElementById('ans')
.innerHTML = ans[i++]; // get the item and increment i to move to the next
if (i > 1) i = 0; // reset to first element if you've reached the end
console.log(turn)
}, 1000);
}
$("#btn1").click(function(){
newQuestion()
})
$("#btn2").click(function(){
var selec = document.getElementById('ans').innerHTML
if (answers[0] == selec)
{
console.log("win")
score1 = score1 + 1
}
else
{
console.log("loose")
score1 = score1 - 1
}
document
.getElementById('sc1')
.innerHTML = score1;
turn ++
if(turn > questions.length-1)
{
turn = 0
}
newQuestion()
})
$("#btn3").click(function(){
var selec = document
.getElementById('ans').innerHTML
if (answers[0] == selec)
{
console.log("win")
score2 = score2 + 1
}
else
{
console.log("loose")
score2 = score2 - 1
}
document
.getElementById('sc2')
.innerHTML = score2;
turn ++
newQuestion()
if(turn > questions.length-1)
{
turn = 0
}
newQuestion()
})
});
</script>
</head>
<!-- -->
<!-- <p id = "quest"></p>
<p id = "ans"></p>
<p id = "sc1"></p>
<p id = "sc2"></p>
<button id="btn1">Start</button>
<button id="btn2">P1</button>
<button id="btn3">P2</button> -->
<!-- -->
<html>
<body>
<head>
<link rel="stylesheet" href="static/design.css">
<title> Game Page </title>
</head>
<div class="positioning">
<p id="p1"> Other Text </p>
<button id="btn2">P1</button>
<p id="p2"> Text </p>
<p id="P1-Question"> Question </p>
<p id="P2-Question"> Question </p>
</div>
<div class="score-system">
<p id="p1-Score"> 0</p>
<p id="p2-Score"> 0</p>
</div>
</body>
</html>