Spaces:
Running
Running
Add 3 files
Browse files- README.md +7 -5
- index.html +948 -19
- prompts.txt +3 -0
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: andromeda-blast
|
| 3 |
+
emoji: 🐳
|
| 4 |
+
colorFrom: purple
|
| 5 |
+
colorTo: yellow
|
| 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,948 @@
|
|
| 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>Cosmic Defender - Space Shooter</title>
|
| 7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js"></script>
|
| 9 |
+
<script src="https://cdn.jsdelivr.net/npm/[email protected]/examples/js/controls/OrbitControls.min.js"></script>
|
| 10 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
| 11 |
+
<style>
|
| 12 |
+
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&family=Orbitron:wght@400;500;600;700&display=swap');
|
| 13 |
+
|
| 14 |
+
:root {
|
| 15 |
+
--primary: #00f0ff;
|
| 16 |
+
--secondary: #7b2dff;
|
| 17 |
+
--tertiary: #ff2d7b;
|
| 18 |
+
--dark: #0a0a1a;
|
| 19 |
+
--darker: #050510;
|
| 20 |
+
--light: #e0e0ff;
|
| 21 |
+
--accent: #ff2d7b;
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
body {
|
| 25 |
+
margin: 0;
|
| 26 |
+
overflow: hidden;
|
| 27 |
+
font-family: 'Space Grotesk', 'Orbitron', sans-serif;
|
| 28 |
+
background-color: var(--dark);
|
| 29 |
+
color: var(--light);
|
| 30 |
+
touch-action: none;
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
#canvas {
|
| 34 |
+
display: block;
|
| 35 |
+
position: fixed;
|
| 36 |
+
top: 0;
|
| 37 |
+
left: 0;
|
| 38 |
+
z-index: 1;
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
#game-container {
|
| 42 |
+
position: fixed;
|
| 43 |
+
top: 0;
|
| 44 |
+
left: 0;
|
| 45 |
+
width: 100%;
|
| 46 |
+
height: 100%;
|
| 47 |
+
z-index: 2;
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
#player-ship {
|
| 51 |
+
position: absolute;
|
| 52 |
+
width: 60px;
|
| 53 |
+
height: 60px;
|
| 54 |
+
z-index: 10;
|
| 55 |
+
transition: transform 0.1s ease;
|
| 56 |
+
filter: drop-shadow(0 0 5px var(--primary));
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
.projectile {
|
| 60 |
+
position: absolute;
|
| 61 |
+
width: 24px;
|
| 62 |
+
height: 8px;
|
| 63 |
+
z-index: 5;
|
| 64 |
+
filter: drop-shadow(0 0 3px var(--primary));
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
.enemy-ship {
|
| 68 |
+
position: absolute;
|
| 69 |
+
width: 50px;
|
| 70 |
+
height: 50px;
|
| 71 |
+
z-index: 5;
|
| 72 |
+
filter: drop-shadow(0 0 5px var(--tertiary));
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
.explosion {
|
| 76 |
+
position: absolute;
|
| 77 |
+
width: 120px;
|
| 78 |
+
height: 120px;
|
| 79 |
+
z-index: 6;
|
| 80 |
+
pointer-events: none;
|
| 81 |
+
}
|
| 82 |
+
|
| 83 |
+
.explosion-particle {
|
| 84 |
+
position: absolute;
|
| 85 |
+
border-radius: 50%;
|
| 86 |
+
pointer-events: none;
|
| 87 |
+
}
|
| 88 |
+
|
| 89 |
+
.spark {
|
| 90 |
+
position: absolute;
|
| 91 |
+
width: 3px;
|
| 92 |
+
height: 3px;
|
| 93 |
+
border-radius: 50%;
|
| 94 |
+
pointer-events: none;
|
| 95 |
+
filter: blur(0.5px);
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
.smoke {
|
| 99 |
+
position: absolute;
|
| 100 |
+
border-radius: 50%;
|
| 101 |
+
pointer-events: none;
|
| 102 |
+
filter: blur(5px);
|
| 103 |
+
opacity: 0.8;
|
| 104 |
+
}
|
| 105 |
+
|
| 106 |
+
.shockwave {
|
| 107 |
+
position: absolute;
|
| 108 |
+
border-radius: 50%;
|
| 109 |
+
pointer-events: none;
|
| 110 |
+
border: 2px solid rgba(255, 255, 255, 0.7);
|
| 111 |
+
transform: scale(0);
|
| 112 |
+
opacity: 1;
|
| 113 |
+
}
|
| 114 |
+
|
| 115 |
+
@keyframes explode {
|
| 116 |
+
0% { transform: scale(0.5); opacity: 1; }
|
| 117 |
+
100% { transform: scale(2); opacity: 0; }
|
| 118 |
+
}
|
| 119 |
+
|
| 120 |
+
@keyframes particle-fly {
|
| 121 |
+
0% { transform: translate(0, 0) scale(1); opacity: 1; }
|
| 122 |
+
100% { transform: translate(var(--tx), var(--ty)) scale(0.2); opacity: 0; }
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
+
@keyframes spark-fly {
|
| 126 |
+
0% { transform: translate(0, 0); opacity: 1; }
|
| 127 |
+
100% { transform: translate(var(--tx), var(--ty)); opacity: 0; }
|
| 128 |
+
}
|
| 129 |
+
|
| 130 |
+
@keyframes smoke-rise {
|
| 131 |
+
0% { transform: translate(0, 0) scale(0.5); opacity: 0.8; }
|
| 132 |
+
100% { transform: translate(var(--tx), var(--ty)) scale(2); opacity: 0; }
|
| 133 |
+
}
|
| 134 |
+
|
| 135 |
+
@keyframes shockwave {
|
| 136 |
+
0% { transform: scale(0); opacity: 1; }
|
| 137 |
+
100% { transform: scale(3); opacity: 0; }
|
| 138 |
+
}
|
| 139 |
+
|
| 140 |
+
#hud {
|
| 141 |
+
position: fixed;
|
| 142 |
+
top: 20px;
|
| 143 |
+
left: 20px;
|
| 144 |
+
z-index: 20;
|
| 145 |
+
color: white;
|
| 146 |
+
font-family: 'Orbitron', sans-serif;
|
| 147 |
+
text-shadow: 0 0 5px var(--primary);
|
| 148 |
+
}
|
| 149 |
+
|
| 150 |
+
#game-over {
|
| 151 |
+
position: fixed;
|
| 152 |
+
top: 0;
|
| 153 |
+
left: 0;
|
| 154 |
+
width: 100%;
|
| 155 |
+
height: 100%;
|
| 156 |
+
background-color: rgba(0, 0, 0, 0.8);
|
| 157 |
+
display: flex;
|
| 158 |
+
flex-direction: column;
|
| 159 |
+
justify-content: center;
|
| 160 |
+
align-items: center;
|
| 161 |
+
z-index: 30;
|
| 162 |
+
color: white;
|
| 163 |
+
font-size: 2rem;
|
| 164 |
+
display: none;
|
| 165 |
+
}
|
| 166 |
+
|
| 167 |
+
#restart-btn {
|
| 168 |
+
margin-top: 20px;
|
| 169 |
+
padding: 10px 20px;
|
| 170 |
+
background: linear-gradient(135deg, var(--primary), var(--secondary));
|
| 171 |
+
border: none;
|
| 172 |
+
border-radius: 5px;
|
| 173 |
+
color: white;
|
| 174 |
+
font-family: 'Orbitron', sans-serif;
|
| 175 |
+
cursor: pointer;
|
| 176 |
+
font-size: 1rem;
|
| 177 |
+
}
|
| 178 |
+
|
| 179 |
+
.glass-panel {
|
| 180 |
+
background: rgba(10, 10, 26, 0.4);
|
| 181 |
+
backdrop-filter: blur(16px);
|
| 182 |
+
-webkit-backdrop-filter: blur(16px);
|
| 183 |
+
border-radius: 1.5rem;
|
| 184 |
+
border: 1px solid rgba(224, 224, 255, 0.1);
|
| 185 |
+
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
|
| 186 |
+
padding: 1.25rem;
|
| 187 |
+
transition: all 0.3s ease;
|
| 188 |
+
}
|
| 189 |
+
|
| 190 |
+
.glass-panel:hover {
|
| 191 |
+
border-color: rgba(224, 224, 255, 0.2);
|
| 192 |
+
box-shadow: 0 8px 32px rgba(0, 240, 255, 0.1);
|
| 193 |
+
}
|
| 194 |
+
</style>
|
| 195 |
+
</head>
|
| 196 |
+
<body>
|
| 197 |
+
<div id="canvas"></div>
|
| 198 |
+
<div id="game-container">
|
| 199 |
+
<div id="player-ship"></div>
|
| 200 |
+
<div id="hud">
|
| 201 |
+
<div>SCORE: <span id="score">0</span></div>
|
| 202 |
+
<div>HEALTH: <span id="health">100</span>%</div>
|
| 203 |
+
<div>ENEMIES: <span id="enemies">0</span></div>
|
| 204 |
+
</div>
|
| 205 |
+
<div id="game-over">
|
| 206 |
+
<h1>GAME OVER</h1>
|
| 207 |
+
<p>Final Score: <span id="final-score">0</span></p>
|
| 208 |
+
<button id="restart-btn">PLAY AGAIN</button>
|
| 209 |
+
</div>
|
| 210 |
+
</div>
|
| 211 |
+
|
| 212 |
+
<script>
|
| 213 |
+
// Main Three.js variables for background
|
| 214 |
+
let scene, camera, renderer;
|
| 215 |
+
let wormhole, particles = [];
|
| 216 |
+
let explosionParticles = [];
|
| 217 |
+
let debrisParticles = [];
|
| 218 |
+
let sparkParticles = [];
|
| 219 |
+
let starParticles = [];
|
| 220 |
+
|
| 221 |
+
// Game variables
|
| 222 |
+
let player = {
|
| 223 |
+
x: 100,
|
| 224 |
+
y: window.innerHeight / 2,
|
| 225 |
+
width: 60,
|
| 226 |
+
height: 60,
|
| 227 |
+
speed: 8,
|
| 228 |
+
health: 100,
|
| 229 |
+
lastShot: 0,
|
| 230 |
+
shootDelay: 300
|
| 231 |
+
};
|
| 232 |
+
|
| 233 |
+
let projectiles = [];
|
| 234 |
+
let enemies = [];
|
| 235 |
+
let explosions = [];
|
| 236 |
+
let score = 0;
|
| 237 |
+
let gameRunning = true;
|
| 238 |
+
let enemySpawnRate = 1000; // ms
|
| 239 |
+
let lastEnemySpawn = 0;
|
| 240 |
+
let keys = {
|
| 241 |
+
ArrowUp: false,
|
| 242 |
+
ArrowDown: false,
|
| 243 |
+
ArrowLeft: false,
|
| 244 |
+
ArrowRight: false,
|
| 245 |
+
' ': false
|
| 246 |
+
};
|
| 247 |
+
|
| 248 |
+
// Procedural SVG generation functions
|
| 249 |
+
function generatePlayerShip() {
|
| 250 |
+
const shipId = 'player-ship-' + Date.now();
|
| 251 |
+
const svg = `
|
| 252 |
+
<svg id="${shipId}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 60 60">
|
| 253 |
+
<defs>
|
| 254 |
+
<linearGradient id="shipGradient" x1="0%" y1="0%" x2="100%" y2="100%">
|
| 255 |
+
<stop offset="0%" stop-color="#00f0ff" />
|
| 256 |
+
<stop offset="100%" stop-color="#7b2dff" />
|
| 257 |
+
</linearGradient>
|
| 258 |
+
<radialGradient id="engineGlow" cx="20%" cy="50%" r="50%" fx="20%" fy="50%">
|
| 259 |
+
<stop offset="0%" stop-color="#ff2d7b" stop-opacity="0.8" />
|
| 260 |
+
<stop offset="100%" stop-color="#ff2d7b" stop-opacity="0" />
|
| 261 |
+
</radialGradient>
|
| 262 |
+
</defs>
|
| 263 |
+
|
| 264 |
+
<!-- Main hull -->
|
| 265 |
+
<path d="M30,5 L55,30 L45,55 L15,55 L5,30 Z" fill="url(#shipGradient)" stroke="#ffffff" stroke-width="1" />
|
| 266 |
+
|
| 267 |
+
<!-- Cockpit -->
|
| 268 |
+
<ellipse cx="30" cy="25" rx="10" ry="8" fill="#0a0a1a" stroke="#ffffff" stroke-width="1" />
|
| 269 |
+
<ellipse cx="30" cy="25" rx="6" ry="4" fill="#00f0ff" opacity="0.7" />
|
| 270 |
+
|
| 271 |
+
<!-- Engine glow -->
|
| 272 |
+
<path d="M15,50 L45,50 L40,60 L20,60 Z" fill="url(#engineGlow)" />
|
| 273 |
+
|
| 274 |
+
<!-- Details -->
|
| 275 |
+
<path d="M30,5 L30,25" stroke="#ffffff" stroke-width="1" stroke-dasharray="2,2" />
|
| 276 |
+
<path d="M15,55 L5,30 L15,20" stroke="#ffffff" stroke-width="1" fill="none" />
|
| 277 |
+
<path d="M45,55 L55,30 L45,20" stroke="#ffffff" stroke-width="1" fill="none" />
|
| 278 |
+
|
| 279 |
+
<!-- Thrusters -->
|
| 280 |
+
<rect x="20" y="50" width="5" height="8" fill="#00f0ff" rx="1" />
|
| 281 |
+
<rect x="35" y="50" width="5" height="8" fill="#00f0ff" rx="1" />
|
| 282 |
+
</svg>
|
| 283 |
+
`;
|
| 284 |
+
return svg;
|
| 285 |
+
}
|
| 286 |
+
|
| 287 |
+
function generateEnemyShip() {
|
| 288 |
+
const shipId = 'enemy-ship-' + Date.now();
|
| 289 |
+
const hue = Math.floor(Math.random() * 60) + 300; // Purple-red range
|
| 290 |
+
const svg = `
|
| 291 |
+
<svg id="${shipId}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 50 50">
|
| 292 |
+
<defs>
|
| 293 |
+
<linearGradient id="enemyGradient" x1="0%" y1="0%" x2="100%" y2="100%">
|
| 294 |
+
<stop offset="0%" stop-color="hsl(${hue}, 100%, 60%)" />
|
| 295 |
+
<stop offset="100%" stop-color="hsl(${hue + 20}, 100%, 40%)" />
|
| 296 |
+
</linearGradient>
|
| 297 |
+
<radialGradient id="enemyGlow" cx="50%" cy="50%" r="50%" fx="50%" fy="50%">
|
| 298 |
+
<stop offset="0%" stop-color="hsl(${hue}, 100%, 80%)" stop-opacity="0.8" />
|
| 299 |
+
<stop offset="100%" stop-color="hsl(${hue}, 100%, 60%)" stop-opacity="0" />
|
| 300 |
+
</radialGradient>
|
| 301 |
+
</defs>
|
| 302 |
+
|
| 303 |
+
<!-- Main body -->
|
| 304 |
+
<path d="M25,5 L45,25 L25,45 L5,25 Z" fill="url(#enemyGradient)" stroke="#ffffff" stroke-width="1" />
|
| 305 |
+
|
| 306 |
+
<!-- Core -->
|
| 307 |
+
<circle cx="25" cy="25" r="8" fill="url(#enemyGlow)" />
|
| 308 |
+
<circle cx="25" cy="25" r="5" fill="#0a0a1a" />
|
| 309 |
+
|
| 310 |
+
<!-- Spikes -->
|
| 311 |
+
<path d="M25,5 L30,0 L35,5 Z" fill="hsl(${hue}, 100%, 60%)" />
|
| 312 |
+
<path d="M45,25 L50,20 L50,30 Z" fill="hsl(${hue}, 100%, 60%)" />
|
| 313 |
+
<path d="M25,45 L30,50 L35,45 Z" fill="hsl(${hue}, 100%, 60%)" />
|
| 314 |
+
<path d="M5,25 L0,20 L0,30 Z" fill="hsl(${hue}, 100%, 60%)" />
|
| 315 |
+
|
| 316 |
+
<!-- Details -->
|
| 317 |
+
<path d="M15,15 L35,35" stroke="#ffffff" stroke-width="1" stroke-dasharray="1,1" />
|
| 318 |
+
<path d="M15,35 L35,15" stroke="#ffffff" stroke-width="1" stroke-dasharray="1,1" />
|
| 319 |
+
</svg>
|
| 320 |
+
`;
|
| 321 |
+
return svg;
|
| 322 |
+
}
|
| 323 |
+
|
| 324 |
+
function generateProjectile() {
|
| 325 |
+
const projId = 'projectile-' + Date.now();
|
| 326 |
+
const svg = `
|
| 327 |
+
<svg id="${projId}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 8">
|
| 328 |
+
<defs>
|
| 329 |
+
<linearGradient id="projGradient" x1="0%" y1="50%" x2="100%" y2="50%">
|
| 330 |
+
<stop offset="0%" stop-color="#00f0ff" />
|
| 331 |
+
<stop offset="50%" stop-color="#7b2dff" />
|
| 332 |
+
<stop offset="100%" stop-color="#00f0ff" />
|
| 333 |
+
</linearGradient>
|
| 334 |
+
<radialGradient id="projGlow" cx="50%" cy="50%" r="50%" fx="50%" fy="50%">
|
| 335 |
+
<stop offset="0%" stop-color="#00f0ff" stop-opacity="0.8" />
|
| 336 |
+
<stop offset="100%" stop-color="#00f0ff" stop-opacity="0" />
|
| 337 |
+
</radialGradient>
|
| 338 |
+
</defs>
|
| 339 |
+
|
| 340 |
+
<!-- Projectile body -->
|
| 341 |
+
<rect x="0" y="2" width="24" height="4" rx="2" fill="url(#projGradient)" />
|
| 342 |
+
|
| 343 |
+
<!-- Glow effects -->
|
| 344 |
+
<ellipse cx="12" cy="4" rx="12" ry="4" fill="url(#projGlow)" />
|
| 345 |
+
|
| 346 |
+
<!-- Front tip -->
|
| 347 |
+
<path d="M24,2 L28,4 L24,6 Z" fill="#00f0ff" />
|
| 348 |
+
</svg>
|
| 349 |
+
`;
|
| 350 |
+
return svg;
|
| 351 |
+
}
|
| 352 |
+
|
| 353 |
+
// Initialize the background scene
|
| 354 |
+
function initBackground() {
|
| 355 |
+
// Create scene
|
| 356 |
+
scene = new THREE.Scene();
|
| 357 |
+
scene.background = new THREE.Color(0x0a0a1a);
|
| 358 |
+
scene.fog = new THREE.FogExp2(0x0a0a1a, 0.002);
|
| 359 |
+
|
| 360 |
+
// Create camera
|
| 361 |
+
camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 10000);
|
| 362 |
+
camera.position.set(0, 0, 50);
|
| 363 |
+
|
| 364 |
+
// Create renderer
|
| 365 |
+
renderer = new THREE.WebGLRenderer({ antialias: true });
|
| 366 |
+
renderer.setSize(window.innerWidth, window.innerHeight);
|
| 367 |
+
renderer.shadowMap.enabled = true;
|
| 368 |
+
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
|
| 369 |
+
document.getElementById('canvas').appendChild(renderer.domElement);
|
| 370 |
+
|
| 371 |
+
// Create lights
|
| 372 |
+
const ambientLight = new THREE.AmbientLight(0x404040);
|
| 373 |
+
scene.add(ambientLight);
|
| 374 |
+
|
| 375 |
+
const directionalLight = new THREE.DirectionalLight(0xffffff, 1);
|
| 376 |
+
directionalLight.position.set(1, 1, 1);
|
| 377 |
+
directionalLight.castShadow = true;
|
| 378 |
+
scene.add(directionalLight);
|
| 379 |
+
|
| 380 |
+
// Add colorful ambient light
|
| 381 |
+
const coloredLight1 = new THREE.PointLight(0x7b2dff, 0.5, 100);
|
| 382 |
+
coloredLight1.position.set(20, 20, 20);
|
| 383 |
+
scene.add(coloredLight1);
|
| 384 |
+
|
| 385 |
+
const coloredLight2 = new THREE.PointLight(0x00f0ff, 0.5, 100);
|
| 386 |
+
coloredLight2.position.set(-20, -20, -20);
|
| 387 |
+
scene.add(coloredLight2);
|
| 388 |
+
|
| 389 |
+
// Create wormhole
|
| 390 |
+
createWormhole();
|
| 391 |
+
|
| 392 |
+
// Create particles
|
| 393 |
+
createParticles();
|
| 394 |
+
}
|
| 395 |
+
|
| 396 |
+
// Create wormhole geometry
|
| 397 |
+
function createWormhole() {
|
| 398 |
+
const geometry = new THREE.TorusGeometry(15, 3, 32, 100);
|
| 399 |
+
const material = new THREE.MeshPhongMaterial({
|
| 400 |
+
color: 0x00aaff,
|
| 401 |
+
emissive: 0x0066ff,
|
| 402 |
+
emissiveIntensity: 0.8,
|
| 403 |
+
transparent: true,
|
| 404 |
+
opacity: 0.9,
|
| 405 |
+
wireframe: true,
|
| 406 |
+
wireframeLinewidth: 2
|
| 407 |
+
});
|
| 408 |
+
|
| 409 |
+
wormhole = new THREE.Mesh(geometry, material);
|
| 410 |
+
wormhole.rotation.x = Math.PI / 2;
|
| 411 |
+
scene.add(wormhole);
|
| 412 |
+
|
| 413 |
+
// Add inner glow
|
| 414 |
+
const innerGlowGeometry = new THREE.SphereGeometry(12, 32, 32);
|
| 415 |
+
const innerGlowMaterial = new THREE.MeshBasicMaterial({
|
| 416 |
+
color: 0x00aaff,
|
| 417 |
+
transparent: true,
|
| 418 |
+
opacity: 0.3
|
| 419 |
+
});
|
| 420 |
+
const innerGlow = new THREE.Mesh(innerGlowGeometry, innerGlowMaterial);
|
| 421 |
+
wormhole.add(innerGlow);
|
| 422 |
+
|
| 423 |
+
// Add energy field
|
| 424 |
+
const energyFieldGeometry = new THREE.SphereGeometry(16, 64, 64);
|
| 425 |
+
const energyFieldMaterial = new THREE.MeshBasicMaterial({
|
| 426 |
+
color: 0x7b2dff,
|
| 427 |
+
transparent: true,
|
| 428 |
+
opacity: 0.05,
|
| 429 |
+
wireframe: true
|
| 430 |
+
});
|
| 431 |
+
const energyField = new THREE.Mesh(energyFieldGeometry, energyFieldMaterial);
|
| 432 |
+
wormhole.add(energyField);
|
| 433 |
+
}
|
| 434 |
+
|
| 435 |
+
// Create various particles
|
| 436 |
+
function createParticles() {
|
| 437 |
+
// Stars background
|
| 438 |
+
const starGeometry = new THREE.BufferGeometry();
|
| 439 |
+
const starMaterial = new THREE.PointsMaterial({
|
| 440 |
+
color: 0xffffff,
|
| 441 |
+
size: 0.2,
|
| 442 |
+
transparent: true,
|
| 443 |
+
opacity: 0.8
|
| 444 |
+
});
|
| 445 |
+
|
| 446 |
+
const starPositions = [];
|
| 447 |
+
const starColors = [];
|
| 448 |
+
|
| 449 |
+
for (let i = 0; i < 2000; i++) {
|
| 450 |
+
starPositions.push(
|
| 451 |
+
Math.random() * 2000 - 1000,
|
| 452 |
+
Math.random() * 2000 - 1000,
|
| 453 |
+
Math.random() * 2000 - 1000
|
| 454 |
+
);
|
| 455 |
+
|
| 456 |
+
// Add some color variation
|
| 457 |
+
const colorIntensity = 0.7 + Math.random() * 0.3;
|
| 458 |
+
starColors.push(
|
| 459 |
+
colorIntensity,
|
| 460 |
+
colorIntensity,
|
| 461 |
+
colorIntensity
|
| 462 |
+
);
|
| 463 |
+
}
|
| 464 |
+
|
| 465 |
+
starGeometry.setAttribute('position', new THREE.Float32BufferAttribute(starPositions, 3));
|
| 466 |
+
starGeometry.setAttribute('color', new THREE.Float32BufferAttribute(starColors, 3));
|
| 467 |
+
|
| 468 |
+
const stars = new THREE.Points(starGeometry, starMaterial);
|
| 469 |
+
scene.add(stars);
|
| 470 |
+
starParticles.push(stars);
|
| 471 |
+
|
| 472 |
+
// Debris
|
| 473 |
+
for (let i = 0; i < 150; i++) {
|
| 474 |
+
const size = 0.2 + Math.random() * 1.5;
|
| 475 |
+
const debris = new THREE.Mesh(
|
| 476 |
+
new THREE.BoxGeometry(size, size, size),
|
| 477 |
+
new THREE.MeshPhongMaterial({
|
| 478 |
+
color: 0x888888,
|
| 479 |
+
emissive: 0x333333,
|
| 480 |
+
emissiveIntensity: 0.1
|
| 481 |
+
})
|
| 482 |
+
);
|
| 483 |
+
debris.position.set(
|
| 484 |
+
Math.random() * 100 - 50,
|
| 485 |
+
Math.random() * 100 - 50,
|
| 486 |
+
Math.random() * 100 - 50
|
| 487 |
+
);
|
| 488 |
+
debris.rotation.set(
|
| 489 |
+
Math.random() * Math.PI,
|
| 490 |
+
Math.random() * Math.PI,
|
| 491 |
+
Math.random() * Math.PI
|
| 492 |
+
);
|
| 493 |
+
debris.userData = {
|
| 494 |
+
velocity: new THREE.Vector3(
|
| 495 |
+
Math.random() * 0.2 - 0.1,
|
| 496 |
+
Math.random() * 0.2 - 0.1,
|
| 497 |
+
Math.random() * 0.2 - 0.1
|
| 498 |
+
),
|
| 499 |
+
rotationSpeed: new THREE.Vector3(
|
| 500 |
+
Math.random() * 0.02 - 0.01,
|
| 501 |
+
Math.random() * 0.02 - 0.01,
|
| 502 |
+
Math.random() * 0.02 - 0.01
|
| 503 |
+
)
|
| 504 |
+
};
|
| 505 |
+
scene.add(debris);
|
| 506 |
+
debrisParticles.push(debris);
|
| 507 |
+
}
|
| 508 |
+
}
|
| 509 |
+
|
| 510 |
+
// Initialize the game
|
| 511 |
+
function initGame() {
|
| 512 |
+
// Create player ship with procedural SVG
|
| 513 |
+
const playerShip = document.getElementById('player-ship');
|
| 514 |
+
playerShip.innerHTML = generatePlayerShip();
|
| 515 |
+
|
| 516 |
+
// Position player ship
|
| 517 |
+
updatePlayerPosition();
|
| 518 |
+
|
| 519 |
+
// Set up event listeners
|
| 520 |
+
window.addEventListener('keydown', handleKeyDown);
|
| 521 |
+
window.addEventListener('keyup', handleKeyUp);
|
| 522 |
+
window.addEventListener('resize', onWindowResize);
|
| 523 |
+
|
| 524 |
+
document.getElementById('restart-btn').addEventListener('click', resetGame);
|
| 525 |
+
|
| 526 |
+
// Start game loop
|
| 527 |
+
gameLoop();
|
| 528 |
+
}
|
| 529 |
+
|
| 530 |
+
// Handle key down events
|
| 531 |
+
function handleKeyDown(e) {
|
| 532 |
+
if (keys.hasOwnProperty(e.key)) {
|
| 533 |
+
keys[e.key] = true;
|
| 534 |
+
e.preventDefault();
|
| 535 |
+
}
|
| 536 |
+
}
|
| 537 |
+
|
| 538 |
+
// Handle key up events
|
| 539 |
+
function handleKeyUp(e) {
|
| 540 |
+
if (keys.hasOwnProperty(e.key)) {
|
| 541 |
+
keys[e.key] = false;
|
| 542 |
+
e.preventDefault();
|
| 543 |
+
}
|
| 544 |
+
}
|
| 545 |
+
|
| 546 |
+
// Update player position based on key states
|
| 547 |
+
function updatePlayerPosition() {
|
| 548 |
+
if (keys.ArrowUp && player.y > player.height / 2) {
|
| 549 |
+
player.y -= player.speed;
|
| 550 |
+
}
|
| 551 |
+
if (keys.ArrowDown && player.y < window.innerHeight - player.height / 2) {
|
| 552 |
+
player.y += player.speed;
|
| 553 |
+
}
|
| 554 |
+
if (keys.ArrowLeft && player.x > player.width / 2) {
|
| 555 |
+
player.x -= player.speed;
|
| 556 |
+
}
|
| 557 |
+
if (keys.ArrowRight && player.x < window.innerWidth - player.width / 2) {
|
| 558 |
+
player.x += player.speed;
|
| 559 |
+
}
|
| 560 |
+
|
| 561 |
+
// Update DOM element position
|
| 562 |
+
const ship = document.getElementById('player-ship');
|
| 563 |
+
ship.style.left = `${player.x - player.width / 2}px`;
|
| 564 |
+
ship.style.top = `${player.y - player.height / 2}px`;
|
| 565 |
+
|
| 566 |
+
// Shoot if space is pressed and delay has passed
|
| 567 |
+
const now = Date.now();
|
| 568 |
+
if (keys[' '] && now - player.lastShot > player.shootDelay) {
|
| 569 |
+
shoot();
|
| 570 |
+
player.lastShot = now;
|
| 571 |
+
}
|
| 572 |
+
}
|
| 573 |
+
|
| 574 |
+
// Create a new projectile
|
| 575 |
+
function shoot() {
|
| 576 |
+
const projectile = document.createElement('div');
|
| 577 |
+
projectile.className = 'projectile';
|
| 578 |
+
projectile.innerHTML = generateProjectile();
|
| 579 |
+
projectile.style.left = `${player.x + player.width / 2}px`;
|
| 580 |
+
projectile.style.top = `${player.y - 4}px`;
|
| 581 |
+
document.getElementById('game-container').appendChild(projectile);
|
| 582 |
+
|
| 583 |
+
projectiles.push({
|
| 584 |
+
element: projectile,
|
| 585 |
+
x: player.x + player.width / 2,
|
| 586 |
+
y: player.y,
|
| 587 |
+
speed: 12,
|
| 588 |
+
width: 24,
|
| 589 |
+
height: 8
|
| 590 |
+
});
|
| 591 |
+
}
|
| 592 |
+
|
| 593 |
+
// Update all projectiles
|
| 594 |
+
function updateProjectiles() {
|
| 595 |
+
for (let i = projectiles.length - 1; i >= 0; i--) {
|
| 596 |
+
const p = projectiles[i];
|
| 597 |
+
p.x += p.speed;
|
| 598 |
+
p.element.style.left = `${p.x}px`;
|
| 599 |
+
|
| 600 |
+
// Remove if off screen
|
| 601 |
+
if (p.x > window.innerWidth) {
|
| 602 |
+
p.element.remove();
|
| 603 |
+
projectiles.splice(i, 1);
|
| 604 |
+
}
|
| 605 |
+
}
|
| 606 |
+
}
|
| 607 |
+
|
| 608 |
+
// Spawn a new enemy
|
| 609 |
+
function spawnEnemy() {
|
| 610 |
+
const enemy = document.createElement('div');
|
| 611 |
+
enemy.className = 'enemy-ship';
|
| 612 |
+
enemy.innerHTML = generateEnemyShip();
|
| 613 |
+
const y = Math.random() * (window.innerHeight - 100) + 50;
|
| 614 |
+
enemy.style.left = `${window.innerWidth}px`;
|
| 615 |
+
enemy.style.top = `${y - 25}px`;
|
| 616 |
+
document.getElementById('game-container').appendChild(enemy);
|
| 617 |
+
|
| 618 |
+
enemies.push({
|
| 619 |
+
element: enemy,
|
| 620 |
+
x: window.innerWidth,
|
| 621 |
+
y: y,
|
| 622 |
+
speed: 3 + Math.random() * 3,
|
| 623 |
+
width: 50,
|
| 624 |
+
height: 50
|
| 625 |
+
});
|
| 626 |
+
}
|
| 627 |
+
|
| 628 |
+
// Update all enemies
|
| 629 |
+
function updateEnemies() {
|
| 630 |
+
for (let i = enemies.length - 1; i >= 0; i--) {
|
| 631 |
+
const e = enemies[i];
|
| 632 |
+
e.x -= e.speed;
|
| 633 |
+
e.element.style.left = `${e.x}px`;
|
| 634 |
+
|
| 635 |
+
// Remove if off screen
|
| 636 |
+
if (e.x < -e.width) {
|
| 637 |
+
e.element.remove();
|
| 638 |
+
enemies.splice(i, 1);
|
| 639 |
+
}
|
| 640 |
+
}
|
| 641 |
+
}
|
| 642 |
+
|
| 643 |
+
// Check for collisions
|
| 644 |
+
function checkCollisions() {
|
| 645 |
+
// Projectile-enemy collisions
|
| 646 |
+
for (let i = projectiles.length - 1; i >= 0; i--) {
|
| 647 |
+
const p = projectiles[i];
|
| 648 |
+
|
| 649 |
+
for (let j = enemies.length - 1; j >= 0; j--) {
|
| 650 |
+
const e = enemies[j];
|
| 651 |
+
|
| 652 |
+
if (p.x < e.x + e.width &&
|
| 653 |
+
p.x + p.width > e.x &&
|
| 654 |
+
p.y < e.y + e.height &&
|
| 655 |
+
p.y + p.height > e.y) {
|
| 656 |
+
|
| 657 |
+
// Collision detected
|
| 658 |
+
createEnhancedExplosion(e.x + e.width/2, e.y + e.height/2);
|
| 659 |
+
|
| 660 |
+
// Remove both projectile and enemy
|
| 661 |
+
p.element.remove();
|
| 662 |
+
projectiles.splice(i, 1);
|
| 663 |
+
|
| 664 |
+
e.element.remove();
|
| 665 |
+
enemies.splice(j, 1);
|
| 666 |
+
|
| 667 |
+
// Increase score
|
| 668 |
+
score += 100;
|
| 669 |
+
document.getElementById('score').textContent = score;
|
| 670 |
+
document.getElementById('enemies').textContent = enemies.length;
|
| 671 |
+
|
| 672 |
+
break;
|
| 673 |
+
}
|
| 674 |
+
}
|
| 675 |
+
}
|
| 676 |
+
|
| 677 |
+
// Player-enemy collisions
|
| 678 |
+
for (let i = enemies.length - 1; i >= 0; i--) {
|
| 679 |
+
const e = enemies[i];
|
| 680 |
+
|
| 681 |
+
if (player.x < e.x + e.width &&
|
| 682 |
+
player.x + player.width > e.x &&
|
| 683 |
+
player.y < e.y + e.height &&
|
| 684 |
+
player.y + player.height > e.y) {
|
| 685 |
+
|
| 686 |
+
// Collision detected
|
| 687 |
+
createEnhancedExplosion(e.x + e.width/2, e.y + e.height/2);
|
| 688 |
+
|
| 689 |
+
// Remove enemy
|
| 690 |
+
e.element.remove();
|
| 691 |
+
enemies.splice(i, 1);
|
| 692 |
+
|
| 693 |
+
// Decrease player health
|
| 694 |
+
player.health -= 20;
|
| 695 |
+
document.getElementById('health').textContent = player.health;
|
| 696 |
+
|
| 697 |
+
if (player.health <= 0) {
|
| 698 |
+
gameOver();
|
| 699 |
+
}
|
| 700 |
+
|
| 701 |
+
break;
|
| 702 |
+
}
|
| 703 |
+
}
|
| 704 |
+
}
|
| 705 |
+
|
| 706 |
+
// Create enhanced explosion effect with particles, sparks and smoke
|
| 707 |
+
function createEnhancedExplosion(x, y) {
|
| 708 |
+
// Create explosion container
|
| 709 |
+
const explosion = document.createElement('div');
|
| 710 |
+
explosion.className = 'explosion';
|
| 711 |
+
explosion.style.left = `${x - 60}px`;
|
| 712 |
+
explosion.style.top = `${y - 60}px`;
|
| 713 |
+
document.getElementById('game-container').appendChild(explosion);
|
| 714 |
+
|
| 715 |
+
// Create shockwave
|
| 716 |
+
const shockwave = document.createElement('div');
|
| 717 |
+
shockwave.className = 'shockwave';
|
| 718 |
+
shockwave.style.left = '60px';
|
| 719 |
+
shockwave.style.top = '60px';
|
| 720 |
+
shockwave.style.width = '40px';
|
| 721 |
+
shockwave.style.height = '40px';
|
| 722 |
+
shockwave.style.animation = 'shockwave 0.5s ease-out forwards';
|
| 723 |
+
explosion.appendChild(shockwave);
|
| 724 |
+
|
| 725 |
+
// Create core explosion
|
| 726 |
+
const core = document.createElement('div');
|
| 727 |
+
core.className = 'explosion-particle';
|
| 728 |
+
core.style.left = '60px';
|
| 729 |
+
core.style.top = '60px';
|
| 730 |
+
core.style.width = '40px';
|
| 731 |
+
core.style.height = '40px';
|
| 732 |
+
core.style.background = 'radial-gradient(circle, #ff9900, #ff2d7b)';
|
| 733 |
+
core.style.boxShadow = '0 0 20px #ff2d7b';
|
| 734 |
+
core.style.animation = 'explode 0.5s forwards';
|
| 735 |
+
explosion.appendChild(core);
|
| 736 |
+
|
| 737 |
+
// Create particles (50-100)
|
| 738 |
+
const particleCount = 50 + Math.floor(Math.random() * 50);
|
| 739 |
+
for (let i = 0; i < particleCount; i++) {
|
| 740 |
+
const particle = document.createElement('div');
|
| 741 |
+
particle.className = 'explosion-particle';
|
| 742 |
+
|
| 743 |
+
// Random size between 4-12px
|
| 744 |
+
const size = 4 + Math.random() * 8;
|
| 745 |
+
particle.style.width = `${size}px`;
|
| 746 |
+
particle.style.height = `${size}px`;
|
| 747 |
+
|
| 748 |
+
// Random color (yellow to red)
|
| 749 |
+
const hue = 20 + Math.random() * 40;
|
| 750 |
+
particle.style.background = `hsl(${hue}, 100%, 50%)`;
|
| 751 |
+
particle.style.boxShadow = `0 0 ${size/2}px hsl(${hue}, 100%, 50%)`;
|
| 752 |
+
|
| 753 |
+
// Random position around explosion center
|
| 754 |
+
const angle = Math.random() * Math.PI * 2;
|
| 755 |
+
const distance = 10 + Math.random() * 20;
|
| 756 |
+
const px = 60 + Math.cos(angle) * distance;
|
| 757 |
+
const py = 60 + Math.sin(angle) * distance;
|
| 758 |
+
particle.style.left = `${px}px`;
|
| 759 |
+
particle.style.top = `${py}px`;
|
| 760 |
+
|
| 761 |
+
// Random movement direction and distance
|
| 762 |
+
const tx = (Math.random() - 0.5) * 100;
|
| 763 |
+
const ty = (Math.random() - 0.5) * 100;
|
| 764 |
+
particle.style.setProperty('--tx', `${tx}px`);
|
| 765 |
+
particle.style.setProperty('--ty', `${ty}px`);
|
| 766 |
+
|
| 767 |
+
particle.style.animation = `particle-fly ${0.5 + Math.random() * 0.5}s ease-out forwards`;
|
| 768 |
+
explosion.appendChild(particle);
|
| 769 |
+
}
|
| 770 |
+
|
| 771 |
+
// Create sparks (30-60)
|
| 772 |
+
const sparkCount = 30 + Math.floor(Math.random() * 30);
|
| 773 |
+
for (let i = 0; i < sparkCount; i++) {
|
| 774 |
+
const spark = document.createElement('div');
|
| 775 |
+
spark.className = 'spark';
|
| 776 |
+
|
| 777 |
+
// Random color (white to yellow)
|
| 778 |
+
const hue = 40 + Math.random() * 20;
|
| 779 |
+
spark.style.background = `hsl(${hue}, 100%, 80%)`;
|
| 780 |
+
|
| 781 |
+
// Random position around explosion center
|
| 782 |
+
const angle = Math.random() * Math.PI * 2;
|
| 783 |
+
const distance = 5 + Math.random() * 15;
|
| 784 |
+
const px = 60 + Math.cos(angle) * distance;
|
| 785 |
+
const py = 60 + Math.sin(angle) * distance;
|
| 786 |
+
spark.style.left = `${px}px`;
|
| 787 |
+
spark.style.top = `${py}px`;
|
| 788 |
+
|
| 789 |
+
// Random movement direction and distance
|
| 790 |
+
const tx = (Math.random() - 0.5) * 150;
|
| 791 |
+
const ty = (Math.random() - 0.5) * 150;
|
| 792 |
+
spark.style.setProperty('--tx', `${tx}px`);
|
| 793 |
+
spark.style.setProperty('--ty', `${ty}px`);
|
| 794 |
+
|
| 795 |
+
spark.style.animation = `spark-fly ${0.3 + Math.random() * 0.4}s linear forwards`;
|
| 796 |
+
explosion.appendChild(spark);
|
| 797 |
+
}
|
| 798 |
+
|
| 799 |
+
// Create smoke (20-40)
|
| 800 |
+
const smokeCount = 20 + Math.floor(Math.random() * 20);
|
| 801 |
+
for (let i = 0; i < smokeCount; i++) {
|
| 802 |
+
const smoke = document.createElement('div');
|
| 803 |
+
smoke.className = 'smoke';
|
| 804 |
+
|
| 805 |
+
// Random size between 10-30px
|
| 806 |
+
const size = 10 + Math.random() * 20;
|
| 807 |
+
smoke.style.width = `${size}px`;
|
| 808 |
+
smoke.style.height = `${size}px`;
|
| 809 |
+
|
| 810 |
+
// Random gray color
|
| 811 |
+
const lightness = 20 + Math.random() * 30;
|
| 812 |
+
smoke.style.background = `hsla(0, 0%, ${lightness}%, 0.7)`;
|
| 813 |
+
|
| 814 |
+
// Random position around explosion center
|
| 815 |
+
const angle = Math.random() * Math.PI * 2;
|
| 816 |
+
const distance = 5 + Math.random() * 15;
|
| 817 |
+
const px = 60 + Math.cos(angle) * distance;
|
| 818 |
+
const py = 60 + Math.sin(angle) * distance;
|
| 819 |
+
smoke.style.left = `${px}px`;
|
| 820 |
+
smoke.style.top = `${py}px`;
|
| 821 |
+
|
| 822 |
+
// Random upward movement with some horizontal variation
|
| 823 |
+
const tx = (Math.random() - 0.5) * 40;
|
| 824 |
+
const ty = -30 - Math.random() * 50;
|
| 825 |
+
smoke.style.setProperty('--tx', `${tx}px`);
|
| 826 |
+
smoke.style.setProperty('--ty', `${ty}px`);
|
| 827 |
+
|
| 828 |
+
smoke.style.animation = `smoke-rise ${1 + Math.random() * 1}s ease-out forwards`;
|
| 829 |
+
explosion.appendChild(smoke);
|
| 830 |
+
}
|
| 831 |
+
|
| 832 |
+
// Remove explosion after animation completes
|
| 833 |
+
setTimeout(() => {
|
| 834 |
+
explosion.remove();
|
| 835 |
+
}, 1000);
|
| 836 |
+
}
|
| 837 |
+
|
| 838 |
+
// Game over state
|
| 839 |
+
function gameOver() {
|
| 840 |
+
gameRunning = false;
|
| 841 |
+
document.getElementById('final-score').textContent = score;
|
| 842 |
+
document.getElementById('game-over').style.display = 'flex';
|
| 843 |
+
}
|
| 844 |
+
|
| 845 |
+
// Reset the game
|
| 846 |
+
function resetGame() {
|
| 847 |
+
// Clear all elements
|
| 848 |
+
projectiles.forEach(p => p.element.remove());
|
| 849 |
+
enemies.forEach(e => e.element.remove());
|
| 850 |
+
|
| 851 |
+
// Reset variables
|
| 852 |
+
projectiles = [];
|
| 853 |
+
enemies = [];
|
| 854 |
+
player.health = 100;
|
| 855 |
+
score = 0;
|
| 856 |
+
gameRunning = true;
|
| 857 |
+
|
| 858 |
+
// Update HUD
|
| 859 |
+
document.getElementById('score').textContent = score;
|
| 860 |
+
document.getElementById('health').textContent = player.health;
|
| 861 |
+
document.getElementById('enemies').textContent = enemies.length;
|
| 862 |
+
document.getElementById('game-over').style.display = 'none';
|
| 863 |
+
|
| 864 |
+
// Reset player position
|
| 865 |
+
player.x = 100;
|
| 866 |
+
player.y = window.innerHeight / 2;
|
| 867 |
+
updatePlayerPosition();
|
| 868 |
+
|
| 869 |
+
// Regenerate player ship
|
| 870 |
+
const playerShip = document.getElementById('player-ship');
|
| 871 |
+
playerShip.innerHTML = generatePlayerShip();
|
| 872 |
+
}
|
| 873 |
+
|
| 874 |
+
// Handle window resize
|
| 875 |
+
function onWindowResize() {
|
| 876 |
+
// Update Three.js renderer
|
| 877 |
+
camera.aspect = window.innerWidth / window.innerHeight;
|
| 878 |
+
camera.updateProjectionMatrix();
|
| 879 |
+
renderer.setSize(window.innerWidth, window.innerHeight);
|
| 880 |
+
|
| 881 |
+
// Update player position if needed
|
| 882 |
+
if (player.y > window.innerHeight - player.height / 2) {
|
| 883 |
+
player.y = window.innerHeight - player.height / 2;
|
| 884 |
+
updatePlayerPosition();
|
| 885 |
+
}
|
| 886 |
+
}
|
| 887 |
+
|
| 888 |
+
// Main game loop
|
| 889 |
+
function gameLoop() {
|
| 890 |
+
if (!gameRunning) return;
|
| 891 |
+
|
| 892 |
+
// Update background animation
|
| 893 |
+
updateBackground();
|
| 894 |
+
|
| 895 |
+
// Update game elements
|
| 896 |
+
updatePlayerPosition();
|
| 897 |
+
updateProjectiles();
|
| 898 |
+
updateEnemies();
|
| 899 |
+
checkCollisions();
|
| 900 |
+
|
| 901 |
+
// Spawn new enemies
|
| 902 |
+
const now = Date.now();
|
| 903 |
+
if (now - lastEnemySpawn > enemySpawnRate) {
|
| 904 |
+
spawnEnemy();
|
| 905 |
+
lastEnemySpawn = now;
|
| 906 |
+
|
| 907 |
+
// Increase difficulty
|
| 908 |
+
if (score > 0 && score % 1000 === 0) {
|
| 909 |
+
enemySpawnRate = Math.max(300, enemySpawnRate - 50);
|
| 910 |
+
}
|
| 911 |
+
}
|
| 912 |
+
|
| 913 |
+
// Continue loop
|
| 914 |
+
requestAnimationFrame(gameLoop);
|
| 915 |
+
}
|
| 916 |
+
|
| 917 |
+
// Update background animation
|
| 918 |
+
function updateBackground() {
|
| 919 |
+
// Rotate wormhole
|
| 920 |
+
wormhole.rotation.z += 0.005;
|
| 921 |
+
|
| 922 |
+
// Update debris particles
|
| 923 |
+
debrisParticles.forEach(debris => {
|
| 924 |
+
debris.position.add(debris.userData.velocity);
|
| 925 |
+
debris.rotation.x += debris.userData.rotationSpeed.x;
|
| 926 |
+
debris.rotation.y += debris.userData.rotationSpeed.y;
|
| 927 |
+
debris.rotation.z += debris.userData.rotationSpeed.z;
|
| 928 |
+
|
| 929 |
+
// Wrap around if out of bounds
|
| 930 |
+
if (Math.abs(debris.position.x) > 100) debris.position.x = -debris.position.x;
|
| 931 |
+
if (Math.abs(debris.position.y) > 100) debris.position.y = -debris.position.y;
|
| 932 |
+
if (Math.abs(debris.position.z) > 100) debris.position.z = -debris.position.z;
|
| 933 |
+
});
|
| 934 |
+
|
| 935 |
+
renderer.render(scene, camera);
|
| 936 |
+
}
|
| 937 |
+
|
| 938 |
+
// Initialize everything
|
| 939 |
+
function init() {
|
| 940 |
+
initBackground();
|
| 941 |
+
initGame();
|
| 942 |
+
}
|
| 943 |
+
|
| 944 |
+
// Start the game
|
| 945 |
+
init();
|
| 946 |
+
</script>
|
| 947 |
+
<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=LukasBe/andromeda-blast" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
| 948 |
+
</html>
|
prompts.txt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Keep the 3d as a cool background and turn it into a side scroller space themed shooter ... arrow keys control a space ship, space fires shots from left to right of the screen, and from the right to left are comming enemy ships that the user can shoot ...
|
| 2 |
+
Make the player's ship, the shots, and the enemy ship a complex high quality procedural art images ...
|
| 3 |
+
Enhance the explosions with tons of particles, sparks, and smoke :)
|