tapitordie commited on
Commit
4752f23
·
verified ·
1 Parent(s): 67c1430

Add 2 files

Browse files
Files changed (2) hide show
  1. README.md +7 -5
  2. index.html +713 -19
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Tiod2
3
- emoji: 🐢
4
- colorFrom: gray
5
- colorTo: pink
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: tiod2
3
+ emoji: 🐳
4
+ colorFrom: blue
5
+ colorTo: blue
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite
10
  ---
11
 
12
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
index.html CHANGED
@@ -1,19 +1,713 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>TAP IT OR DIE!</title>
7
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
8
+ <style>
9
+ @import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');
10
+
11
+ * {
12
+ margin: 0;
13
+ padding: 0;
14
+ box-sizing: border-box;
15
+ }
16
+
17
+ body {
18
+ font-family: 'Press Start 2P', cursive;
19
+ background-color: #121212;
20
+ color: #00ff00;
21
+ text-align: center;
22
+ overflow: hidden;
23
+ height: 100vh;
24
+ -webkit-tap-highlight-color: transparent;
25
+ }
26
+
27
+ #game-container {
28
+ display: flex;
29
+ flex-direction: column;
30
+ justify-content: center;
31
+ align-items: center;
32
+ height: 100vh;
33
+ position: relative;
34
+ padding: 20px;
35
+ }
36
+
37
+ #start-screen {
38
+ position: absolute;
39
+ top: 0;
40
+ left: 0;
41
+ width: 100%;
42
+ height: 100%;
43
+ background: rgba(0, 0, 0, 0.9);
44
+ display: flex;
45
+ flex-direction: column;
46
+ justify-content: center;
47
+ align-items: center;
48
+ z-index: 100;
49
+ gap: 30px;
50
+ text-shadow: 0 0 10px #00ff00;
51
+ }
52
+
53
+ #game-title {
54
+ font-size: 3rem;
55
+ margin-bottom: 20px;
56
+ color: #ff0;
57
+ text-shadow: 0 0 10px #ff0, 0 0 20px #ff0;
58
+ animation: pulse 1.5s infinite alternate;
59
+ }
60
+
61
+ #game-over-screen {
62
+ position: absolute;
63
+ top: 0;
64
+ left: 0;
65
+ width: 100%;
66
+ height: 100%;
67
+ background: rgba(0, 0, 0, 0.9);
68
+ display: none;
69
+ flex-direction: column;
70
+ justify-content: center;
71
+ align-items: center;
72
+ z-index: 100;
73
+ gap: 30px;
74
+ }
75
+
76
+ #game-over-content {
77
+ position: relative;
78
+ z-index: 101;
79
+ }
80
+
81
+ button {
82
+ background: #00ff00;
83
+ color: #000;
84
+ border: none;
85
+ padding: 15px 30px;
86
+ font-family: 'Press Start 2P', cursive;
87
+ font-size: 1.2rem;
88
+ cursor: pointer;
89
+ border-radius: 5px;
90
+ transition: all 0.3s;
91
+ box-shadow: 0 0 10px #00ff00;
92
+ position: relative;
93
+ z-index: 101;
94
+ }
95
+
96
+ button:hover {
97
+ background: #ff0;
98
+ transform: scale(1.05);
99
+ box-shadow: 0 0 20px #ff0;
100
+ }
101
+
102
+ .game-info {
103
+ display: flex;
104
+ justify-content: space-between;
105
+ width: 100%;
106
+ max-width: 600px;
107
+ margin-bottom: 20px;
108
+ font-size: 1rem;
109
+ position: relative;
110
+ z-index: 10;
111
+ }
112
+
113
+ #game-board {
114
+ width: 100%;
115
+ max-width: 600px;
116
+ height: 400px;
117
+ border: 8px solid #333;
118
+ position: relative;
119
+ background-color: #000;
120
+ overflow: hidden;
121
+ box-shadow: inset 0 0 20px #000, 0 0 30px #00ff00;
122
+ }
123
+
124
+ .explosion {
125
+ position: absolute;
126
+ width: 60px;
127
+ height: 60px;
128
+ background-image: radial-gradient(circle, #ff0, #f80, #f00);
129
+ border-radius: 50%;
130
+ pointer-events: none;
131
+ transform: scale(0);
132
+ animation: explode 0.5s forwards;
133
+ z-index: 10;
134
+ }
135
+
136
+ .bomb {
137
+ position: absolute;
138
+ width: 40px;
139
+ height: 40px;
140
+ background-color: #333;
141
+ border-radius: 50%;
142
+ display: flex;
143
+ justify-content: center;
144
+ align-items: center;
145
+ cursor: pointer;
146
+ transition: transform 0.2s;
147
+ box-shadow: inset 0 0 10px #111, 0 0 10px #f00;
148
+ animation: bomb-pulse 1s infinite alternate;
149
+ z-index: 5;
150
+ }
151
+
152
+ .bomb::before {
153
+ content: "";
154
+ position: absolute;
155
+ width: 10px;
156
+ height: 10px;
157
+ background-color: #f00;
158
+ border-radius: 50%;
159
+ box-shadow: 0 0 10px #f00;
160
+ }
161
+
162
+ .bomb:hover {
163
+ transform: scale(1.1);
164
+ }
165
+
166
+ .bomb.ready {
167
+ background-color: #f00;
168
+ animation: danger-pulse 0.5s infinite alternate;
169
+ }
170
+
171
+ .bomb.ready::before {
172
+ background-color: #ff0;
173
+ }
174
+
175
+ .bomb-bonus {
176
+ background-color: #0af;
177
+ box-shadow: inset 0 0 10px #111, 0 0 10px #0af;
178
+ }
179
+
180
+ .bomb-bonus::before {
181
+ background-color: #fff;
182
+ }
183
+
184
+ #countdown {
185
+ font-size: 2rem;
186
+ margin: 20px 0;
187
+ text-shadow: 0 0 10px #00ff00;
188
+ position: relative;
189
+ z-index: 10;
190
+ }
191
+
192
+ #difficulty-selector {
193
+ margin: 20px 0;
194
+ display: flex;
195
+ gap: 10px;
196
+ position: relative;
197
+ z-index: 10;
198
+ }
199
+
200
+ #difficulty-selector button {
201
+ font-size: 0.8rem;
202
+ padding: 10px 15px;
203
+ }
204
+
205
+ #difficulty-selector button.active {
206
+ background: #ff0;
207
+ }
208
+
209
+ .scanlines {
210
+ position: absolute;
211
+ top: 0;
212
+ left: 0;
213
+ width: 100%;
214
+ height: 100%;
215
+ background: linear-gradient(
216
+ rgba(18, 16, 16, 0) 50%,
217
+ rgba(0, 0, 0, 0.25) 50%
218
+ );
219
+ background-size: 100% 4px;
220
+ pointer-events: none;
221
+ z-index: 5;
222
+ }
223
+
224
+ @keyframes pulse {
225
+ 0% { transform: scale(1); }
226
+ 100% { transform: scale(1.05); }
227
+ }
228
+
229
+ @keyframes bomb-pulse {
230
+ 0% { box-shadow: inset 0 0 10px #111, 0 0 5px #f00; }
231
+ 100% { box-shadow: inset 0 0 10px #111, 0 0 15px #f00; }
232
+ }
233
+
234
+ @keyframes danger-pulse {
235
+ 0% { box-shadow: inset 0 0 10px #111, 0 0 5px #f00; transform: scale(1); }
236
+ 100% { box-shadow: inset 0 0 10px #111, 0 0 20px #f00; transform: scale(1.1); }
237
+ }
238
+
239
+ @keyframes explode {
240
+ 0% { transform: scale(0); opacity: 1; }
241
+ 100% { transform: scale(4); opacity: 0; }
242
+ }
243
+
244
+ .leaderboard {
245
+ position: absolute;
246
+ right: 20px;
247
+ top: 20px;
248
+ background: rgba(0, 0, 0, 0.8);
249
+ border: 2px solid #00ff00;
250
+ padding: 10px;
251
+ max-height: 200px;
252
+ overflow-y: auto;
253
+ display: none;
254
+ z-index: 10;
255
+ }
256
+
257
+ .leaderboard h3 {
258
+ margin-bottom: 10px;
259
+ color: #ff0;
260
+ }
261
+
262
+ .leaderboard-entry {
263
+ display: flex;
264
+ justify-content: space-between;
265
+ margin-bottom: 5px;
266
+ font-size: 0.8rem;
267
+ }
268
+
269
+ .danger {
270
+ animation: danger-flash 0.2s infinite;
271
+ }
272
+
273
+ @keyframes danger-flash {
274
+ 0%, 100% { background-color: #121212; }
275
+ 50% { background-color: #330000; }
276
+ }
277
+
278
+ .game-over-explosion {
279
+ position: absolute;
280
+ width: 120px;
281
+ height: 120px;
282
+ background-image: radial-gradient(circle, #ff0, #f80, #f00);
283
+ border-radius: 50%;
284
+ pointer-events: none;
285
+ transform: scale(0);
286
+ animation: final-explode 1s forwards;
287
+ z-index: 100;
288
+ }
289
+
290
+ @keyframes final-explode {
291
+ 0% { transform: scale(0); opacity: 1; }
292
+ 100% { transform: scale(10); opacity: 0; }
293
+ }
294
+
295
+ .shake {
296
+ animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
297
+ }
298
+
299
+ @keyframes shake {
300
+ 10%, 90% { transform: translate3d(-1px, 0, 0); }
301
+ 20%, 80% { transform: translate3d(2px, 0, 0); }
302
+ 30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
303
+ 40%, 60% { transform: translate3d(4px, 0, 0); }
304
+ }
305
+
306
+ @media (max-width: 600px) {
307
+ #game-title {
308
+ font-size: 1.8rem;
309
+ }
310
+
311
+ button {
312
+ padding: 10px 20px;
313
+ font-size: 0.9rem;
314
+ }
315
+
316
+ .game-info {
317
+ font-size: 0.7rem;
318
+ }
319
+
320
+ #game-board {
321
+ height: 300px;
322
+ }
323
+
324
+ .bomb {
325
+ width: 30px;
326
+ height: 30px;
327
+ }
328
+
329
+ .leaderboard {
330
+ position: static;
331
+ margin-top: 20px;
332
+ width: 100%;
333
+ max-height: 100px;
334
+ }
335
+ }
336
+ </style>
337
+ </head>
338
+ <body>
339
+ <div id="game-container">
340
+ <div id="start-screen">
341
+ <h1 id="game-title">TAP IT OR DIE!</h1>
342
+ <p>Defuse the bombs before they explode!</p>
343
+ <p id="high-score-display">HIGH SCORE: 0</p>
344
+
345
+ <div id="difficulty-selector">
346
+ <button class="active" data-difficulty="easy">EASY</button>
347
+ <button data-difficulty="medium">MEDIUM</button>
348
+ <button data-difficulty="hard">HARD</button>
349
+ <button data-difficulty="insane">INSANE</button>
350
+ </div>
351
+
352
+ <button id="start-button">
353
+ <i class="fas fa-bomb"></i> START GAME <i class="fas fa-bomb"></i>
354
+ </button>
355
+ </div>
356
+
357
+ <div id="game-over-screen">
358
+ <div id="game-over-content">
359
+ <h1>GAME OVER!</h1>
360
+ <p>BOOM! You got exploded.</p>
361
+ <p id="final-score">SCORE: 0</p>
362
+ <button id="restart-button">TRY AGAIN</button>
363
+ </div>
364
+ </div>
365
+
366
+ <div class="game-info">
367
+ <div>SCORE: <span id="score">0</span></div>
368
+ <div>LIVES: <span id="lives">3</span></div>
369
+ </div>
370
+
371
+ <div id="countdown">GET READY!</div>
372
+
373
+ <div id="game-board">
374
+ <div class="scanlines"></div>
375
+ </div>
376
+
377
+ <div class="leaderboard">
378
+ <h3>TOP SCORES</h3>
379
+ <div id="leaderboard-entries"></div>
380
+ </div>
381
+ </div>
382
+
383
+ <script>
384
+ // Game variables
385
+ let score = 0;
386
+ let lives = 3;
387
+ let gameActive = false;
388
+ let gameTimer;
389
+ let bombCount = 0;
390
+ let difficulty = 'medium';
391
+ let highScore = localStorage.getItem('highScore') || 0;
392
+ let leaderboard = JSON.parse(localStorage.getItem('leaderboard')) || [];
393
+
394
+ // DOM elements
395
+ const gameContainer = document.getElementById('game-container');
396
+ const gameBoard = document.getElementById('game-board');
397
+ const scoreDisplay = document.getElementById('score');
398
+ const livesDisplay = document.getElementById('lives');
399
+ const startScreen = document.getElementById('start-screen');
400
+ const gameOverScreen = document.getElementById('game-over-screen');
401
+ const gameOverContent = document.getElementById('game-over-content');
402
+ const startButton = document.getElementById('start-button');
403
+ const restartButton = document.getElementById('restart-button');
404
+ const difficultyButtons = document.querySelectorAll('[data-difficulty]');
405
+ const countdownDisplay = document.getElementById('countdown');
406
+ const highScoreDisplay = document.getElementById('high-score-display');
407
+ const finalScoreDisplay = document.getElementById('final-score');
408
+ const leaderboardElement = document.querySelector('.leaderboard');
409
+ const leaderboardEntries = document.getElementById('leaderboard-entries');
410
+
411
+ // Initialize game
412
+ window.onload = function() {
413
+ updateHighScoreDisplay();
414
+ updateLeaderboardDisplay();
415
+
416
+ // Event listeners
417
+ startButton.addEventListener('click', startGame);
418
+ restartButton.addEventListener('click', restartGame);
419
+
420
+ difficultyButtons.forEach(button => {
421
+ button.addEventListener('click', function() {
422
+ difficulty = this.dataset.difficulty;
423
+ difficultyButtons.forEach(btn => btn.classList.remove('active'));
424
+ this.classList.add('active');
425
+ });
426
+ });
427
+
428
+ // Show leaderboard on hover of high score
429
+ highScoreDisplay.addEventListener('mouseenter', () => {
430
+ leaderboardElement.style.display = 'block';
431
+ });
432
+
433
+ highScoreDisplay.addEventListener('mouseleave', () => {
434
+ leaderboardElement.style.display = 'none';
435
+ });
436
+ };
437
+
438
+ function startGame() {
439
+ startScreen.style.display = 'none';
440
+ gameActive = true;
441
+ score = 0;
442
+ lives = 3;
443
+ bombCount = 0;
444
+
445
+ // Reset UI
446
+ scoreDisplay.textContent = score;
447
+ livesDisplay.textContent = lives;
448
+ document.body.classList.remove('danger');
449
+ gameOverScreen.style.display = 'none';
450
+
451
+ // Clear any existing bombs
452
+ gameBoard.querySelectorAll('.bomb').forEach(bomb => bomb.remove());
453
+
454
+ // Start countdown
455
+ let countdown = 3;
456
+ countdownDisplay.style.display = 'block';
457
+
458
+ const countdownInterval = setInterval(() => {
459
+ countdownDisplay.textContent = countdown > 0 ? countdown : 'GO!';
460
+
461
+ if (countdown <= 0) {
462
+ clearInterval(countdownInterval);
463
+ countdownDisplay.style.display = 'none';
464
+ startBombTimer();
465
+ }
466
+
467
+ countdown--;
468
+ }, 1000);
469
+ }
470
+
471
+ function startBombTimer() {
472
+ // Set bomb spawn interval based on difficulty
473
+ let spawnInterval;
474
+ let bombLifeTime;
475
+
476
+ switch(difficulty) {
477
+ case 'easy':
478
+ spawnInterval = 1500;
479
+ bombLifeTime = 4000;
480
+ break;
481
+ case 'medium':
482
+ spawnInterval = 1000;
483
+ bombLifeTime = 3000;
484
+ break;
485
+ case 'hard':
486
+ spawnInterval = 650;
487
+ bombLifeTime = 2000;
488
+ break;
489
+ case 'insane':
490
+ spawnInterval = 400;
491
+ bombLifeTime = 1500;
492
+ break;
493
+ }
494
+
495
+ gameTimer = setInterval(() => {
496
+ if (!gameActive) return;
497
+
498
+ createBomb(bombLifeTime);
499
+ bombCount++;
500
+
501
+ // Increase difficulty over time
502
+ if (bombCount % 10 === 0 && spawnInterval > 300) {
503
+ spawnInterval -= 100;
504
+ bombLifeTime = Math.max(bombLifeTime - 200, 1000);
505
+ clearInterval(gameTimer);
506
+ gameTimer = setInterval(arguments.callee, spawnInterval);
507
+ }
508
+ }, spawnInterval);
509
+ }
510
+
511
+ function createBomb(lifetime) {
512
+ const bomb = document.createElement('div');
513
+ bomb.className = 'bomb';
514
+
515
+ // 5% chance for a bonus bomb
516
+ if (Math.random() < 0.05) {
517
+ bomb.classList.add('bomb-bonus');
518
+ }
519
+
520
+ // Size variation
521
+ const size = 30 + Math.floor(Math.random() * 30);
522
+ bomb.style.width = `${size}px`;
523
+ bomb.style.height = `${size}px`;
524
+
525
+ // Position randomly on the game board
526
+ const maxX = gameBoard.offsetWidth - size;
527
+ const maxY = gameBoard.offsetHeight - size;
528
+ const x = Math.floor(Math.random() * maxX);
529
+ const y = Math.floor(Math.random() * maxY);
530
+
531
+ bomb.style.left = `${x}px`;
532
+ bomb.style.top = `${y}px`;
533
+
534
+ // Add click event to defuse the bomb
535
+ bomb.addEventListener('click', function() {
536
+ defuseBomb(this);
537
+ });
538
+
539
+ gameBoard.appendChild(bomb);
540
+
541
+ // Bomb becomes ready after short delay
542
+ setTimeout(() => {
543
+ bomb.classList.add('ready');
544
+ }, Math.random() * 1000);
545
+
546
+ // Bomb explodes after lifetime
547
+ const explodeTimer = setTimeout(() => {
548
+ if (bomb.parentNode === gameBoard) {
549
+ explodeBomb(bomb);
550
+ }
551
+ }, lifetime);
552
+
553
+ // Store timer on bomb for cleanup
554
+ bomb.dataset.timer = explodeTimer;
555
+ }
556
+
557
+ function defuseBomb(bomb) {
558
+ if (!bomb.classList.contains('ready')) return;
559
+
560
+ clearTimeout(bomb.dataset.timer);
561
+
562
+ // Check if it's a bonus bomb
563
+ const isBonus = bomb.classList.contains('bomb-bonus');
564
+
565
+ // Calculate points based on how quickly it was tapped
566
+ let points = isBonus ? 50 : 10;
567
+
568
+ // Add extra points for quick defuse
569
+ if (isBonus) {
570
+ points += Math.floor(Math.random() * 50);
571
+ } else {
572
+ points += Math.floor(Math.random() * 20);
573
+ }
574
+
575
+ score += points;
576
+ scoreDisplay.textContent = score;
577
+
578
+ createExplosion(bomb, isBonus ? '#0af' : '#00ff00');
579
+ bomb.remove();
580
+ }
581
+
582
+ function explodeBomb(bomb) {
583
+ if (!gameActive) return;
584
+
585
+ lives--;
586
+ livesDisplay.textContent = lives;
587
+
588
+ // Visual feedback when low on lives
589
+ if (lives === 1) {
590
+ document.body.classList.add('danger');
591
+ }
592
+
593
+ // Screen shake effect
594
+ gameContainer.classList.add('shake');
595
+ setTimeout(() => {
596
+ gameContainer.classList.remove('shake');
597
+ }, 500);
598
+
599
+ createExplosion(bomb, '#ff0000');
600
+ bomb.remove();
601
+
602
+ if (lives <= 0) {
603
+ endGame();
604
+ }
605
+ }
606
+
607
+ function createExplosion(element, color) {
608
+ const rect = element.getBoundingClientRect();
609
+ const gameRect = gameBoard.getBoundingClientRect();
610
+
611
+ const x = rect.left - gameRect.left + rect.width / 2;
612
+ const y = rect.top - gameRect.top + rect.height / 2;
613
+
614
+ const explosion = document.createElement('div');
615
+ explosion.className = 'explosion';
616
+ explosion.style.left = `${x - 30}px`;
617
+ explosion.style.top = `${y - 30}px`;
618
+ explosion.style.background = color;
619
+
620
+ gameBoard.appendChild(explosion);
621
+
622
+ // Remove explosion after animation
623
+ setTimeout(() => {
624
+ explosion.remove();
625
+ }, 500);
626
+ }
627
+
628
+ function createFinalExplosion() {
629
+ const gameRect = gameBoard.getBoundingClientRect();
630
+ const x = gameRect.width / 2;
631
+ const y = gameRect.height / 2;
632
+
633
+ const explosion = document.createElement('div');
634
+ explosion.className = 'game-over-explosion';
635
+ explosion.style.left = `${x - 60}px`;
636
+ explosion.style.top = `${y - 60}px`;
637
+
638
+ gameBoard.appendChild(explosion);
639
+
640
+ // Remove explosion after animation
641
+ setTimeout(() => {
642
+ explosion.remove();
643
+ }, 1000);
644
+ }
645
+
646
+ function endGame() {
647
+ gameActive = false;
648
+ clearInterval(gameTimer);
649
+
650
+ // Clear all bombs
651
+ gameBoard.querySelectorAll('.bomb').forEach(bomb => {
652
+ clearTimeout(bomb.dataset.timer);
653
+ bomb.remove();
654
+ });
655
+
656
+ // Big final explosion
657
+ createFinalExplosion();
658
+
659
+ // Update high score if needed
660
+ if (score > highScore) {
661
+ highScore = score;
662
+ localStorage.setItem('highScore', highScore);
663
+ updateHighScoreDisplay();
664
+ }
665
+
666
+ // Update leaderboard
667
+ updateLeaderboard(score);
668
+
669
+ // Show game over screen after explosion
670
+ setTimeout(() => {
671
+ finalScoreDisplay.textContent = `SCORE: ${score}`;
672
+ gameOverScreen.style.display = 'flex';
673
+ document.body.classList.remove('danger');
674
+ }, 1000);
675
+ }
676
+
677
+ function restartGame() {
678
+ gameOverScreen.style.display = 'none';
679
+ gameBoard.innerHTML = '<div class="scanlines"></div>';
680
+ startGame();
681
+ }
682
+
683
+ function updateHighScoreDisplay() {
684
+ highScoreDisplay.textContent = `HIGH SCORE: ${highScore}`;
685
+ }
686
+
687
+ function updateLeaderboard(newScore) {
688
+ // Add new score to leaderboard
689
+ leaderboard.push(newScore);
690
+
691
+ // Sort in descending order and keep top 5
692
+ leaderboard.sort((a, b) => b - a);
693
+ leaderboard = leaderboard.slice(0, 5);
694
+
695
+ // Save to localStorage
696
+ localStorage.setItem('leaderboard', JSON.stringify(leaderboard));
697
+
698
+ updateLeaderboardDisplay();
699
+ }
700
+
701
+ function updateLeaderboardDisplay() {
702
+ leaderboardEntries.innerHTML = '';
703
+
704
+ leaderboard.forEach((score, index) => {
705
+ const entry = document.createElement('div');
706
+ entry.className = 'leaderboard-entry';
707
+ entry.innerHTML = `<span>${index + 1}.</span> <span>${score}</span>`;
708
+ leaderboardEntries.appendChild(entry);
709
+ });
710
+ }
711
+ </script>
712
+ <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <a href="https://enzostvs-deepsite.hf.space" style="color: #fff;" target="_blank" >DeepSite</a> <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;"></p></body>
713
+ </html>