-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
286 lines (243 loc) · 7.91 KB
/
script.js
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
var catImage = document.getElementById("catImage");
var happyButton = document.getElementById("happyButton");
var catSound = document.getElementById("catSound");
var isHappy = false;
var isSoundPlaying = false;
var soundPosition = 0;
happyButton.addEventListener("click", function() {
if (isHappy) {
catImage.src = "./Source/HappyCat/HappyCatStop.gif";
if (isSoundPlaying) {
catSound.pause();
soundPosition = catSound.currentTime;
isSoundPlaying = false;
}
happyButton.textContent = "Happy";
isHappy = false;
} else {
catImage.src = "./Source/HappyCat/HappyCat.gif";
if (!isSoundPlaying) {
catSound.currentTime = soundPosition;
catSound.play();
isSoundPlaying = true;
}
happyButton.textContent = "Stop";
isHappy = true;
}
});
catSound.addEventListener("pause", function() {
isSoundPlaying = false;
});
catSound.addEventListener("play", function() {
isSoundPlaying = true;
});
catSound.addEventListener("ended", function() {
// Replay the sound from the beginning
catSound.currentTime = 0;
catSound.play();
});
var theRockCatImage = document.getElementById("theRockCatImage");
var susButton = document.getElementById("susButton");
var theRockSound = document.getElementById("theRockSound");
var isSUSPlaying = false;
var susSoundPosition = 0;
susButton.addEventListener("click", function() {
if (!isSUSPlaying) {
theRockSound.currentTime = susSoundPosition;
theRockSound.play();
isSUSPlaying = true;
theRockCatImage.src = "./Source/TheRockCat/TheRockCat.gif";
setTimeout(function() {
theRockCatImage.src = "./Source/TheRockCat/TheRockCatPic.png";
susButton.textContent = "SUS!";
isSUSPlaying = false;
}, 1500);
}
});
theRockSound.addEventListener("ended", function() {
// Reset the state
theRockSound.pause();
theRockSound.currentTime = 0;
isSUSPlaying = false;
});
var cryingCatImage = document.getElementById("cryingCatImage");
var cryButton = document.getElementById("cryButton");
var cryingCatSound = document.getElementById("cryingCatSound");
var isCrying = false;
var isCryingSoundPlaying = false;
var cryingSoundPosition = 0;
cryButton.addEventListener("click", function() {
if (isCrying) {
cryingCatImage.src = "./Source/CryingCat/CryingCatRun.gif";
if (isCryingSoundPlaying) {
cryingCatSound.pause();
cryingSoundPosition = cryingCatSound.currentTime;
isCryingSoundPlaying = false;
}
cryButton.textContent = "Cry";
isCrying = false;
} else {
cryingCatImage.src = "./Source/CryingCat/CryingCat.gif";
if (!isCryingSoundPlaying) {
cryingCatSound.currentTime = cryingSoundPosition;
cryingCatSound.play();
isCryingSoundPlaying = true;
}
cryButton.textContent = "Stop";
isCrying = true;
}
});
cryingCatSound.addEventListener("pause", function() {
isCryingSoundPlaying = false;
});
cryingCatSound.addEventListener("play", function() {
isCryingSoundPlaying = true;
});
cryingCatSound.addEventListener("ended", function() {
// Replay the sound from the beginning
cryingCatSound.currentTime = 0;
cryingCatSound.play();
});
// ...existing code...
var tomChingChengCatImage = document.getElementById("tomChingChengCatImage");
var spinButton = document.getElementById("spinButton");
var chingChengSound = document.getElementById("tomChingChengSound");
var isSpinning = false;
var isChingChengSoundPlaying = false;
var chingChengSoundPosition = 0;
spinButton.addEventListener("click", function() {
if (isSpinning) {
tomChingChengCatImage.src = "./Source/TomChingCheng/TomChingChengPic.png";
if (isChingChengSoundPlaying) {
chingChengSound.pause();
chingChengSoundPosition = chingChengSound.currentTime;
isChingChengSoundPlaying = false;
}
spinButton.textContent = "Spin";
isSpinning = false;
} else {
tomChingChengCatImage.src = "./Source/TomChingCheng/TomChingCheng.gif";
if (!isChingChengSoundPlaying) {
chingChengSound.currentTime = chingChengSoundPosition;
chingChengSound.play();
isChingChengSoundPlaying = true;
}
spinButton.textContent = "Stop";
isSpinning = true;
}
});
chingChengSound.addEventListener("pause", function() {
isChingChengSoundPlaying = false;
});
chingChengSound.addEventListener("play", function() {
isChingChengSoundPlaying = true;
});
chingChengSound.addEventListener("ended", function() {
// Replay the sound from the beginning
chingChengSound.currentTime = 0;
chingChengSound.play();
});
// ...existing code...
var popCatImage = document.getElementById("popCatImage");
var popButton = document.getElementById("popButton");
var popCatSound = document.getElementById("popCatSound");
var isPopPlaying = false;
var popSoundPosition = 0;
popButton.addEventListener("click", function() {
if (!isPopPlaying) {
popCatSound.currentTime = popSoundPosition;
popCatSound.play();
isPopPlaying = true;
popCatImage.src = "./Source/PopCat/PopCat.gif";
setTimeout(function() {
popCatImage.src = "./Source/PopCat/PopCatPic.gif";
popButton.textContent = "Pop";
isPopPlaying = false;
}, 300);
}
});
popCatSound.addEventListener("ended", function() {
// Reset the state
popCatSound.pause();
popCatSound.currentTime = 0;
isPopPlaying = false;
});
// ...existing code...
// ...existing code...
// ...existing code...
var oiiaCatImage = document.getElementById("oiiaCatImage");
var oiiaButton = document.getElementById("oiiaSpinButton");
var oiiaCatSound = document.getElementById("oiiaCatSound");
var isOiiaSpinning = false;
var isOiiaSoundPlaying = false;
var oiiaSoundPosition = 0;
oiiaButton.addEventListener("click", function() {
if (isOiiaSpinning) {
oiiaCatImage.src = "./Source/OiiaCat/OiiaCat.png";
if (isOiiaSoundPlaying) {
oiiaCatSound.pause();
oiiaSoundPosition = oiiaCatSound.currentTime;
isOiiaSoundPlaying = false;
}
oiiaButton.textContent = "Spin";
isOiiaSpinning = false;
} else {
oiiaCatImage.src = "./Source/OiiaCat/OiiaCatSpin.gif";
if (!isOiiaSoundPlaying) {
oiiaCatSound.currentTime = oiiaSoundPosition;
oiiaCatSound.play();
isOiiaSoundPlaying = true;
}
oiiaButton.textContent = "Stop";
isOiiaSpinning = true;
}
});
oiiaCatSound.addEventListener("pause", function() {
isOiiaSoundPlaying = false;
});
oiiaCatSound.addEventListener("play", function() {
isOiiaSoundPlaying = true;
});
oiiaCatSound.addEventListener("ended", function() {
// Replay the sound from the beginning
oiiaCatSound.currentTime = 0;
oiiaCatSound.play();
});
//-----
var cheemsImage = document.getElementById("cheemsImage");
var bonkButton = document.getElementById("bonkButton");
var continuousBonkButton = document.getElementById("continuousBonkButton");
var bonkSound = document.getElementById("bonkSound");
var isContinuousBonking = false;
var bonkInterval;
bonkSound.volume = 1.0; // Set volume to maximum (adjust as needed)
bonkButton.addEventListener("click", function() {
cheemsImage.src = "./Source/Cheems/Bonk!.png";
bonkSound.play();
setTimeout(function() {
cheemsImage.src = "./Source/Cheems/2Cheems.png";
}, bonkSound.duration * 1000);
});
continuousBonkButton.addEventListener("click", function() {
if (!isContinuousBonking) {
isContinuousBonking = true;
continuousBonkButton.textContent = "Stop";
// Execute the bonk code immediately
function bonk() {
cheemsImage.src = "./Source/Cheems/Bonk!.png";
bonkSound.currentTime = 0; // Reset the sound to the beginning
bonkSound.play();
setTimeout(function() {
cheemsImage.src = "./Source/Cheems/2Cheems.png";
}, bonkSound.duration * 1000);
}
bonk(); // Execute the bonk code immediately
// Start the interval after the first bonk
bonkInterval = setInterval(bonk, bonkSound.duration * 2000);
} else {
isContinuousBonking = false;
continuousBonkButton.textContent = "Ultra Bonk";
clearInterval(bonkInterval);
}
});
// ...existing code...