HammadRehman commited on
Commit
3ef2fd7
·
verified ·
1 Parent(s): a1982b7

Add 3 files

Browse files
Files changed (3) hide show
  1. README.md +6 -4
  2. index.html +568 -19
  3. prompts.txt +0 -0
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Hammad S Space
3
- emoji: 🚀
4
- colorFrom: purple
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: hammad-s-space
3
+ emoji: 🐳
4
+ colorFrom: green
5
  colorTo: pink
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,568 @@
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>Cyber Car Racing</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
9
+ <style>
10
+ @import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&display=swap');
11
+
12
+ body {
13
+ font-family: 'Orbitron', sans-serif;
14
+ background-color: #0f0f1a;
15
+ overflow: hidden;
16
+ color: #00fffc;
17
+ }
18
+
19
+ .track {
20
+ background: linear-gradient(90deg, #111122 0%, #111122 50%, #222233 50%, #222233 100%);
21
+ background-size: 50px 100%;
22
+ }
23
+
24
+ .car {
25
+ transition: transform 0.1s ease-out;
26
+ }
27
+
28
+ .obstacle {
29
+ animation: obstacleMove linear infinite;
30
+ }
31
+
32
+ @keyframes obstacleMove {
33
+ from { transform: translateY(-100px); }
34
+ to { transform: translateY(100vh); }
35
+ }
36
+
37
+ .glow {
38
+ text-shadow: 0 0 10px #00fffc, 0 0 20px #00fffc;
39
+ }
40
+
41
+ .pulse {
42
+ animation: pulse 1.5s infinite;
43
+ }
44
+
45
+ @keyframes pulse {
46
+ 0% { opacity: 1; }
47
+ 50% { opacity: 0.5; }
48
+ 100% { opacity: 1; }
49
+ }
50
+
51
+ .road-mark {
52
+ position: absolute;
53
+ width: 10px;
54
+ height: 50px;
55
+ background: #00fffc;
56
+ box-shadow: 0 0 10px #00fffc;
57
+ }
58
+
59
+ .highscore-table {
60
+ background: rgba(15, 15, 26, 0.9);
61
+ border: 2px solid #00fffc;
62
+ box-shadow: 0 0 20px #00fffc;
63
+ }
64
+
65
+ .highscore-table th {
66
+ background: rgba(0, 255, 252, 0.2);
67
+ }
68
+
69
+ .highscore-table tr:nth-child(even) {
70
+ background: rgba(0, 255, 252, 0.05);
71
+ }
72
+
73
+ .highscore-table tr:hover {
74
+ background: rgba(0, 255, 252, 0.1);
75
+ }
76
+
77
+ .tab-button {
78
+ transition: all 0.3s ease;
79
+ }
80
+
81
+ .tab-button.active {
82
+ background: rgba(0, 255, 252, 0.2);
83
+ border-bottom: 2px solid #00fffc;
84
+ }
85
+ </style>
86
+ </head>
87
+ <body class="h-screen w-screen flex flex-col items-center justify-center relative overflow-hidden">
88
+ <!-- Main Game Container -->
89
+ <div id="gameContainer" class="relative w-full h-full">
90
+ <!-- Game Over Screen (Hidden Initially) -->
91
+ <div id="gameOverScreen" class="absolute inset-0 bg-black bg-opacity-80 flex flex-col items-center justify-center z-50 hidden">
92
+ <h1 class="text-6xl font-bold mb-8 text-red-500 glow">GAME OVER</h1>
93
+ <p class="text-2xl mb-4">Your Score: <span id="finalScore" class="text-yellow-400">0</span></p>
94
+ <div class="mb-8 w-64">
95
+ <label for="playerName" class="block text-lg mb-2">Enter your name:</label>
96
+ <input type="text" id="playerName" class="w-full px-4 py-2 bg-gray-800 border border-blue-400 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500" maxlength="15" placeholder="Player">
97
+ </div>
98
+ <button id="saveScoreBtn" class="px-8 py-4 bg-blue-600 hover:bg-blue-700 rounded-lg text-xl font-bold transition-all transform hover:scale-105 mb-4">
99
+ <i class="fas fa-save mr-2"></i> Save Score
100
+ </button>
101
+ <button id="restartBtn" class="px-8 py-4 bg-green-600 hover:bg-green-700 rounded-lg text-xl font-bold transition-all transform hover:scale-105">
102
+ <i class="fas fa-redo mr-2"></i> Play Again
103
+ </button>
104
+ </div>
105
+
106
+ <!-- Start Screen -->
107
+ <div id="startScreen" class="absolute inset-0 bg-black bg-opacity-80 flex flex-col items-center justify-center z-40">
108
+ <h1 class="text-6xl md:text-8xl font-bold mb-8 text-blue-400 glow">CYBER RACER</h1>
109
+ <div class="flex flex-col items-center mb-12">
110
+ <p class="text-xl md:text-2xl mb-4 text-center max-w-2xl px-4">
111
+ Navigate through the neon-lit cyber highway, avoid obstacles, and survive as long as you can!
112
+ </p>
113
+ <div class="flex items-center text-yellow-400 text-lg mb-2">
114
+ <i class="fas fa-arrow-left mr-2"></i>
115
+ <span>Left Arrow - Move Left</span>
116
+ </div>
117
+ <div class="flex items-center text-yellow-400 text-lg">
118
+ <i class="fas fa-arrow-right mr-2"></i>
119
+ <span>Right Arrow - Move Right</span>
120
+ </div>
121
+ </div>
122
+ <div class="flex space-x-4 mb-8">
123
+ <button id="startBtn" class="px-8 py-4 bg-green-600 hover:bg-green-700 rounded-lg text-2xl font-bold transition-all transform hover:scale-105 pulse">
124
+ <i class="fas fa-play mr-2"></i> Start Race
125
+ </button>
126
+ <button id="highscoresBtn" class="px-8 py-4 bg-purple-600 hover:bg-purple-700 rounded-lg text-2xl font-bold transition-all transform hover:scale-105">
127
+ <i class="fas fa-trophy mr-2"></i> High Scores
128
+ </button>
129
+ </div>
130
+ </div>
131
+
132
+ <!-- High Scores Screen -->
133
+ <div id="highscoresScreen" class="absolute inset-0 bg-black bg-opacity-80 flex flex-col items-center justify-center z-50 hidden">
134
+ <h1 class="text-6xl font-bold mb-8 text-yellow-400 glow">HIGH SCORES</h1>
135
+
136
+ <div class="flex mb-6 space-x-2">
137
+ <button id="allTimeTab" class="tab-button px-6 py-2 rounded-t-lg text-lg font-bold active">All-Time</button>
138
+ <button id="weeklyTab" class="tab-button px-6 py-2 rounded-t-lg text-lg font-bold">This Week</button>
139
+ </div>
140
+
141
+ <div class="highscore-table w-full max-w-2xl max-h-96 overflow-y-auto rounded-lg mb-8">
142
+ <table class="w-full">
143
+ <thead>
144
+ <tr>
145
+ <th class="px-6 py-3 text-left">Rank</th>
146
+ <th class="px-6 py-3 text-left">Player</th>
147
+ <th class="px-6 py-3 text-left">Score</th>
148
+ <th class="px-6 py-3 text-left">Date</th>
149
+ </tr>
150
+ </thead>
151
+ <tbody id="highscoresTable">
152
+ <!-- Scores will be inserted here -->
153
+ </tbody>
154
+ </table>
155
+ </div>
156
+
157
+ <button id="backToMenuBtn" class="px-8 py-4 bg-blue-600 hover:bg-blue-700 rounded-lg text-xl font-bold transition-all transform hover:scale-105">
158
+ <i class="fas fa-arrow-left mr-2"></i> Back to Menu
159
+ </button>
160
+ </div>
161
+
162
+ <!-- Game UI -->
163
+ <div class="absolute top-0 left-0 right-0 p-4 flex justify-between items-center z-30">
164
+ <div class="flex items-center">
165
+ <div class="bg-black bg-opacity-70 px-4 py-2 rounded-lg mr-4">
166
+ <span class="text-lg">Score:</span>
167
+ <span id="score" class="text-2xl font-bold ml-2 text-yellow-400">0</span>
168
+ </div>
169
+ <div class="bg-black bg-opacity-70 px-4 py-2 rounded-lg">
170
+ <span class="text-lg">High Score:</span>
171
+ <span id="highScore" class="text-2xl font-bold ml-2 text-green-400">0</span>
172
+ </div>
173
+ </div>
174
+ <div class="bg-black bg-opacity-70 px-4 py-2 rounded-lg">
175
+ <span class="text-lg">Speed:</span>
176
+ <span id="speed" class="text-2xl font-bold ml-2 text-red-400">1x</span>
177
+ </div>
178
+ </div>
179
+
180
+ <!-- Track -->
181
+ <div id="track" class="track w-full h-full relative overflow-hidden">
182
+ <!-- Road marks will be generated by JavaScript -->
183
+ </div>
184
+
185
+ <!-- Player Car -->
186
+ <div id="playerCar" class="car absolute bottom-20 left-1/2 transform -translate-x-1/2 w-16 h-28 z-20">
187
+ <div class="relative w-full h-full">
188
+ <!-- Car body -->
189
+ <div class="absolute inset-0 bg-gradient-to-b from-blue-500 to-blue-800 rounded-lg">
190
+ <div class="absolute top-0 left-0 right-0 h-4 bg-blue-300 rounded-t-lg"></div>
191
+ <div class="absolute bottom-0 left-0 right-0 h-2 bg-blue-900 rounded-b-lg"></div>
192
+ <!-- Neon effect -->
193
+ <div class="absolute inset-0 border-2 border-blue-300 rounded-lg opacity-50"></div>
194
+ </div>
195
+ <!-- Windows -->
196
+ <div class="absolute top-2 left-2 right-2 h-8 bg-blue-200 bg-opacity-30 rounded-sm"></div>
197
+ <!-- Headlights -->
198
+ <div class="absolute bottom-0 left-2 w-4 h-2 bg-yellow-200 rounded-full"></div>
199
+ <div class="absolute bottom-0 right-2 w-4 h-2 bg-yellow-200 rounded-full"></div>
200
+ <!-- Neon glow -->
201
+ <div class="absolute -bottom-2 left-0 right-0 h-1 bg-blue-300 blur-sm"></div>
202
+ </div>
203
+ </div>
204
+ </div>
205
+
206
+ <script>
207
+ // Game variables
208
+ let gameRunning = false;
209
+ let score = 0;
210
+ let highScore = localStorage.getItem('highScore') || 0;
211
+ let speed = 1;
212
+ let speedIncreaseInterval;
213
+ let obstacleInterval;
214
+ let roadMarkInterval;
215
+ let playerPosition = 2; // 1: left, 2: center, 3: right
216
+ let lanes = [20, 50, 80]; // Percentage positions for lanes
217
+
218
+ // High scores data
219
+ let allTimeHighscores = JSON.parse(localStorage.getItem('allTimeHighscores')) || [];
220
+ let weeklyHighscores = JSON.parse(localStorage.getItem('weeklyHighscores')) || [];
221
+ let currentTab = 'allTime';
222
+
223
+ // DOM elements
224
+ const startScreen = document.getElementById('startScreen');
225
+ const gameOverScreen = document.getElementById('gameOverScreen');
226
+ const highscoresScreen = document.getElementById('highscoresScreen');
227
+ const startBtn = document.getElementById('startBtn');
228
+ const highscoresBtn = document.getElementById('highscoresBtn');
229
+ const backToMenuBtn = document.getElementById('backToMenuBtn');
230
+ const restartBtn = document.getElementById('restartBtn');
231
+ const saveScoreBtn = document.getElementById('saveScoreBtn');
232
+ const scoreElement = document.getElementById('score');
233
+ const highScoreElement = document.getElementById('highScore');
234
+ const finalScoreElement = document.getElementById('finalScore');
235
+ const speedElement = document.getElementById('speed');
236
+ const track = document.getElementById('track');
237
+ const playerCar = document.getElementById('playerCar');
238
+ const playerNameInput = document.getElementById('playerName');
239
+ const highscoresTable = document.getElementById('highscoresTable');
240
+ const allTimeTab = document.getElementById('allTimeTab');
241
+ const weeklyTab = document.getElementById('weeklyTab');
242
+
243
+ // Initialize high score display
244
+ highScoreElement.textContent = highScore;
245
+
246
+ // Event listeners
247
+ startBtn.addEventListener('click', startGame);
248
+ highscoresBtn.addEventListener('click', showHighscores);
249
+ backToMenuBtn.addEventListener('click', backToMenu);
250
+ restartBtn.addEventListener('click', startGame);
251
+ saveScoreBtn.addEventListener('click', saveScore);
252
+ allTimeTab.addEventListener('click', () => switchTab('allTime'));
253
+ weeklyTab.addEventListener('click', () => switchTab('weekly'));
254
+
255
+ document.addEventListener('keydown', (e) => {
256
+ if (!gameRunning) return;
257
+
258
+ if (e.key === 'ArrowLeft' && playerPosition > 1) {
259
+ playerPosition--;
260
+ updateCarPosition();
261
+ } else if (e.key === 'ArrowRight' && playerPosition < 3) {
262
+ playerPosition++;
263
+ updateCarPosition();
264
+ }
265
+ });
266
+
267
+ // Update car position based on playerPosition
268
+ function updateCarPosition() {
269
+ playerCar.style.left = `${lanes[playerPosition - 1]}%`;
270
+ }
271
+
272
+ // Start the game
273
+ function startGame() {
274
+ // Reset game state
275
+ gameRunning = true;
276
+ score = 0;
277
+ speed = 1;
278
+ playerPosition = 2;
279
+ updateCarPosition();
280
+
281
+ // Clear any existing obstacles
282
+ document.querySelectorAll('.obstacle').forEach(obs => obs.remove());
283
+ document.querySelectorAll('.road-mark').forEach(mark => mark.remove());
284
+
285
+ // Update UI
286
+ startScreen.classList.add('hidden');
287
+ gameOverScreen.classList.add('hidden');
288
+ highscoresScreen.classList.add('hidden');
289
+ scoreElement.textContent = score;
290
+ speedElement.textContent = `${speed}x`;
291
+
292
+ // Start game loops
293
+ speedIncreaseInterval = setInterval(increaseSpeed, 5000);
294
+ obstacleInterval = setInterval(createObstacle, 2000 / speed);
295
+ roadMarkInterval = setInterval(createRoadMarks, 300);
296
+
297
+ // Initial road marks
298
+ for (let i = 0; i < 5; i++) {
299
+ createRoadMarks(i * 200);
300
+ }
301
+ }
302
+
303
+ // Increase game speed over time
304
+ function increaseSpeed() {
305
+ speed += 0.2;
306
+ speedElement.textContent = `${speed.toFixed(1)}x`;
307
+
308
+ // Adjust obstacle creation interval based on speed
309
+ clearInterval(obstacleInterval);
310
+ obstacleInterval = setInterval(createObstacle, 2000 / speed);
311
+ }
312
+
313
+ // Create road marks (dashed lines)
314
+ function createRoadMarks(offset = 0) {
315
+ for (let i = 0; i < 3; i++) {
316
+ const mark = document.createElement('div');
317
+ mark.className = 'road-mark';
318
+ mark.style.left = `${lanes[i]}%`;
319
+ mark.style.top = `-50px`;
320
+ mark.style.transform = `translateX(-50%) translateY(${offset}px)`;
321
+ track.appendChild(mark);
322
+
323
+ // Animate the mark
324
+ const animation = mark.animate(
325
+ [{ top: '-50px' }, { top: '100vh' }],
326
+ { duration: 3000 / speed, fill: 'forwards' }
327
+ );
328
+
329
+ animation.onfinish = () => mark.remove();
330
+ }
331
+ }
332
+
333
+ // Create obstacles
334
+ function createObstacle() {
335
+ if (!gameRunning) return;
336
+
337
+ const obstacleTypes = ['car', 'truck', 'barrier'];
338
+ const type = obstacleTypes[Math.floor(Math.random() * obstacleTypes.length)];
339
+ const lane = Math.floor(Math.random() * 3) + 1;
340
+
341
+ const obstacle = document.createElement('div');
342
+ obstacle.className = `obstacle absolute w-16 h-16 z-10`;
343
+ obstacle.style.left = `${lanes[lane - 1]}%`;
344
+ obstacle.style.top = '-100px';
345
+ obstacle.style.transform = 'translateX(-50%)';
346
+
347
+ // Different obstacle styles
348
+ if (type === 'car') {
349
+ obstacle.innerHTML = `
350
+ <div class="relative w-full h-full">
351
+ <div class="absolute inset-0 bg-gradient-to-b from-red-500 to-red-800 rounded-lg">
352
+ <div class="absolute top-0 left-0 right-0 h-3 bg-red-300 rounded-t-lg"></div>
353
+ <div class="absolute bottom-0 left-0 right-0 h-2 bg-red-900 rounded-b-lg"></div>
354
+ <div class="absolute inset-0 border-2 border-red-300 rounded-lg opacity-50"></div>
355
+ </div>
356
+ <div class="absolute top-1 left-1 right-1 h-4 bg-red-200 bg-opacity-30 rounded-sm"></div>
357
+ <div class="absolute -bottom-1 left-0 right-0 h-1 bg-red-300 blur-sm"></div>
358
+ </div>
359
+ `;
360
+ obstacle.style.height = '28px';
361
+ } else if (type === 'truck') {
362
+ obstacle.innerHTML = `
363
+ <div class="relative w-full h-full">
364
+ <div class="absolute inset-0 bg-gradient-to-b from-purple-500 to-purple-800 rounded-lg">
365
+ <div class="absolute top-0 left-0 right-0 h-3 bg-purple-300 rounded-t-lg"></div>
366
+ <div class="absolute bottom-0 left-0 right-0 h-2 bg-purple-900 rounded-b-lg"></div>
367
+ <div class="absolute inset-0 border-2 border-purple-300 rounded-lg opacity-50"></div>
368
+ </div>
369
+ <div class="absolute top-1 left-1 right-1 h-4 bg-purple-200 bg-opacity-30 rounded-sm"></div>
370
+ <div class="absolute -bottom-1 left-0 right-0 h-1 bg-purple-300 blur-sm"></div>
371
+ </div>
372
+ `;
373
+ obstacle.style.height = '40px';
374
+ } else { // barrier
375
+ obstacle.innerHTML = `
376
+ <div class="relative w-full h-full flex items-center justify-center">
377
+ <div class="w-4 h-8 bg-yellow-500 border-2 border-yellow-300"></div>
378
+ <div class="w-4 h-8 bg-yellow-500 border-2 border-yellow-300 ml-1"></div>
379
+ <div class="w-4 h-8 bg-yellow-500 border-2 border-yellow-300 ml-1"></div>
380
+ </div>
381
+ `;
382
+ obstacle.style.height = '32px';
383
+ }
384
+
385
+ track.appendChild(obstacle);
386
+
387
+ // Animate obstacle
388
+ const animation = obstacle.animate(
389
+ [{ top: '-100px' }, { top: '100vh' }],
390
+ { duration: 4000 / speed, fill: 'forwards' }
391
+ );
392
+
393
+ animation.onfinish = () => {
394
+ if (!gameRunning) return;
395
+ obstacle.remove();
396
+ increaseScore();
397
+ };
398
+
399
+ // Collision detection
400
+ const collisionCheck = setInterval(() => {
401
+ if (!gameRunning) {
402
+ clearInterval(collisionCheck);
403
+ return;
404
+ }
405
+
406
+ const obstacleRect = obstacle.getBoundingClientRect();
407
+ const playerRect = playerCar.getBoundingClientRect();
408
+
409
+ if (
410
+ obstacleRect.bottom >= playerRect.top &&
411
+ obstacleRect.top <= playerRect.bottom &&
412
+ obstacleRect.right >= playerRect.left &&
413
+ obstacleRect.left <= playerRect.right
414
+ ) {
415
+ gameOver();
416
+ clearInterval(collisionCheck);
417
+ }
418
+ }, 16);
419
+ }
420
+
421
+ // Increase score
422
+ function increaseScore() {
423
+ score += Math.floor(speed * 10);
424
+ scoreElement.textContent = score;
425
+ }
426
+
427
+ // Game over
428
+ function gameOver() {
429
+ gameRunning = false;
430
+
431
+ // Clear intervals
432
+ clearInterval(speedIncreaseInterval);
433
+ clearInterval(obstacleInterval);
434
+ clearInterval(roadMarkInterval);
435
+
436
+ // Update high score if needed
437
+ if (score > highScore) {
438
+ highScore = score;
439
+ localStorage.setItem('highScore', highScore);
440
+ highScoreElement.textContent = highScore;
441
+ }
442
+
443
+ // Show game over screen
444
+ finalScoreElement.textContent = score;
445
+ gameOverScreen.classList.remove('hidden');
446
+
447
+ // Explosion effect
448
+ const explosion = document.createElement('div');
449
+ explosion.className = 'absolute w-32 h-32 bg-red-500 rounded-full opacity-70 z-30';
450
+ explosion.style.left = `${playerCar.offsetLeft - 32}px`;
451
+ explosion.style.top = `${playerCar.offsetTop - 32}px`;
452
+ explosion.style.transform = 'scale(0)';
453
+ explosion.style.transition = 'transform 0.5s ease-out';
454
+ track.appendChild(explosion);
455
+
456
+ setTimeout(() => {
457
+ explosion.style.transform = 'scale(1)';
458
+ explosion.style.opacity = '0';
459
+ }, 10);
460
+
461
+ setTimeout(() => explosion.remove(), 1000);
462
+ }
463
+
464
+ // Show highscores screen
465
+ function showHighscores() {
466
+ startScreen.classList.add('hidden');
467
+ highscoresScreen.classList.remove('hidden');
468
+ updateHighscoresTable();
469
+ }
470
+
471
+ // Back to menu from highscores
472
+ function backToMenu() {
473
+ highscoresScreen.classList.add('hidden');
474
+ startScreen.classList.remove('hidden');
475
+ }
476
+
477
+ // Switch between all-time and weekly highscores
478
+ function switchTab(tab) {
479
+ currentTab = tab;
480
+
481
+ // Update active tab styling
482
+ allTimeTab.classList.remove('active');
483
+ weeklyTab.classList.remove('active');
484
+
485
+ if (tab === 'allTime') {
486
+ allTimeTab.classList.add('active');
487
+ } else {
488
+ weeklyTab.classList.add('active');
489
+ }
490
+
491
+ updateHighscoresTable();
492
+ }
493
+
494
+ // Update highscores table
495
+ function updateHighscoresTable() {
496
+ const scores = currentTab === 'allTime' ? allTimeHighscores : weeklyHighscores;
497
+ highscoresTable.innerHTML = '';
498
+
499
+ if (scores.length === 0) {
500
+ const row = document.createElement('tr');
501
+ row.innerHTML = `
502
+ <td colspan="4" class="px-6 py-4 text-center text-gray-400">No scores yet</td>
503
+ `;
504
+ highscoresTable.appendChild(row);
505
+ return;
506
+ }
507
+
508
+ scores.slice(0, 10).forEach((score, index) => {
509
+ const row = document.createElement('tr');
510
+ row.className = 'hover:bg-blue-900 hover:bg-opacity-20';
511
+
512
+ const date = new Date(score.date);
513
+ const formattedDate = date.toLocaleDateString();
514
+
515
+ row.innerHTML = `
516
+ <td class="px-6 py-4">${index + 1}</td>
517
+ <td class="px-6 py-4">${score.name}</td>
518
+ <td class="px-6 py-4">${score.score}</td>
519
+ <td class="px-6 py-4">${formattedDate}</td>
520
+ `;
521
+ highscoresTable.appendChild(row);
522
+ });
523
+ }
524
+
525
+ // Save score to highscores
526
+ function saveScore() {
527
+ const playerName = playerNameInput.value.trim() || 'Player';
528
+ const currentDate = new Date();
529
+
530
+ // Add to all-time highscores
531
+ allTimeHighscores.push({
532
+ name: playerName,
533
+ score: score,
534
+ date: currentDate
535
+ });
536
+
537
+ // Sort and keep top 10
538
+ allTimeHighscores.sort((a, b) => b.score - a.score);
539
+ allTimeHighscores = allTimeHighscores.slice(0, 10);
540
+ localStorage.setItem('allTimeHighscores', JSON.stringify(allTimeHighscores));
541
+
542
+ // Check if this score is from this week
543
+ const oneWeekAgo = new Date();
544
+ oneWeekAgo.setDate(oneWeekAgo.getDate() - 7);
545
+
546
+ if (currentDate > oneWeekAgo) {
547
+ weeklyHighscores.push({
548
+ name: playerName,
549
+ score: score,
550
+ date: currentDate
551
+ });
552
+
553
+ // Sort and keep top 10
554
+ weeklyHighscores.sort((a, b) => b.score - a.score);
555
+ weeklyHighscores = weeklyHighscores.slice(0, 10);
556
+ localStorage.setItem('weeklyHighscores', JSON.stringify(weeklyHighscores));
557
+ }
558
+
559
+ // Update display
560
+ updateHighscoresTable();
561
+
562
+ // Show highscores
563
+ gameOverScreen.classList.add('hidden');
564
+ highscoresScreen.classList.remove('hidden');
565
+ }
566
+ </script>
567
+ <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 <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=HammadRehman/hammad-s-space" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
568
+ </html>
prompts.txt ADDED
File without changes