Spaces:
Running
Running
Add 2 files
Browse files- README.md +7 -5
- index.html +941 -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: cyber-flight
|
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,941 @@
|
|
1 |
-
<!
|
2 |
-
<html>
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 FLIGHT | Neural Net Challenge</title>
|
7 |
+
<style>
|
8 |
+
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Quantico:wght@400;700&display=swap');
|
9 |
+
|
10 |
+
:root {
|
11 |
+
--primary: #00ff9d;
|
12 |
+
--secondary: #00a1ff;
|
13 |
+
--danger: #ff2a6d;
|
14 |
+
--bg-dark: #0e0e2c;
|
15 |
+
--bg-darker: #070716;
|
16 |
+
--glow-intensity: 0;
|
17 |
+
}
|
18 |
+
|
19 |
+
* {
|
20 |
+
margin: 0;
|
21 |
+
padding: 0;
|
22 |
+
box-sizing: border-box;
|
23 |
+
}
|
24 |
+
|
25 |
+
body {
|
26 |
+
background-color: var(--bg-darker);
|
27 |
+
font-family: 'Quantico', sans-serif;
|
28 |
+
color: white;
|
29 |
+
overflow: hidden;
|
30 |
+
height: 100vh;
|
31 |
+
display: flex;
|
32 |
+
flex-direction: column;
|
33 |
+
background-image:
|
34 |
+
radial-gradient(circle at 20% 30%, rgba(0, 255, 157, 0.05) 0%, transparent 20%),
|
35 |
+
radial-gradient(circle at 80% 70%, rgba(0, 161, 255, 0.05) 0%, transparent 20%),
|
36 |
+
linear-gradient(var(--bg-darker), var(--bg-dark));
|
37 |
+
}
|
38 |
+
|
39 |
+
header {
|
40 |
+
padding: 1.5rem 2rem;
|
41 |
+
display: flex;
|
42 |
+
justify-content: space-between;
|
43 |
+
align-items: center;
|
44 |
+
background-color: rgba(7, 7, 22, 0.8);
|
45 |
+
border-bottom: 1px solid rgba(0, 255, 157, 0.2);
|
46 |
+
box-shadow: 0 0 20px rgba(0, 255, 157, 0.1);
|
47 |
+
z-index: 10;
|
48 |
+
}
|
49 |
+
|
50 |
+
.logo {
|
51 |
+
font-family: 'Orbitron', sans-serif;
|
52 |
+
font-weight: 900;
|
53 |
+
font-size: 2rem;
|
54 |
+
background: linear-gradient(90deg, var(--primary), var(--secondary));
|
55 |
+
-webkit-background-clip: text;
|
56 |
+
background-clip: text;
|
57 |
+
color: transparent;
|
58 |
+
text-shadow: 0 0 10px rgba(0, 255, 157, 0.3);
|
59 |
+
letter-spacing: 2px;
|
60 |
+
}
|
61 |
+
|
62 |
+
.stats {
|
63 |
+
display: flex;
|
64 |
+
gap: 2rem;
|
65 |
+
}
|
66 |
+
|
67 |
+
.stat-box {
|
68 |
+
display: flex;
|
69 |
+
flex-direction: column;
|
70 |
+
align-items: center;
|
71 |
+
padding: 0.5rem 1.5rem;
|
72 |
+
background: rgba(14, 14, 44, 0.7);
|
73 |
+
border: 1px solid rgba(0, 161, 255, 0.2);
|
74 |
+
border-radius: 4px;
|
75 |
+
box-shadow: 0 0 10px rgba(0, 161, 255, 0.1);
|
76 |
+
}
|
77 |
+
|
78 |
+
.stat-label {
|
79 |
+
font-size: 0.7rem;
|
80 |
+
color: var(--secondary);
|
81 |
+
text-transform: uppercase;
|
82 |
+
letter-spacing: 1px;
|
83 |
+
}
|
84 |
+
|
85 |
+
.stat-value {
|
86 |
+
font-family: 'Orbitron', sans-serif;
|
87 |
+
font-size: 1.5rem;
|
88 |
+
color: var(--primary);
|
89 |
+
font-weight: 700;
|
90 |
+
}
|
91 |
+
|
92 |
+
.game-container {
|
93 |
+
flex: 1;
|
94 |
+
position: relative;
|
95 |
+
display: flex;
|
96 |
+
justify-content: center;
|
97 |
+
align-items: center;
|
98 |
+
}
|
99 |
+
|
100 |
+
#gameCanvas {
|
101 |
+
border: 2px solid rgba(0, 255, 157, 0.3);
|
102 |
+
box-shadow:
|
103 |
+
0 0 30px rgba(0, 255, 157, 0.2),
|
104 |
+
inset 0 0 20px rgba(0, 255, 157, 0.1);
|
105 |
+
background-color: var(--bg-dark);
|
106 |
+
border-radius: 4px;
|
107 |
+
position: relative;
|
108 |
+
overflow: hidden;
|
109 |
+
}
|
110 |
+
|
111 |
+
.scanline {
|
112 |
+
position: absolute;
|
113 |
+
top: 0;
|
114 |
+
left: 0;
|
115 |
+
width: 100%;
|
116 |
+
height: 100%;
|
117 |
+
background: linear-gradient(
|
118 |
+
to bottom,
|
119 |
+
transparent 0%,
|
120 |
+
rgba(0, 255, 157, 0.05) 50%,
|
121 |
+
transparent 100%
|
122 |
+
);
|
123 |
+
background-size: 100% 8px;
|
124 |
+
pointer-events: none;
|
125 |
+
animation: scanline 8s linear infinite;
|
126 |
+
}
|
127 |
+
|
128 |
+
@keyframes scanline {
|
129 |
+
0% { transform: translateY(0); }
|
130 |
+
100% { transform: translateY(100vh); }
|
131 |
+
}
|
132 |
+
|
133 |
+
.noise {
|
134 |
+
position: absolute;
|
135 |
+
top: 0;
|
136 |
+
left: 0;
|
137 |
+
width: 100%;
|
138 |
+
height: 100%;
|
139 |
+
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAQElEQVR42u3OMQEAAAQAoNuVzV4GJ3xHkCSZ2JIkSZK0M7ElSZIkSZIkSZIkSZKk/zAx3ABFwz1QNNwDSZIkSZKW7QEmZgxYI0i3NgAAAABJRU5ErkJggg==");
|
140 |
+
opacity: 0.03;
|
141 |
+
pointer-events: none;
|
142 |
+
}
|
143 |
+
|
144 |
+
.menu {
|
145 |
+
position: absolute;
|
146 |
+
top: 50%;
|
147 |
+
left: 50%;
|
148 |
+
transform: translate(-50%, -50%);
|
149 |
+
background: rgba(7, 7, 22, 0.9);
|
150 |
+
border: 2px solid var(--primary);
|
151 |
+
border-radius: 6px;
|
152 |
+
padding: 2rem 3rem;
|
153 |
+
text-align: center;
|
154 |
+
box-shadow:
|
155 |
+
0 0 30px rgba(0, 255, 157, 0.3),
|
156 |
+
inset 0 0 20px rgba(0, 255, 157, 0.2);
|
157 |
+
z-index: 100;
|
158 |
+
}
|
159 |
+
|
160 |
+
.menu.hidden {
|
161 |
+
display: none;
|
162 |
+
}
|
163 |
+
|
164 |
+
.menu h2 {
|
165 |
+
font-family: 'Orbitron', sans-serif;
|
166 |
+
color: var(--primary);
|
167 |
+
margin-bottom: 1.5rem;
|
168 |
+
font-size: 1.8rem;
|
169 |
+
text-transform: uppercase;
|
170 |
+
letter-spacing: 3px;
|
171 |
+
}
|
172 |
+
|
173 |
+
.menu p {
|
174 |
+
color: var(--secondary);
|
175 |
+
margin-bottom: 2rem;
|
176 |
+
max-width: 300px;
|
177 |
+
line-height: 1.6;
|
178 |
+
}
|
179 |
+
|
180 |
+
.btn {
|
181 |
+
background: linear-gradient(45deg, var(--primary), var(--secondary));
|
182 |
+
border: none;
|
183 |
+
color: var(--bg-darker);
|
184 |
+
font-family: 'Orbitron', sans-serif;
|
185 |
+
font-weight: 700;
|
186 |
+
padding: 0.8rem 2rem;
|
187 |
+
border-radius: 4px;
|
188 |
+
cursor: pointer;
|
189 |
+
text-transform: uppercase;
|
190 |
+
letter-spacing: 1px;
|
191 |
+
font-size: 0.9rem;
|
192 |
+
transition: all 0.3s ease;
|
193 |
+
box-shadow: 0 0 15px rgba(0, 255, 157, 0.5);
|
194 |
+
position: relative;
|
195 |
+
overflow: hidden;
|
196 |
+
}
|
197 |
+
|
198 |
+
.btn:hover {
|
199 |
+
box-shadow: 0 0 25px rgba(0, 255, 157, 0.8);
|
200 |
+
transform: translateY(-2px);
|
201 |
+
}
|
202 |
+
|
203 |
+
.btn:active {
|
204 |
+
transform: translateY(0);
|
205 |
+
}
|
206 |
+
|
207 |
+
.btn::before {
|
208 |
+
content: '';
|
209 |
+
position: absolute;
|
210 |
+
top: 0;
|
211 |
+
left: -100%;
|
212 |
+
width: 100%;
|
213 |
+
height: 100%;
|
214 |
+
background: linear-gradient(
|
215 |
+
90deg,
|
216 |
+
transparent,
|
217 |
+
rgba(255, 255, 255, 0.2),
|
218 |
+
transparent
|
219 |
+
);
|
220 |
+
transition: none;
|
221 |
+
}
|
222 |
+
|
223 |
+
.btn:hover::before {
|
224 |
+
left: 100%;
|
225 |
+
transition: all 0.5s ease-in-out;
|
226 |
+
}
|
227 |
+
|
228 |
+
.glow {
|
229 |
+
position: absolute;
|
230 |
+
width: 100%;
|
231 |
+
height: 100%;
|
232 |
+
top: 0;
|
233 |
+
left: 0;
|
234 |
+
background: radial-gradient(circle at center, rgba(0, 255, 157, 0.1) 0%, transparent 70%);
|
235 |
+
opacity: var(--glow-intensity);
|
236 |
+
pointer-events: none;
|
237 |
+
transition: opacity 0.5s ease;
|
238 |
+
}
|
239 |
+
|
240 |
+
.game-over {
|
241 |
+
position: absolute;
|
242 |
+
top: 50%;
|
243 |
+
left: 50%;
|
244 |
+
transform: translate(-50%, -50%);
|
245 |
+
background: rgba(255, 0, 77, 0.1);
|
246 |
+
padding: 2rem;
|
247 |
+
border: 2px solid var(--danger);
|
248 |
+
border-radius: 6px;
|
249 |
+
text-align: center;
|
250 |
+
box-shadow: 0 0 30px rgba(255, 42, 109, 0.4);
|
251 |
+
z-index: 100;
|
252 |
+
display: none;
|
253 |
+
}
|
254 |
+
|
255 |
+
.game-over h2 {
|
256 |
+
color: var(--danger);
|
257 |
+
margin-bottom: 1rem;
|
258 |
+
font-family: 'Orbitron', sans-serif;
|
259 |
+
text-transform: uppercase;
|
260 |
+
}
|
261 |
+
|
262 |
+
.terminal {
|
263 |
+
font-family: monospace;
|
264 |
+
background-color: rgba(0, 0, 0, 0.7);
|
265 |
+
padding: 1rem;
|
266 |
+
border-radius: 4px;
|
267 |
+
margin: 1rem 0;
|
268 |
+
text-align: left;
|
269 |
+
max-height: 150px;
|
270 |
+
overflow-y: auto;
|
271 |
+
border-left: 3px solid var(--primary);
|
272 |
+
}
|
273 |
+
|
274 |
+
.terminal-line {
|
275 |
+
margin-bottom: 0.3rem;
|
276 |
+
color: var(--primary);
|
277 |
+
}
|
278 |
+
|
279 |
+
.terminal-line.system {
|
280 |
+
color: var(--secondary);
|
281 |
+
}
|
282 |
+
|
283 |
+
.terminal-line.warning {
|
284 |
+
color: var(--danger);
|
285 |
+
}
|
286 |
+
|
287 |
+
.pipes {
|
288 |
+
position: absolute;
|
289 |
+
top: 0;
|
290 |
+
left: 0;
|
291 |
+
width: 100%;
|
292 |
+
height: 100%;
|
293 |
+
pointer-events: none;
|
294 |
+
z-index: 1;
|
295 |
+
}
|
296 |
+
|
297 |
+
.cyber-circle {
|
298 |
+
position: absolute;
|
299 |
+
width: 200px;
|
300 |
+
height: 200px;
|
301 |
+
border-radius: 50%;
|
302 |
+
border: 2px solid var(--primary);
|
303 |
+
box-shadow:
|
304 |
+
0 0 20px var(--primary),
|
305 |
+
inset 0 0 20px var(--primary);
|
306 |
+
opacity: 0.1;
|
307 |
+
pointer-events: none;
|
308 |
+
}
|
309 |
+
</style>
|
310 |
+
</head>
|
311 |
+
<body>
|
312 |
+
<header>
|
313 |
+
<div class="logo">CYBER FLIGHT</div>
|
314 |
+
<div class="stats">
|
315 |
+
<div class="stat-box">
|
316 |
+
<span class="stat-label">Neural Score</span>
|
317 |
+
<span class="stat-value" id="score">0</span>
|
318 |
+
</div>
|
319 |
+
<div class="stat-box">
|
320 |
+
<span class="stat-label">High Score</span>
|
321 |
+
<span class="stat-value" id="high-score">0</span>
|
322 |
+
</div>
|
323 |
+
<div class="stat-box">
|
324 |
+
<span class="stat-label">Energy</span>
|
325 |
+
<span class="stat-value" id="energy">100%</span>
|
326 |
+
</div>
|
327 |
+
</div>
|
328 |
+
</header>
|
329 |
+
|
330 |
+
<div class="game-container">
|
331 |
+
<canvas id="gameCanvas" width="350" height="600"></canvas>
|
332 |
+
<div class="scanline"></div>
|
333 |
+
<div class="noise"></div>
|
334 |
+
<div class="glow"></div>
|
335 |
+
|
336 |
+
<div class="menu">
|
337 |
+
<h2>Neural Net Challenge</h2>
|
338 |
+
<div class="terminal">
|
339 |
+
<div class="terminal-line system">> System initializing...</div>
|
340 |
+
<div class="terminal-line">> Cybernetic augmentation complete</div>
|
341 |
+
<div class="terminal-line system">> Neural interface active</div>
|
342 |
+
<div class="terminal-line">> Flight systems: ONLINE</div>
|
343 |
+
<div class="terminal-line system">> Ready for simulation</div>
|
344 |
+
</div>
|
345 |
+
<p>Execute neural synchronization to commence cybernetic flight simulation.</p>
|
346 |
+
<button class="btn" id="startBtn">ENGAGE SYSTEMS</button>
|
347 |
+
</div>
|
348 |
+
|
349 |
+
<div class="game-over">
|
350 |
+
<h2>SYSTEM FAILURE</h2>
|
351 |
+
<div class="terminal">
|
352 |
+
<div class="terminal-line warning">> Critical impact detected</div>
|
353 |
+
<div class="terminal-line">> Neural score: <span id="final-score">0</span></div>
|
354 |
+
<div class="terminal-line system">> Rebooting flight systems...</div>
|
355 |
+
</div>
|
356 |
+
<button class="btn" id="restartBtn">REINITIALIZE</button>
|
357 |
+
</div>
|
358 |
+
|
359 |
+
<div id="cyber-circles"></div>
|
360 |
+
</div>
|
361 |
+
|
362 |
+
<script>
|
363 |
+
document.addEventListener('DOMContentLoaded', () => {
|
364 |
+
const canvas = document.getElementById('gameCanvas');
|
365 |
+
const ctx = canvas.getContext('2d');
|
366 |
+
const startBtn = document.getElementById('startBtn');
|
367 |
+
const restartBtn = document.getElementById('restartBtn');
|
368 |
+
const menu = document.querySelector('.menu');
|
369 |
+
const gameOver = document.querySelector('.game-over');
|
370 |
+
const scoreDisplay = document.getElementById('score');
|
371 |
+
const highScoreDisplay = document.getElementById('highScore');
|
372 |
+
const finalScoreDisplay = document.getElementById('final-score');
|
373 |
+
const energyDisplay = document.getElementById('energy');
|
374 |
+
const glow = document.querySelector('.glow');
|
375 |
+
|
376 |
+
// Game variables
|
377 |
+
let score = 0;
|
378 |
+
let highScore = localStorage.getItem('cyberFlightHighScore') || 0;
|
379 |
+
let gameRunning = false;
|
380 |
+
let animationId;
|
381 |
+
let gameSpeed = 2;
|
382 |
+
let gravity = 0.5;
|
383 |
+
let energy = 100;
|
384 |
+
let energyDrainInterval;
|
385 |
+
let glowIntensity = 0;
|
386 |
+
|
387 |
+
// Bird properties
|
388 |
+
const bird = {
|
389 |
+
x: 100,
|
390 |
+
y: canvas.height / 2,
|
391 |
+
width: 30,
|
392 |
+
height: 24,
|
393 |
+
velocity: 0,
|
394 |
+
flapPower: -8,
|
395 |
+
color: '#00ff9d'
|
396 |
+
};
|
397 |
+
|
398 |
+
// Pipes
|
399 |
+
const pipes = [];
|
400 |
+
const pipeWidth = 60;
|
401 |
+
const pipeGap = 150;
|
402 |
+
let pipeFrequency = 120; // frames
|
403 |
+
|
404 |
+
function createPipe() {
|
405 |
+
// Only create pipes if game is running
|
406 |
+
if (!gameRunning) return;
|
407 |
+
|
408 |
+
const minHeight = 50;
|
409 |
+
const maxHeight = canvas.height - pipeGap - minHeight;
|
410 |
+
const height = Math.floor(Math.random() * (maxHeight - minHeight + 1)) + minHeight;
|
411 |
+
|
412 |
+
pipes.push({
|
413 |
+
x: canvas.width,
|
414 |
+
height: height,
|
415 |
+
passed: false,
|
416 |
+
color: `hsl(${Math.floor(Math.random() * 60) + 180}, 80%, 50%)`
|
417 |
+
});
|
418 |
+
}
|
419 |
+
|
420 |
+
function drawBird() {
|
421 |
+
// Cybernetic bird with glow effect
|
422 |
+
ctx.save();
|
423 |
+
|
424 |
+
// Glow effect
|
425 |
+
const gradient = ctx.createRadialGradient(
|
426 |
+
bird.x + bird.width / 2,
|
427 |
+
bird.y + bird.height / 2,
|
428 |
+
0,
|
429 |
+
bird.x + bird.width / 2,
|
430 |
+
bird.y + bird.height / 2,
|
431 |
+
bird.width * 2
|
432 |
+
);
|
433 |
+
gradient.addColorStop(0, bird.color);
|
434 |
+
gradient.addColorStop(1, 'rgba(0, 255, 157, 0)');
|
435 |
+
|
436 |
+
ctx.fillStyle = gradient;
|
437 |
+
ctx.beginPath();
|
438 |
+
ctx.arc(
|
439 |
+
bird.x + bird.width / 2,
|
440 |
+
bird.y + bird.height / 2,
|
441 |
+
bird.width * 1.5,
|
442 |
+
0,
|
443 |
+
Math.PI * 2
|
444 |
+
);
|
445 |
+
ctx.fill();
|
446 |
+
|
447 |
+
// Bird body (cybernetic shape)
|
448 |
+
ctx.fillStyle = bird.color;
|
449 |
+
ctx.beginPath();
|
450 |
+
ctx.moveTo(bird.x + bird.width * 0.3, bird.y);
|
451 |
+
ctx.lineTo(bird.x + bird.width, bird.y + bird.height / 2);
|
452 |
+
ctx.lineTo(bird.x + bird.width * 0.3, bird.y + bird.height);
|
453 |
+
ctx.lineTo(bird.x, bird.y + bird.height / 2);
|
454 |
+
ctx.closePath();
|
455 |
+
ctx.fill();
|
456 |
+
|
457 |
+
// Bird eye (glowing)
|
458 |
+
ctx.fillStyle = '#00a1ff';
|
459 |
+
ctx.beginPath();
|
460 |
+
ctx.arc(
|
461 |
+
bird.x + bird.width * 0.6,
|
462 |
+
bird.y + bird.height * 0.4,
|
463 |
+
bird.width * 0.15,
|
464 |
+
0,
|
465 |
+
Math.PI * 2
|
466 |
+
);
|
467 |
+
ctx.fill();
|
468 |
+
|
469 |
+
// Hexagonal pattern on wings
|
470 |
+
ctx.strokeStyle = '#00a1ff';
|
471 |
+
ctx.lineWidth = 1;
|
472 |
+
drawHexPattern(bird.x + bird.width * 0.3, bird.y + bird.height / 2, 5, 10);
|
473 |
+
|
474 |
+
ctx.restore();
|
475 |
+
}
|
476 |
+
|
477 |
+
function drawHexPattern(x, y, hexSize, count) {
|
478 |
+
ctx.save();
|
479 |
+
ctx.translate(x, y);
|
480 |
+
|
481 |
+
for (let i = 0; i < count; i++) {
|
482 |
+
const hexX = i % 2 === 0 ?
|
483 |
+
(Math.floor(i / 2) * hexSize * 1.5) :
|
484 |
+
(Math.floor(i / 2) * hexSize * 1.5 + hexSize * 0.75);
|
485 |
+
const hexY = i % 2 === 0 ?
|
486 |
+
-hexSize * 0.5 :
|
487 |
+
hexSize * 0.5;
|
488 |
+
|
489 |
+
drawHexagon(hexX, hexY, hexSize);
|
490 |
+
}
|
491 |
+
|
492 |
+
ctx.restore();
|
493 |
+
}
|
494 |
+
|
495 |
+
function drawHexagon(x, y, size) {
|
496 |
+
ctx.beginPath();
|
497 |
+
for (let i = 0; i < 6; i++) {
|
498 |
+
const angle = (i * 2 * Math.PI / 6) + (Math.PI / 6);
|
499 |
+
const xx = x + size * Math.cos(angle);
|
500 |
+
const yy = y + size * Math.sin(angle);
|
501 |
+
if (i === 0) {
|
502 |
+
ctx.moveTo(xx, yy);
|
503 |
+
} else {
|
504 |
+
ctx.lineTo(xx, yy);
|
505 |
+
}
|
506 |
+
}
|
507 |
+
ctx.closePath();
|
508 |
+
ctx.stroke();
|
509 |
+
}
|
510 |
+
|
511 |
+
function drawPipes() {
|
512 |
+
pipes.forEach((pipe, index) => {
|
513 |
+
// Top pipe
|
514 |
+
ctx.save();
|
515 |
+
|
516 |
+
// Pipe gradient
|
517 |
+
const pipeGradient = ctx.createLinearGradient(
|
518 |
+
pipe.x, 0,
|
519 |
+
pipe.x + pipeWidth, 0
|
520 |
+
);
|
521 |
+
pipeGradient.addColorStop(0, 'rgba(0, 255, 157, 0)');
|
522 |
+
pipeGradient.addColorStop(0.1, pipe.color);
|
523 |
+
pipeGradient.addColorStop(0.9, pipe.color);
|
524 |
+
pipeGradient.addColorStop(1, 'rgba(0, 255, 157, 0)');
|
525 |
+
|
526 |
+
ctx.fillStyle = pipeGradient;
|
527 |
+
|
528 |
+
// Hexagon pattern on pipes
|
529 |
+
ctx.beginPath();
|
530 |
+
ctx.moveTo(pipe.x, pipe.height);
|
531 |
+
ctx.lineTo(pipe.x + pipeWidth, pipe.height);
|
532 |
+
ctx.lineTo(pipe.x + pipeWidth, 0);
|
533 |
+
ctx.lineTo(pipe.x, 0);
|
534 |
+
ctx.closePath();
|
535 |
+
ctx.fill();
|
536 |
+
|
537 |
+
// Pipe border (glowing)
|
538 |
+
ctx.strokeStyle = pipe.color;
|
539 |
+
ctx.lineWidth = 2;
|
540 |
+
ctx.stroke();
|
541 |
+
|
542 |
+
// Bottom pipe
|
543 |
+
const bottomY = pipe.height + pipeGap;
|
544 |
+
ctx.beginPath();
|
545 |
+
ctx.moveTo(pipe.x, bottomY);
|
546 |
+
ctx.lineTo(pipe.x + pipeWidth, bottomY);
|
547 |
+
ctx.lineTo(pipe.x + pipeWidth, canvas.height);
|
548 |
+
ctx.lineTo(pipe.x, canvas.height);
|
549 |
+
ctx.closePath();
|
550 |
+
ctx.fill();
|
551 |
+
|
552 |
+
// Pipe border
|
553 |
+
ctx.stroke();
|
554 |
+
|
555 |
+
// Circuit pattern
|
556 |
+
drawPipeCircuit(pipe, index);
|
557 |
+
|
558 |
+
ctx.restore();
|
559 |
+
});
|
560 |
+
}
|
561 |
+
|
562 |
+
function drawPipeCircuit(pipe, index) {
|
563 |
+
ctx.save();
|
564 |
+
ctx.strokeStyle = '#00a1ff';
|
565 |
+
ctx.fillStyle = '#00a1ff';
|
566 |
+
ctx.lineWidth = 1;
|
567 |
+
|
568 |
+
// Draw circuit lines on top pipe
|
569 |
+
const segments = Math.floor(pipe.height / 15);
|
570 |
+
for (let i = 0; i < segments; i++) {
|
571 |
+
const y = i * 15;
|
572 |
+
if (i % 2 === index % 2) {
|
573 |
+
ctx.beginPath();
|
574 |
+
ctx.moveTo(pipe.x, y);
|
575 |
+
ctx.lineTo(pipe.x + pipeWidth, y);
|
576 |
+
ctx.stroke();
|
577 |
+
} else {
|
578 |
+
ctx.beginPath();
|
579 |
+
ctx.rect(pipe.x + pipeWidth * 0.3, y, pipeWidth * 0.4, 2);
|
580 |
+
ctx.fill();
|
581 |
+
}
|
582 |
+
|
583 |
+
// Circuit nodes
|
584 |
+
if (i % 3 === 0) {
|
585 |
+
ctx.beginPath();
|
586 |
+
ctx.arc(
|
587 |
+
pipe.x + pipeWidth * 0.1,
|
588 |
+
y + 7,
|
589 |
+
2,
|
590 |
+
0,
|
591 |
+
Math.PI * 2
|
592 |
+
);
|
593 |
+
ctx.fill();
|
594 |
+
|
595 |
+
ctx.beginPath();
|
596 |
+
ctx.arc(
|
597 |
+
pipe.x + pipeWidth * 0.9,
|
598 |
+
y + 7,
|
599 |
+
2,
|
600 |
+
0,
|
601 |
+
Math.PI * 2
|
602 |
+
);
|
603 |
+
ctx.fill();
|
604 |
+
}
|
605 |
+
}
|
606 |
+
|
607 |
+
// Draw circuit lines on bottom pipe
|
608 |
+
const bottomY = pipe.height + pipeGap;
|
609 |
+
const bottomHeight = canvas.height - bottomY;
|
610 |
+
const bottomSegments = Math.floor(bottomHeight / 15);
|
611 |
+
for (let i = 0; i < bottomSegments; i++) {
|
612 |
+
const y = bottomY + i * 15;
|
613 |
+
if (i % 2 === index % 2) {
|
614 |
+
ctx.beginPath();
|
615 |
+
ctx.moveTo(pipe.x, y);
|
616 |
+
ctx.lineTo(pipe.x + pipeWidth, y);
|
617 |
+
ctx.stroke();
|
618 |
+
} else {
|
619 |
+
ctx.beginPath();
|
620 |
+
ctx.rect(pipe.x + pipeWidth * 0.3, y, pipeWidth * 0.4, 2);
|
621 |
+
ctx.fill();
|
622 |
+
}
|
623 |
+
|
624 |
+
// Circuit nodes
|
625 |
+
if (i % 3 === 0) {
|
626 |
+
ctx.beginPath();
|
627 |
+
ctx.arc(
|
628 |
+
pipe.x + pipeWidth * 0.1,
|
629 |
+
y + 7,
|
630 |
+
2,
|
631 |
+
0,
|
632 |
+
Math.PI * 2
|
633 |
+
);
|
634 |
+
ctx.fill();
|
635 |
+
|
636 |
+
ctx.beginPath();
|
637 |
+
ctx.arc(
|
638 |
+
pipe.x + pipeWidth * 0.9,
|
639 |
+
y + 7,
|
640 |
+
2,
|
641 |
+
0,
|
642 |
+
Math.PI * 2
|
643 |
+
);
|
644 |
+
ctx.fill();
|
645 |
+
}
|
646 |
+
}
|
647 |
+
|
648 |
+
ctx.restore();
|
649 |
+
}
|
650 |
+
|
651 |
+
function updateBird() {
|
652 |
+
bird.velocity += gravity;
|
653 |
+
bird.y += bird.velocity;
|
654 |
+
|
655 |
+
// Keep bird within canvas bounds
|
656 |
+
if (bird.y < 0) {
|
657 |
+
bird.y = 0;
|
658 |
+
bird.velocity = 0;
|
659 |
+
}
|
660 |
+
|
661 |
+
if (bird.y + bird.height > canvas.height) {
|
662 |
+
bird.y = canvas.height - bird.height;
|
663 |
+
bird.velocity = 0;
|
664 |
+
}
|
665 |
+
}
|
666 |
+
|
667 |
+
function updatePipes() {
|
668 |
+
// Move pipes
|
669 |
+
pipes.forEach((pipe) => {
|
670 |
+
pipe.x -= gameSpeed;
|
671 |
+
|
672 |
+
// Check if bird passed the pipe
|
673 |
+
if (!pipe.passed && pipe.x + pipeWidth < bird.x) {
|
674 |
+
pipe.passed = true;
|
675 |
+
score++;
|
676 |
+
scoreDisplay.textContent = score;
|
677 |
+
energy = Math.min(100, energy + 5); // Energy boost for passing obstacles
|
678 |
+
energyDisplay.textContent = `${Math.floor(energy)}%`;
|
679 |
+
|
680 |
+
// Trigger glow effect
|
681 |
+
glowIntensity = 0.5;
|
682 |
+
document.documentElement.style.setProperty('--glow-intensity', glowIntensity);
|
683 |
+
setTimeout(() => {
|
684 |
+
glowIntensity = 0;
|
685 |
+
document.documentElement.style.setProperty('--glow-intensity', glowIntensity);
|
686 |
+
}, 200);
|
687 |
+
}
|
688 |
+
});
|
689 |
+
|
690 |
+
// Remove off-screen pipes
|
691 |
+
while (pipes.length > 0 && pipes[0].x + pipeWidth < 0) {
|
692 |
+
pipes.shift();
|
693 |
+
}
|
694 |
+
|
695 |
+
// Create new pipes
|
696 |
+
if (frameCount % pipeFrequency === 0) {
|
697 |
+
createPipe();
|
698 |
+
|
699 |
+
// Increase difficulty
|
700 |
+
if (score > 0 && score % 3 === 0) {
|
701 |
+
gameSpeed = Math.min(5, gameSpeed + 0.2);
|
702 |
+
pipeGap = Math.max(120, pipeGap - 5);
|
703 |
+
pipeFrequency = Math.max(80, pipeFrequency - 5);
|
704 |
+
}
|
705 |
+
}
|
706 |
+
}
|
707 |
+
|
708 |
+
function checkCollisions() {
|
709 |
+
// Check if bird hit top or bottom
|
710 |
+
if (bird.y <= 0 || bird.y + bird.height >= canvas.height) {
|
711 |
+
endGame();
|
712 |
+
return;
|
713 |
+
}
|
714 |
+
|
715 |
+
// Check if bird hit any pipes
|
716 |
+
for (const pipe of pipes) {
|
717 |
+
if (bird.x + bird.width > pipe.x &&
|
718 |
+
bird.x < pipe.x + pipeWidth &&
|
719 |
+
(bird.y < pipe.height || bird.y + bird.height > pipe.height + pipeGap)) {
|
720 |
+
endGame();
|
721 |
+
return;
|
722 |
+
}
|
723 |
+
}
|
724 |
+
}
|
725 |
+
|
726 |
+
function drainEnergy() {
|
727 |
+
energy = Math.max(0, energy - 0.5);
|
728 |
+
energyDisplay.textContent = `${Math.floor(energy)}%`;
|
729 |
+
|
730 |
+
// Change bird color based on energy level
|
731 |
+
if (energy > 50) {
|
732 |
+
bird.color = '#00ff9d';
|
733 |
+
} else if (energy > 20) {
|
734 |
+
bird.color = '#ffcc00';
|
735 |
+
} else {
|
736 |
+
bird.color = '#ff2a6d';
|
737 |
+
}
|
738 |
+
|
739 |
+
// End game if energy depleted
|
740 |
+
if (energy <= 0) {
|
741 |
+
endGame();
|
742 |
+
}
|
743 |
+
}
|
744 |
+
|
745 |
+
function drawBackground() {
|
746 |
+
// Dark gradient background
|
747 |
+
ctx.fillStyle = '#070716';
|
748 |
+
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
749 |
+
|
750 |
+
// Grid pattern
|
751 |
+
ctx.strokeStyle = 'rgba(0, 161, 255, 0.05)';
|
752 |
+
ctx.lineWidth = 1;
|
753 |
+
|
754 |
+
// Vertical lines
|
755 |
+
for (let x = 0; x < canvas.width; x += 40) {
|
756 |
+
ctx.beginPath();
|
757 |
+
ctx.moveTo(x, 0);
|
758 |
+
ctx.lineTo(x, canvas.height);
|
759 |
+
ctx.stroke();
|
760 |
+
}
|
761 |
+
|
762 |
+
// Horizontal lines
|
763 |
+
for (let y = 0; y < canvas.height; y += 40) {
|
764 |
+
ctx.beginPath();
|
765 |
+
ctx.moveTo(0, y);
|
766 |
+
ctx.lineTo(canvas.width, y);
|
767 |
+
ctx.stroke();
|
768 |
+
}
|
769 |
+
|
770 |
+
// Center line (cybernetic pulse)
|
771 |
+
ctx.strokeStyle = 'rgba(0, 255, 157, 0.1)';
|
772 |
+
ctx.lineWidth = 2;
|
773 |
+
ctx.beginPath();
|
774 |
+
ctx.moveTo(canvas.width / 2, 0);
|
775 |
+
ctx.lineTo(canvas.width / 2, canvas.height);
|
776 |
+
ctx.stroke();
|
777 |
+
|
778 |
+
// Moving scan lines
|
779 |
+
ctx.fillStyle = 'rgba(0, 255, 157, 0.03)';
|
780 |
+
for (let y = frameCount % 40; y < canvas.height; y += 40) {
|
781 |
+
ctx.fillRect(0, y, canvas.width, 2);
|
782 |
+
}
|
783 |
+
}
|
784 |
+
|
785 |
+
function createCyberCircles() {
|
786 |
+
const container = document.getElementById('cyber-circles');
|
787 |
+
container.innerHTML = '';
|
788 |
+
|
789 |
+
const circleCount = 15;
|
790 |
+
|
791 |
+
for (let i = 0; i < circleCount; i++) {
|
792 |
+
const circle = document.createElement('div');
|
793 |
+
circle.className = 'cyber-circle';
|
794 |
+
|
795 |
+
// Random position
|
796 |
+
const left = Math.random() * 100;
|
797 |
+
const top = Math.random() * 100;
|
798 |
+
|
799 |
+
// Random size
|
800 |
+
const size = 50 + Math.random() * 150;
|
801 |
+
|
802 |
+
// Random animation
|
803 |
+
const duration = 5 + Math.random() * 10;
|
804 |
+
const delay = Math.random() * 5;
|
805 |
+
|
806 |
+
circle.style.left = `${left}%`;
|
807 |
+
circle.style.top = `${top}%`;
|
808 |
+
circle.style.width = `${size}px`;
|
809 |
+
circle.style.height = `${size}px`;
|
810 |
+
circle.style.animation = `pulse ${duration}s ${delay}s infinite alternate`;
|
811 |
+
|
812 |
+
container.appendChild(circle);
|
813 |
+
}
|
814 |
+
}
|
815 |
+
|
816 |
+
function startGame() {
|
817 |
+
// Reset game state
|
818 |
+
score = 0;
|
819 |
+
energy = 100;
|
820 |
+
gameSpeed = 2;
|
821 |
+
bird.y = canvas.height / 2;
|
822 |
+
bird.velocity = 0;
|
823 |
+
pipes.length = 0;
|
824 |
+
frameCount = 0;
|
825 |
+
scoreDisplay.textContent = '0';
|
826 |
+
energyDisplay.textContent = '100%';
|
827 |
+
|
828 |
+
// Hide menu and show game
|
829 |
+
menu.classList.add('hidden');
|
830 |
+
gameOver.style.display = 'none';
|
831 |
+
gameRunning = true;
|
832 |
+
|
833 |
+
// Start energy drain
|
834 |
+
clearInterval(energyDrainInterval);
|
835 |
+
energyDrainInterval = setInterval(drainEnergy, 100);
|
836 |
+
|
837 |
+
// Start game loop
|
838 |
+
gameLoop();
|
839 |
+
}
|
840 |
+
|
841 |
+
function endGame() {
|
842 |
+
gameRunning = false;
|
843 |
+
clearInterval(energyDrainInterval);
|
844 |
+
|
845 |
+
// Update high score
|
846 |
+
if (score > highScore) {
|
847 |
+
highScore = score;
|
848 |
+
localStorage.setItem('cyberFlightHighScore', highScore);
|
849 |
+
document.getElementById('high-score').textContent = highScore;
|
850 |
+
}
|
851 |
+
|
852 |
+
// Show game over screen
|
853 |
+
finalScoreDisplay.textContent = score;
|
854 |
+
gameOver.style.display = 'block';
|
855 |
+
|
856 |
+
cancelAnimationFrame(animationId);
|
857 |
+
}
|
858 |
+
|
859 |
+
function gameLoop() {
|
860 |
+
if (!gameRunning) return;
|
861 |
+
|
862 |
+
frameCount++;
|
863 |
+
|
864 |
+
// Clear canvas
|
865 |
+
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
866 |
+
|
867 |
+
// Draw game elements
|
868 |
+
drawBackground();
|
869 |
+
drawPipes();
|
870 |
+
drawBird();
|
871 |
+
|
872 |
+
// Update game state
|
873 |
+
updateBird();
|
874 |
+
updatePipes();
|
875 |
+
checkCollisions();
|
876 |
+
|
877 |
+
animationId = requestAnimationFrame(gameLoop);
|
878 |
+
}
|
879 |
+
|
880 |
+
// Event listeners
|
881 |
+
startBtn.addEventListener('click', startGame);
|
882 |
+
restartBtn.addEventListener('click', startGame);
|
883 |
+
|
884 |
+
document.addEventListener('keydown', (e) => {
|
885 |
+
if (e.code === 'Space' || e.key === ' ' || e.key === 'ArrowUp') {
|
886 |
+
e.preventDefault();
|
887 |
+
|
888 |
+
if (!gameRunning && menu.classList.contains('hidden')) {
|
889 |
+
startGame();
|
890 |
+
} else if (gameRunning) {
|
891 |
+
bird.velocity = bird.flapPower;
|
892 |
+
energy = Math.max(0, energy - 1); // Energy cost for flapping
|
893 |
+
energyDisplay.textContent = `${Math.floor(energy)}%`;
|
894 |
+
}
|
895 |
+
}
|
896 |
+
});
|
897 |
+
|
898 |
+
canvas.addEventListener('click', (e) => {
|
899 |
+
if (!gameRunning && menu.classList.contains('hidden')) {
|
900 |
+
startGame();
|
901 |
+
} else if (gameRunning) {
|
902 |
+
bird.velocity = bird.flapPower;
|
903 |
+
energy = Math.max(0, energy - 1);
|
904 |
+
energyDisplay.textContent = `${Math.floor(energy)}%`;
|
905 |
+
}
|
906 |
+
});
|
907 |
+
|
908 |
+
// Initialize UI
|
909 |
+
createCyberCircles();
|
910 |
+
document.getElementById('high-score').textContent = highScore;
|
911 |
+
|
912 |
+
// Game loop variables
|
913 |
+
let frameCount = 0;
|
914 |
+
|
915 |
+
// Insert new terminal line every 3 seconds while in menu
|
916 |
+
const terminal = document.querySelector('.terminal');
|
917 |
+
const terminalMessages = [
|
918 |
+
{ text: "> Neural pathways engaged", class: "" },
|
919 |
+
{ text: "> Cybernetic core at 98%", class: "system" },
|
920 |
+
{ text: "> Awaiting user command", class: "" },
|
921 |
+
{ text: "> Warning: Energy levels critical", class: "warning" },
|
922 |
+
{ text: "> Activating neural boosters", class: "system" }
|
923 |
+
];
|
924 |
+
|
925 |
+
let messageIndex = 2; // Start after initial messages
|
926 |
+
|
927 |
+
setInterval(() => {
|
928 |
+
if (!gameRunning && !menu.classList.contains('hidden')) {
|
929 |
+
const message = terminalMessages[messageIndex % terminalMessages.length];
|
930 |
+
const newLine = document.createElement('div');
|
931 |
+
newLine.classList.add('terminal-line', message.class);
|
932 |
+
newLine.textContent = message.text;
|
933 |
+
terminal.appendChild(newLine);
|
934 |
+
terminal.scrollTop = terminal.scrollHeight;
|
935 |
+
messageIndex++;
|
936 |
+
}
|
937 |
+
}, 3000);
|
938 |
+
});
|
939 |
+
</script>
|
940 |
+
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: absolute; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">This website has been generated by <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>
|
941 |
+
</html>
|