-
Notifications
You must be signed in to change notification settings - Fork 0
/
cheetah.html
121 lines (109 loc) · 3.83 KB
/
cheetah.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
<link rel="prefetch" href="./assets/ui/stars/0.png">
<link rel="prefetch" href="./assets/ui/stars/1.png">
<link rel="prefetch" href="./assets/ui/stars/2.png">
<link rel="prefetch" href="./assets/ui/stars/3.png">
<title>TypQwerty | Sreya Saju</title>
<body ondragstart="return false;" ondrop="return false;">
<div id="test">
<div class="progress-bar" id=progress-bar ></div>
<div style="text-align:center">
<br>
<h1 class="word" id="current-word">loading...</h1>
<div class="inputbox">
<input style="color:white" autofocus autocomplete="off" id="text-input" type="text" placeholder="Start Typing"></input>
</div>
<p>Time remaining:</p><p id="time"></p>
<p>Score:</p>
<p id="score"></p>
<div class="result" id="result"></div><br>
</div>
</div>
<div style="display:none;" class="firstbox" id=scoreboard><br>
<img id='star' class="star">
<p>Your score is </p><p id='grandscore'>--</p> <p>out of 14</p>
<button onclick="restartGame()" id="restart-button" class="orange">Restart</button>
</div>
<img class="sreyasaju" src="./assets/ui/sreyasaju.png">
<script src="./script.js"></script>
<script>
let time = 12
timeDisplay.innerHTML= time;
const questions = [
'apostrophe',
'chameleon',
'deficiency',
'escalator',
'flamboyant',
'miscellaneous',
'jewelry',
'honorary',
'internally',
'necessity',
'procrastinate',
'unpredictable',
'vulnerable',
'unconscious',
'persuade',
'optimism',
'metropolitan',
'integrity',
'inconvenience',
'confiscation',
'crypt',
'considerable',
'hospitality',
'innumerable',
'meteor',
'obscure',
'scheme',
'vaccinate',
'vocalize',
'unenforceable',
'pneumonia',
'obstinate',
'mesmerize',
'lieutenant',
'luxurious',
]
var maxQuestions = 14;
var scoreboard = document.getElementById("scoreboard")
var test = document.getElementById("test")
function checkIfPlaying() {
if((!is_playing && time === 0) || score === maxQuestions){
result.innerHTML= "Game Over!";
setGrandScore()
textInput.disabled = true;
scoreboard.style.display='block';
test.style.display='none';
setStars(score);
}
}
function setGrandScore(){
var grandscore = document.getElementById('grandscore')
grandscore.innerHTML= score
}
function restartGame(restart){
window.location.replace("cheetah.html");
}
function setStars(score){
let imgStar = document.getElementById("star")
if (score==14){
imgStar.src="./assets/ui/stars/3.png"
}else if(score <=13 && score >=7){
imgStar.src="./assets/ui/stars/2.png"
}else if(score <7 && score >=1){
imgStar.src="./assets/ui/stars/1.png"
}else{
imgStar.src="./assets/ui/stars/0.png"
};
}
</script>
</body>
</html>