Spaces:
Running
Running
Add 2 files
Browse files- README.md +7 -5
- index.html +414 -19
README.md
CHANGED
@@ -1,10 +1,12 @@
|
|
1 |
---
|
2 |
-
title:
|
3 |
-
emoji:
|
4 |
-
colorFrom:
|
5 |
-
colorTo:
|
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: mini-game
|
3 |
+
emoji: 🐳
|
4 |
+
colorFrom: yellow
|
5 |
+
colorTo: red
|
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,414 @@
|
|
1 |
-
<!
|
2 |
-
<html>
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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>Roof Running AC Unit Minigame</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 |
+
@keyframes fall {
|
11 |
+
0% { transform: translateY(0); opacity: 1; }
|
12 |
+
100% { transform: translateY(100px); opacity: 0; }
|
13 |
+
}
|
14 |
+
|
15 |
+
@keyframes shake {
|
16 |
+
0%, 100% { transform: translateX(0); }
|
17 |
+
10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
|
18 |
+
20%, 40%, 60%, 80% { transform: translateX(5px); }
|
19 |
+
}
|
20 |
+
|
21 |
+
.cube {
|
22 |
+
transition: all 0.3s ease;
|
23 |
+
cursor: pointer;
|
24 |
+
}
|
25 |
+
|
26 |
+
.cube:hover {
|
27 |
+
transform: scale(1.05);
|
28 |
+
box-shadow: 0 0 10px rgba(255, 255, 255, 0.7);
|
29 |
+
}
|
30 |
+
|
31 |
+
.removing {
|
32 |
+
animation: fall 0.5s forwards;
|
33 |
+
}
|
34 |
+
|
35 |
+
.shake {
|
36 |
+
animation: shake 0.5s;
|
37 |
+
}
|
38 |
+
|
39 |
+
.progress-bar {
|
40 |
+
transition: width 0.5s linear;
|
41 |
+
}
|
42 |
+
|
43 |
+
.bg-red { background-color: #ef4444; }
|
44 |
+
.bg-green { background-color: #10b981; }
|
45 |
+
.bg-blue { background-color: #3b82f6; }
|
46 |
+
</style>
|
47 |
+
</head>
|
48 |
+
<body class="bg-gray-900 text-white min-h-screen flex flex-col items-center justify-center p-4">
|
49 |
+
<div class="max-w-4xl w-full bg-gray-800 rounded-xl shadow-2xl overflow-hidden border-2 border-gray-700">
|
50 |
+
<!-- Header -->
|
51 |
+
<div class="bg-gray-700 p-4 flex items-center justify-between">
|
52 |
+
<div class="flex items-center space-x-3">
|
53 |
+
<i class="fas fa-screwdriver text-yellow-400 text-2xl"></i>
|
54 |
+
<h1 class="text-xl font-bold">AC Unit Theft Minigame</h1>
|
55 |
+
</div>
|
56 |
+
<div class="flex items-center space-x-4">
|
57 |
+
<div class="flex items-center space-x-2">
|
58 |
+
<i class="fas fa-clock text-blue-400"></i>
|
59 |
+
<span id="timer" class="font-mono">60</span>
|
60 |
+
</div>
|
61 |
+
<div class="flex items-center space-x-2">
|
62 |
+
<i class="fas fa-cubes text-green-400"></i>
|
63 |
+
<span id="remaining">88</span>
|
64 |
+
</div>
|
65 |
+
</div>
|
66 |
+
</div>
|
67 |
+
|
68 |
+
<!-- Game Area -->
|
69 |
+
<div class="p-6">
|
70 |
+
<!-- Instructions -->
|
71 |
+
<div id="instructions" class="bg-gray-700 rounded-lg p-4 mb-6">
|
72 |
+
<div class="flex justify-between items-center">
|
73 |
+
<h2 class="font-bold text-lg mb-2">How to play:</h2>
|
74 |
+
<button id="close-instructions" class="text-gray-300 hover:text-white">
|
75 |
+
<i class="fas fa-times"></i>
|
76 |
+
</button>
|
77 |
+
</div>
|
78 |
+
<ul class="list-disc pl-5 space-y-1 text-sm">
|
79 |
+
<li>Click on groups of 2+ same-colored cubes to remove them</li>
|
80 |
+
<li>Cubes will fall down and align left after removal</li>
|
81 |
+
<li>Remove all cubes before time runs out to succeed</li>
|
82 |
+
<li>Single cubes cannot be removed</li>
|
83 |
+
</ul>
|
84 |
+
</div>
|
85 |
+
|
86 |
+
<!-- Game Grid -->
|
87 |
+
<div class="flex justify-center">
|
88 |
+
<div id="game-grid" class="grid grid-cols-11 gap-1 bg-gray-900 p-2 rounded-lg border border-gray-700"></div>
|
89 |
+
</div>
|
90 |
+
|
91 |
+
<!-- Progress Bar -->
|
92 |
+
<div class="mt-6 bg-gray-700 rounded-full h-4 overflow-hidden">
|
93 |
+
<div id="progress-bar" class="h-full bg-gradient-to-r from-green-500 to-blue-500 progress-bar" style="width: 100%"></div>
|
94 |
+
</div>
|
95 |
+
</div>
|
96 |
+
|
97 |
+
<!-- Controls -->
|
98 |
+
<div class="bg-gray-700 p-4 flex justify-between items-center">
|
99 |
+
<button id="start-btn" class="bg-green-600 hover:bg-green-700 px-4 py-2 rounded-lg font-medium flex items-center space-x-2 transition">
|
100 |
+
<i class="fas fa-play"></i>
|
101 |
+
<span>Start Game</span>
|
102 |
+
</button>
|
103 |
+
<button id="reset-btn" class="bg-gray-600 hover:bg-gray-500 px-4 py-2 rounded-lg font-medium flex items-center space-x-2 transition">
|
104 |
+
<i class="fas fa-redo"></i>
|
105 |
+
<span>Reset</span>
|
106 |
+
</button>
|
107 |
+
</div>
|
108 |
+
</div>
|
109 |
+
|
110 |
+
<!-- Result Modal -->
|
111 |
+
<div id="result-modal" class="fixed inset-0 bg-black bg-opacity-70 flex items-center justify-center hidden z-50">
|
112 |
+
<div class="bg-gray-800 rounded-xl p-6 max-w-md w-full border-2 border-gray-700 transform transition-all duration-300 scale-95 opacity-0">
|
113 |
+
<div class="text-center">
|
114 |
+
<div id="result-icon" class="text-6xl mb-4">
|
115 |
+
<i class="fas fa-check-circle text-green-500"></i>
|
116 |
+
</div>
|
117 |
+
<h2 id="result-title" class="text-2xl font-bold mb-2">Success!</h2>
|
118 |
+
<p id="result-message" class="text-gray-300 mb-6">You successfully stole the AC unit!</p>
|
119 |
+
<button id="close-modal" class="bg-blue-600 hover:bg-blue-700 px-6 py-2 rounded-lg font-medium transition">
|
120 |
+
Continue
|
121 |
+
</button>
|
122 |
+
</div>
|
123 |
+
</div>
|
124 |
+
</div>
|
125 |
+
|
126 |
+
<script>
|
127 |
+
// Game variables
|
128 |
+
const GRID_WIDTH = 11;
|
129 |
+
const GRID_HEIGHT = 8;
|
130 |
+
const COLORS = ['red', 'green', 'blue'];
|
131 |
+
const TIME_LIMIT = 60; // seconds
|
132 |
+
|
133 |
+
let gameGrid = [];
|
134 |
+
let selectedCells = [];
|
135 |
+
let gameActive = false;
|
136 |
+
let timeLeft = TIME_LIMIT;
|
137 |
+
let timerInterval;
|
138 |
+
let remainingCubes = GRID_WIDTH * GRID_HEIGHT;
|
139 |
+
|
140 |
+
// DOM elements
|
141 |
+
const gameGridElement = document.getElementById('game-grid');
|
142 |
+
const timerElement = document.getElementById('timer');
|
143 |
+
const remainingElement = document.getElementById('remaining');
|
144 |
+
const progressBar = document.getElementById('progress-bar');
|
145 |
+
const startBtn = document.getElementById('start-btn');
|
146 |
+
const resetBtn = document.getElementById('reset-btn');
|
147 |
+
const instructions = document.getElementById('instructions');
|
148 |
+
const closeInstructions = document.getElementById('close-instructions');
|
149 |
+
const resultModal = document.getElementById('result-modal');
|
150 |
+
const resultTitle = document.getElementById('result-title');
|
151 |
+
const resultMessage = document.getElementById('result-message');
|
152 |
+
const resultIcon = document.getElementById('result-icon');
|
153 |
+
const closeModal = document.getElementById('close-modal');
|
154 |
+
|
155 |
+
// Initialize game
|
156 |
+
function initGame() {
|
157 |
+
gameGrid = [];
|
158 |
+
selectedCells = [];
|
159 |
+
gameGridElement.innerHTML = '';
|
160 |
+
|
161 |
+
// Create grid
|
162 |
+
for (let y = 0; y < GRID_HEIGHT; y++) {
|
163 |
+
gameGrid[y] = [];
|
164 |
+
for (let x = 0; x < GRID_WIDTH; x++) {
|
165 |
+
const color = COLORS[Math.floor(Math.random() * COLORS.length)];
|
166 |
+
gameGrid[y][x] = { color, x, y };
|
167 |
+
|
168 |
+
const cube = document.createElement('div');
|
169 |
+
cube.className = `w-8 h-8 rounded-sm cube bg-${color}`;
|
170 |
+
cube.dataset.x = x;
|
171 |
+
cube.dataset.y = y;
|
172 |
+
cube.addEventListener('click', () => handleCubeClick(x, y));
|
173 |
+
|
174 |
+
gameGridElement.appendChild(cube);
|
175 |
+
}
|
176 |
+
}
|
177 |
+
|
178 |
+
remainingCubes = GRID_WIDTH * GRID_HEIGHT;
|
179 |
+
remainingElement.textContent = remainingCubes;
|
180 |
+
}
|
181 |
+
|
182 |
+
// Start the game
|
183 |
+
function startGame() {
|
184 |
+
if (gameActive) return;
|
185 |
+
|
186 |
+
gameActive = true;
|
187 |
+
timeLeft = TIME_LIMIT;
|
188 |
+
timerElement.textContent = timeLeft;
|
189 |
+
progressBar.style.width = '100%';
|
190 |
+
|
191 |
+
startBtn.disabled = true;
|
192 |
+
startBtn.classList.remove('bg-green-600', 'hover:bg-green-700');
|
193 |
+
startBtn.classList.add('bg-gray-500', 'cursor-not-allowed');
|
194 |
+
|
195 |
+
timerInterval = setInterval(() => {
|
196 |
+
timeLeft--;
|
197 |
+
timerElement.textContent = timeLeft;
|
198 |
+
progressBar.style.width = `${(timeLeft / TIME_LIMIT) * 100}%`;
|
199 |
+
|
200 |
+
if (timeLeft <= 10) {
|
201 |
+
progressBar.classList.remove('bg-gradient-to-r', 'from-green-500', 'to-blue-500');
|
202 |
+
progressBar.classList.add('bg-gradient-to-r', 'from-yellow-500', 'to-red-500');
|
203 |
+
}
|
204 |
+
|
205 |
+
if (timeLeft <= 0) {
|
206 |
+
endGame(false);
|
207 |
+
}
|
208 |
+
}, 1000);
|
209 |
+
}
|
210 |
+
|
211 |
+
// Reset the game
|
212 |
+
function resetGame() {
|
213 |
+
clearInterval(timerInterval);
|
214 |
+
gameActive = false;
|
215 |
+
|
216 |
+
startBtn.disabled = false;
|
217 |
+
startBtn.classList.add('bg-green-600', 'hover:bg-green-700');
|
218 |
+
startBtn.classList.remove('bg-gray-500', 'cursor-not-allowed');
|
219 |
+
|
220 |
+
progressBar.classList.remove('bg-gradient-to-r', 'from-yellow-500', 'to-red-500');
|
221 |
+
progressBar.classList.add('bg-gradient-to-r', 'from-green-500', 'to-blue-500');
|
222 |
+
|
223 |
+
initGame();
|
224 |
+
}
|
225 |
+
|
226 |
+
// Handle cube click
|
227 |
+
function handleCubeClick(x, y) {
|
228 |
+
if (!gameActive) return;
|
229 |
+
|
230 |
+
const cube = gameGrid[y][x];
|
231 |
+
if (!cube) return;
|
232 |
+
|
233 |
+
// Find connected cubes of the same color
|
234 |
+
const connected = findConnectedCubes(x, y, cube.color);
|
235 |
+
|
236 |
+
// If less than 2 connected cubes, can't remove
|
237 |
+
if (connected.length < 2) {
|
238 |
+
const cubeElement = document.querySelector(`[data-x="${x}"][data-y="${y}"]`);
|
239 |
+
cubeElement.classList.add('shake');
|
240 |
+
setTimeout(() => {
|
241 |
+
cubeElement.classList.remove('shake');
|
242 |
+
}, 500);
|
243 |
+
return;
|
244 |
+
}
|
245 |
+
|
246 |
+
// Mark cubes for removal
|
247 |
+
connected.forEach(pos => {
|
248 |
+
const { x, y } = pos;
|
249 |
+
gameGrid[y][x] = null;
|
250 |
+
|
251 |
+
const cubeElement = document.querySelector(`[data-x="${x}"][data-y="${y}"]`);
|
252 |
+
cubeElement.classList.add('removing');
|
253 |
+
setTimeout(() => {
|
254 |
+
cubeElement.remove();
|
255 |
+
}, 500);
|
256 |
+
});
|
257 |
+
|
258 |
+
// Update remaining cubes count
|
259 |
+
remainingCubes -= connected.length;
|
260 |
+
remainingElement.textContent = remainingCubes;
|
261 |
+
|
262 |
+
// After animation completes, collapse the grid
|
263 |
+
setTimeout(() => {
|
264 |
+
collapseGrid();
|
265 |
+
|
266 |
+
// Check if game is won
|
267 |
+
if (remainingCubes === 0) {
|
268 |
+
endGame(true);
|
269 |
+
}
|
270 |
+
}, 500);
|
271 |
+
}
|
272 |
+
|
273 |
+
// Find connected cubes of the same color
|
274 |
+
function findConnectedCubes(x, y, color, visited = []) {
|
275 |
+
const key = `${x},${y}`;
|
276 |
+
if (visited.includes(key)) return [];
|
277 |
+
|
278 |
+
visited.push(key);
|
279 |
+
const results = [{ x, y }];
|
280 |
+
|
281 |
+
// Check adjacent cells (up, down, left, right)
|
282 |
+
const directions = [
|
283 |
+
{ dx: 0, dy: -1 }, // up
|
284 |
+
{ dx: 0, dy: 1 }, // down
|
285 |
+
{ dx: -1, dy: 0 }, // left
|
286 |
+
{ dx: 1, dy: 0 } // right
|
287 |
+
];
|
288 |
+
|
289 |
+
for (const dir of directions) {
|
290 |
+
const nx = x + dir.dx;
|
291 |
+
const ny = y + dir.dy;
|
292 |
+
|
293 |
+
if (
|
294 |
+
nx >= 0 && nx < GRID_WIDTH &&
|
295 |
+
ny >= 0 && ny < GRID_HEIGHT &&
|
296 |
+
gameGrid[ny][nx] &&
|
297 |
+
gameGrid[ny][nx].color === color
|
298 |
+
) {
|
299 |
+
results.push(...findConnectedCubes(nx, ny, color, visited));
|
300 |
+
}
|
301 |
+
}
|
302 |
+
|
303 |
+
return results;
|
304 |
+
}
|
305 |
+
|
306 |
+
// Collapse the grid after removal
|
307 |
+
function collapseGrid() {
|
308 |
+
// First, let columns fall down
|
309 |
+
for (let x = 0; x < GRID_WIDTH; x++) {
|
310 |
+
let emptySpots = 0;
|
311 |
+
|
312 |
+
// From bottom to top
|
313 |
+
for (let y = GRID_HEIGHT - 1; y >= 0; y--) {
|
314 |
+
if (!gameGrid[y][x]) {
|
315 |
+
emptySpots++;
|
316 |
+
} else if (emptySpots > 0) {
|
317 |
+
// Move cube down
|
318 |
+
gameGrid[y + emptySpots][x] = gameGrid[y][x];
|
319 |
+
gameGrid[y][x] = null;
|
320 |
+
}
|
321 |
+
}
|
322 |
+
}
|
323 |
+
|
324 |
+
// Then, shift columns left to fill empty columns
|
325 |
+
let emptyColumns = 0;
|
326 |
+
for (let x = 0; x < GRID_WIDTH; x++) {
|
327 |
+
// Check if column is empty
|
328 |
+
let columnEmpty = true;
|
329 |
+
for (let y = 0; y < GRID_HEIGHT; y++) {
|
330 |
+
if (gameGrid[y][x]) {
|
331 |
+
columnEmpty = false;
|
332 |
+
break;
|
333 |
+
}
|
334 |
+
}
|
335 |
+
|
336 |
+
if (columnEmpty) {
|
337 |
+
emptyColumns++;
|
338 |
+
} else if (emptyColumns > 0) {
|
339 |
+
// Shift column left
|
340 |
+
for (let y = 0; y < GRID_HEIGHT; y++) {
|
341 |
+
gameGrid[y][x - emptyColumns] = gameGrid[y][x];
|
342 |
+
gameGrid[y][x] = null;
|
343 |
+
}
|
344 |
+
}
|
345 |
+
}
|
346 |
+
|
347 |
+
// Rebuild the grid visually
|
348 |
+
gameGridElement.innerHTML = '';
|
349 |
+
for (let y = 0; y < GRID_HEIGHT; y++) {
|
350 |
+
for (let x = 0; x < GRID_WIDTH; x++) {
|
351 |
+
if (gameGrid[y][x]) {
|
352 |
+
const cube = gameGrid[y][x];
|
353 |
+
const cubeElement = document.createElement('div');
|
354 |
+
cubeElement.className = `w-8 h-8 rounded-sm cube bg-${cube.color}`;
|
355 |
+
cubeElement.dataset.x = x;
|
356 |
+
cubeElement.dataset.y = y;
|
357 |
+
cubeElement.addEventListener('click', () => handleCubeClick(x, y));
|
358 |
+
gameGridElement.appendChild(cubeElement);
|
359 |
+
}
|
360 |
+
}
|
361 |
+
}
|
362 |
+
}
|
363 |
+
|
364 |
+
// End the game
|
365 |
+
function endGame(success) {
|
366 |
+
clearInterval(timerInterval);
|
367 |
+
gameActive = false;
|
368 |
+
|
369 |
+
// Show result modal
|
370 |
+
if (success) {
|
371 |
+
resultTitle.textContent = "Success!";
|
372 |
+
resultMessage.textContent = "You successfully stole the AC unit!";
|
373 |
+
resultIcon.innerHTML = '<i class="fas fa-check-circle text-green-500"></i>';
|
374 |
+
} else {
|
375 |
+
resultTitle.textContent = "Failed!";
|
376 |
+
resultMessage.textContent = "You ran out of time! The cops might be coming...";
|
377 |
+
resultIcon.innerHTML = '<i class="fas fa-times-circle text-red-500"></i>';
|
378 |
+
}
|
379 |
+
|
380 |
+
resultModal.classList.remove('hidden');
|
381 |
+
setTimeout(() => {
|
382 |
+
document.querySelector('#result-modal > div').classList.remove('scale-95', 'opacity-0');
|
383 |
+
document.querySelector('#result-modal > div').classList.add('scale-100', 'opacity-100');
|
384 |
+
}, 10);
|
385 |
+
}
|
386 |
+
|
387 |
+
// Event listeners
|
388 |
+
startBtn.addEventListener('click', () => {
|
389 |
+
startGame();
|
390 |
+
instructions.classList.add('hidden');
|
391 |
+
});
|
392 |
+
|
393 |
+
resetBtn.addEventListener('click', resetGame);
|
394 |
+
|
395 |
+
closeInstructions.addEventListener('click', () => {
|
396 |
+
instructions.classList.add('hidden');
|
397 |
+
});
|
398 |
+
|
399 |
+
closeModal.addEventListener('click', () => {
|
400 |
+
document.querySelector('#result-modal > div').classList.remove('scale-100', 'opacity-100');
|
401 |
+
document.querySelector('#result-modal > div').classList.add('scale-95', 'opacity-0');
|
402 |
+
setTimeout(() => {
|
403 |
+
resultModal.classList.add('hidden');
|
404 |
+
resetGame();
|
405 |
+
}, 300);
|
406 |
+
});
|
407 |
+
|
408 |
+
// Initialize on load
|
409 |
+
document.addEventListener('DOMContentLoaded', () => {
|
410 |
+
initGame();
|
411 |
+
});
|
412 |
+
</script>
|
413 |
+
<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=shubham6924/mini-game" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
414 |
+
</html>
|