undefined - Initial Deployment
Browse files- README.md +6 -4
- index.html +570 -19
- prompts.txt +0 -0
README.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
colorTo: green
|
| 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: trail
|
| 3 |
+
emoji: 🐳
|
| 4 |
+
colorFrom: purple
|
| 5 |
colorTo: green
|
| 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,570 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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width, initial-scale=1.0">
|
| 6 |
+
<title>Jet Fighter Combat</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 |
+
<script>
|
| 10 |
+
tailwind.config = {
|
| 11 |
+
theme: {
|
| 12 |
+
extend: {
|
| 13 |
+
colors: {
|
| 14 |
+
'jet-blue': '#0d47a1',
|
| 15 |
+
'combat-orange': '#ff6d00',
|
| 16 |
+
'sky-dark': '#1565c0',
|
| 17 |
+
'sky-light': '#81d4fa'
|
| 18 |
+
}
|
| 19 |
+
}
|
| 20 |
+
}
|
| 21 |
+
}
|
| 22 |
+
</script>
|
| 23 |
+
<style>
|
| 24 |
+
#game-canvas {
|
| 25 |
+
background: linear-gradient(to bottom, #81d4fa, #1565c0);
|
| 26 |
+
border-radius: 8px;
|
| 27 |
+
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
#controls {
|
| 31 |
+
background: linear-gradient(to right, #0d47a1, #1a237e);
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
.control-btn {
|
| 35 |
+
transition: all 0.2s ease;
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
.control-btn:hover {
|
| 39 |
+
transform: translateY(-3px);
|
| 40 |
+
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
.explosion {
|
| 44 |
+
position: absolute;
|
| 45 |
+
width: 100px;
|
| 46 |
+
height: 100px;
|
| 47 |
+
background: radial-gradient(circle, #ff6d00, #ffab40);
|
| 48 |
+
border-radius: 50%;
|
| 49 |
+
animation: explode 0.6s ease-out;
|
| 50 |
+
pointer-events: none;
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
@keyframes explode {
|
| 54 |
+
0% {
|
| 55 |
+
transform: scale(0);
|
| 56 |
+
opacity: 1;
|
| 57 |
+
}
|
| 58 |
+
100% {
|
| 59 |
+
transform: scale(2);
|
| 60 |
+
opacity: 0;
|
| 61 |
+
}
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
@keyframes float {
|
| 65 |
+
0% { transform: translateY(0px); }
|
| 66 |
+
50% { transform: translateY(-10px); }
|
| 67 |
+
100% { transform: translateY(0px); }
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
.floating {
|
| 71 |
+
animation: float 3s ease-in-out infinite;
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
.cloud {
|
| 75 |
+
position: absolute;
|
| 76 |
+
background: rgba(255, 255, 255, 0.7);
|
| 77 |
+
border-radius: 50%;
|
| 78 |
+
}
|
| 79 |
+
</style>
|
| 80 |
+
</head>
|
| 81 |
+
<body class="bg-gray-900 min-h-screen flex items-center justify-center py-8">
|
| 82 |
+
<div class="w-full max-w-4xl">
|
| 83 |
+
<!-- Game Title -->
|
| 84 |
+
<div class="text-center mb-8">
|
| 85 |
+
<h1 class="text-4xl md:text-5xl font-bold text-white mb-2">JET COMBAT COMMANDER</h1>
|
| 86 |
+
<div class="inline-flex items-center bg-gradient-to-r from-combat-orange to-yellow-500 px-6 py-2 rounded-full">
|
| 87 |
+
<i class="fas fa-fighter-jet text-xl mr-2 text-white"></i>
|
| 88 |
+
<p class="text-white font-bold">AIR SUPERIORITY SIMULATION</p>
|
| 89 |
+
</div>
|
| 90 |
+
</div>
|
| 91 |
+
|
| 92 |
+
<!-- Game Stats -->
|
| 93 |
+
<div class="flex justify-between items-center mb-4 px-2">
|
| 94 |
+
<div class="flex items-center">
|
| 95 |
+
<div class="bg-gradient-to-b from-sky-dark to-jet-blue px-4 py-2 rounded-lg mr-4">
|
| 96 |
+
<p class="text-white font-semibold flex items-center">
|
| 97 |
+
<i class="fas fa-crosshairs mr-2"></i> SCORE: <span id="score" class="ml-2 text-yellow-400">0</span>
|
| 98 |
+
</p>
|
| 99 |
+
</div>
|
| 100 |
+
<div class="bg-gradient-to-b from-sky-dark to-jet-blue px-4 py-2 rounded-lg">
|
| 101 |
+
<p class="text-white font-semibold flex items-center">
|
| 102 |
+
<i class="fas fa-heart mr-2 text-red-500"></i> HEALTH: <span id="health" class="ml-2 text-green-400">100</span>%
|
| 103 |
+
</p>
|
| 104 |
+
</div>
|
| 105 |
+
</div>
|
| 106 |
+
|
| 107 |
+
<div class="flex items-center">
|
| 108 |
+
<div class="bg-gradient-to-b from-sky-dark to-jet-blue px-4 py-2 rounded-lg">
|
| 109 |
+
<p class="text-white font-semibold flex items-center">
|
| 110 |
+
<i class="fas fa-rocket mr-2 text-yellow-400"></i> MISSILES: <span id="missiles" class="ml-2">30</span>
|
| 111 |
+
</p>
|
| 112 |
+
</div>
|
| 113 |
+
</div>
|
| 114 |
+
</div>
|
| 115 |
+
|
| 116 |
+
<!-- Game Area -->
|
| 117 |
+
<div class="relative rounded-xl overflow-hidden mb-6">
|
| 118 |
+
<canvas id="game-canvas" class="w-full" height="500"></canvas>
|
| 119 |
+
|
| 120 |
+
<!-- Start Screen -->
|
| 121 |
+
<div id="start-screen" class="absolute inset-0 flex flex-col items-center justify-center bg-black bg-opacity-80">
|
| 122 |
+
<div class="floating mb-8">
|
| 123 |
+
<i class="fas fa-fighter-jet text-7xl text-white"></i>
|
| 124 |
+
</div>
|
| 125 |
+
<h2 class="text-4xl font-bold text-white mb-6">AIR COMBAT READY</h2>
|
| 126 |
+
<button id="start-btn" class="bg-gradient-to-r from-red-600 to-combat-orange px-8 py-4 rounded-full text-white font-bold text-xl hover:scale-105 transition-all">
|
| 127 |
+
ENGAGE ENEMY <i class="fas fa-play ml-2"></i>
|
| 128 |
+
</button>
|
| 129 |
+
<div class="mt-8 flex flex-wrap justify-center gap-4">
|
| 130 |
+
<div class="bg-gray-800 rounded-lg px-4 py-2">
|
| 131 |
+
<p class="text-white flex items-center"><i class="fas fa-arrow-up mr-2"></i> <i class="fas fa-arrow-down mr-2"></i> <i class="fas fa-arrow-left mr-2"></i> <i class="fas fa-arrow-right mr-2"></i> Move Jet</p>
|
| 132 |
+
</div>
|
| 133 |
+
<div class="bg-gray-800 rounded-lg px-4 py-2">
|
| 134 |
+
<p class="text-white flex items-center"><i class="fas fa-space-shuttle mr-2 text-yellow-500"></i> SPACE to Fire Missile</p>
|
| 135 |
+
</div>
|
| 136 |
+
</div>
|
| 137 |
+
</div>
|
| 138 |
+
|
| 139 |
+
<!-- Game Over Screen -->
|
| 140 |
+
<div id="game-over" class="absolute inset-0 flex flex-col items-center justify-center bg-black bg-opacity-80 hidden">
|
| 141 |
+
<div class="mb-8">
|
| 142 |
+
<i class="fas fa-skull-crossbones text-7xl text-red-600"></i>
|
| 143 |
+
</div>
|
| 144 |
+
<h2 class="text-4xl font-bold text-white mb-2">MISSION FAILED</h2>
|
| 145 |
+
<p class="text-white text-xl mb-8">Your Score: <span id="final-score" class="text-yellow-400">0</span></p>
|
| 146 |
+
<button id="restart-btn" class="bg-gradient-to-r from-green-600 to-emerald-500 px-8 py-4 rounded-full text-white font-bold text-xl hover:scale-105 transition-all">
|
| 147 |
+
RESTART MISSION <i class="fas fa-redo ml-2"></i>
|
| 148 |
+
</button>
|
| 149 |
+
</div>
|
| 150 |
+
</div>
|
| 151 |
+
|
| 152 |
+
<!-- Controls -->
|
| 153 |
+
<div id="controls" class="rounded-xl p-6">
|
| 154 |
+
<div class="grid grid-cols-3 gap-4 mb-6">
|
| 155 |
+
<div></div>
|
| 156 |
+
<button id="up-btn" class="control-btn bg-gradient-to-b from-gray-700 to-gray-900 text-white text-2xl py-6 rounded-lg flex items-center justify-center">
|
| 157 |
+
<i class="fas fa-arrow-up"></i>
|
| 158 |
+
</button>
|
| 159 |
+
<div></div>
|
| 160 |
+
<button id="left-btn" class="control-btn bg-gradient-to-b from-gray-700 to-gray-900 text-white text-2xl py-6 rounded-lg flex items-center justify-center">
|
| 161 |
+
<i class="fas fa-arrow-left"></i>
|
| 162 |
+
</button>
|
| 163 |
+
<button id="fire-btn" class="control-btn bg-gradient-to-b from-red-700 to-red-900 text-white text-2xl py-6 rounded-lg flex items-center justify-center">
|
| 164 |
+
<i class="fas fa-rocket"></i>
|
| 165 |
+
</button>
|
| 166 |
+
<button id="right-btn" class="control-btn bg-gradient-to-b from-gray-700 to-gray-900 text-white text-2xl py-6 rounded-lg flex items-center justify-center">
|
| 167 |
+
<i class="fas fa-arrow-right"></i>
|
| 168 |
+
</button>
|
| 169 |
+
<div></div>
|
| 170 |
+
<button id="down-btn" class="control-btn bg-gradient-to-b from-gray-700 to-gray-900 text-white text-2xl py-6 rounded-lg flex items-center justify-center">
|
| 171 |
+
<i class="fas fa-arrow-down"></i>
|
| 172 |
+
</button>
|
| 173 |
+
<div></div>
|
| 174 |
+
</div>
|
| 175 |
+
|
| 176 |
+
<p class="text-gray-300 text-center">You can also use ARROW KEYS to move and SPACEBAR to fire</p>
|
| 177 |
+
</div>
|
| 178 |
+
</div>
|
| 179 |
+
|
| 180 |
+
<script>
|
| 181 |
+
// Game variables
|
| 182 |
+
const canvas = document.getElementById('game-canvas');
|
| 183 |
+
const ctx = canvas.getContext('2d');
|
| 184 |
+
const startScreen = document.getElementById('start-screen');
|
| 185 |
+
const gameOverScreen = document.getElementById('game-over');
|
| 186 |
+
const startBtn = document.getElementById('start-btn');
|
| 187 |
+
const restartBtn = document.getElementById('restart-btn');
|
| 188 |
+
const scoreElement = document.getElementById('score');
|
| 189 |
+
const healthElement = document.getElementById('health');
|
| 190 |
+
const missilesElement = document.getElementById('missiles');
|
| 191 |
+
const finalScoreElement = document.getElementById('final-score');
|
| 192 |
+
|
| 193 |
+
let gameRunning = false;
|
| 194 |
+
let score = 0;
|
| 195 |
+
let health = 100;
|
| 196 |
+
let missiles = 30;
|
| 197 |
+
let gameSpeed = 1;
|
| 198 |
+
|
| 199 |
+
// Set canvas size
|
| 200 |
+
function resizeCanvas() {
|
| 201 |
+
canvas.width = canvas.clientWidth;
|
| 202 |
+
canvas.height = canvas.clientHeight;
|
| 203 |
+
}
|
| 204 |
+
|
| 205 |
+
window.addEventListener('resize', resizeCanvas);
|
| 206 |
+
resizeCanvas();
|
| 207 |
+
|
| 208 |
+
// Player jet
|
| 209 |
+
const player = {
|
| 210 |
+
x: 100,
|
| 211 |
+
y: canvas.height / 2,
|
| 212 |
+
width: 80,
|
| 213 |
+
height: 40,
|
| 214 |
+
speed: 8,
|
| 215 |
+
draw() {
|
| 216 |
+
// Jet body
|
| 217 |
+
ctx.fillStyle = '#3498db';
|
| 218 |
+
ctx.fillRect(this.x, this.y, this.width, this.height);
|
| 219 |
+
|
| 220 |
+
// Jet cockpit
|
| 221 |
+
ctx.fillStyle = '#85c1e9';
|
| 222 |
+
ctx.beginPath();
|
| 223 |
+
ctx.moveTo(this.x + this.width - 20, this.y + 5);
|
| 224 |
+
ctx.lineTo(this.x + this.width - 10, this.y + this.height/2);
|
| 225 |
+
ctx.lineTo(this.x + this.width - 20, this.y + this.height - 5);
|
| 226 |
+
ctx.closePath();
|
| 227 |
+
ctx.fill();
|
| 228 |
+
|
| 229 |
+
// Jet wings
|
| 230 |
+
ctx.fillStyle = '#2980b9';
|
| 231 |
+
ctx.fillRect(this.x + 20, this.y - 10, 40, 10);
|
| 232 |
+
ctx.fillRect(this.x + 20, this.y + this.height, 40, 10);
|
| 233 |
+
|
| 234 |
+
// Jet tail
|
| 235 |
+
ctx.fillStyle = '#1f618d';
|
| 236 |
+
ctx.fillRect(this.x, this.y + 10, 15, 20);
|
| 237 |
+
}
|
| 238 |
+
};
|
| 239 |
+
|
| 240 |
+
// Enemy jets array
|
| 241 |
+
let enemies = [];
|
| 242 |
+
|
| 243 |
+
// Missiles array (player's)
|
| 244 |
+
let missilesArray = [];
|
| 245 |
+
|
| 246 |
+
// Create an explosion animation
|
| 247 |
+
function createExplosion(x, y) {
|
| 248 |
+
const explosion = document.createElement('div');
|
| 249 |
+
explosion.className = 'explosion';
|
| 250 |
+
explosion.style.left = (x - 50) + 'px';
|
| 251 |
+
explosion.style.top = (y - 50) + 'px';
|
| 252 |
+
document.querySelector('.relative').appendChild(explosion);
|
| 253 |
+
|
| 254 |
+
// Remove after animation completes
|
| 255 |
+
setTimeout(() => {
|
| 256 |
+
explosion.remove();
|
| 257 |
+
}, 600);
|
| 258 |
+
}
|
| 259 |
+
|
| 260 |
+
// Create a cloud at random position
|
| 261 |
+
function createCloud() {
|
| 262 |
+
const cloud = document.createElement('div');
|
| 263 |
+
cloud.className = 'cloud';
|
| 264 |
+
|
| 265 |
+
// Random size
|
| 266 |
+
const size = Math.random() * 100 + 50;
|
| 267 |
+
cloud.style.width = size + 'px';
|
| 268 |
+
cloud.style.height = size/2 + 'px';
|
| 269 |
+
|
| 270 |
+
// Random position
|
| 271 |
+
const yPos = Math.random() * canvas.height;
|
| 272 |
+
cloud.style.left = canvas.width + 100 + 'px';
|
| 273 |
+
cloud.style.top = yPos + 'px';
|
| 274 |
+
|
| 275 |
+
// Random opacity
|
| 276 |
+
cloud.style.opacity = Math.random() * 0.5 + 0.2;
|
| 277 |
+
|
| 278 |
+
document.querySelector('.relative').appendChild(cloud);
|
| 279 |
+
|
| 280 |
+
// Animate cloud
|
| 281 |
+
let xPos = canvas.width + 100;
|
| 282 |
+
const cloudSpeed = Math.random() * 0.5 + 0.2;
|
| 283 |
+
|
| 284 |
+
const moveCloud = setInterval(() => {
|
| 285 |
+
if (!gameRunning) {
|
| 286 |
+
clearInterval(moveCloud);
|
| 287 |
+
cloud.remove();
|
| 288 |
+
return;
|
| 289 |
+
}
|
| 290 |
+
|
| 291 |
+
xPos -= cloudSpeed;
|
| 292 |
+
cloud.style.left = xPos + 'px';
|
| 293 |
+
|
| 294 |
+
if (xPos < -200) {
|
| 295 |
+
clearInterval(moveCloud);
|
| 296 |
+
cloud.remove();
|
| 297 |
+
}
|
| 298 |
+
}, 20);
|
| 299 |
+
}
|
| 300 |
+
|
| 301 |
+
// Generate clouds during gameplay
|
| 302 |
+
setInterval(() => {
|
| 303 |
+
if (gameRunning) {
|
| 304 |
+
createCloud();
|
| 305 |
+
}
|
| 306 |
+
}, 3000);
|
| 307 |
+
|
| 308 |
+
// Enemy class
|
| 309 |
+
class Enemy {
|
| 310 |
+
constructor() {
|
| 311 |
+
this.width = 60;
|
| 312 |
+
this.height = 30;
|
| 313 |
+
this.x = canvas.width + 100;
|
| 314 |
+
this.y = Math.random() * (canvas.height - 100) + 50;
|
| 315 |
+
this.speed = Math.random() * 3 + 2;
|
| 316 |
+
this.color = `hsl(${Math.random() * 60}, 80%, 40%)`; // Shades of red/orange
|
| 317 |
+
}
|
| 318 |
+
|
| 319 |
+
draw() {
|
| 320 |
+
// Enemy jet body
|
| 321 |
+
ctx.fillStyle = this.color;
|
| 322 |
+
ctx.fillRect(this.x, this.y, this.width, this.height);
|
| 323 |
+
|
| 324 |
+
// Enemy cockpit
|
| 325 |
+
ctx.fillStyle = '#e74c3c';
|
| 326 |
+
ctx.beginPath();
|
| 327 |
+
ctx.moveTo(this.x + 10, this.y + 5);
|
| 328 |
+
ctx.lineTo(this.x + 20, this.y + this.height/2);
|
| 329 |
+
ctx.lineTo(this.x + 10, this.y + this.height - 5);
|
| 330 |
+
ctx.closePath();
|
| 331 |
+
ctx.fill();
|
| 332 |
+
|
| 333 |
+
// Enemy wings
|
| 334 |
+
ctx.fillStyle = '#c0392b';
|
| 335 |
+
ctx.fillRect(this.x + this.width - 40, this.y - 8, 30, 8);
|
| 336 |
+
ctx.fillRect(this.x + this.width - 40, this.y + this.height, 30, 8);
|
| 337 |
+
}
|
| 338 |
+
|
| 339 |
+
update() {
|
| 340 |
+
this.x -= this.speed * gameSpeed;
|
| 341 |
+
|
| 342 |
+
// Draw enemy
|
| 343 |
+
this.draw();
|
| 344 |
+
|
| 345 |
+
// Check collision with player
|
| 346 |
+
if (this.x < player.x + player.width &&
|
| 347 |
+
this.x + this.width > player.x &&
|
| 348 |
+
this.y < player.y + player.height &&
|
| 349 |
+
this.y + this.height > player.y) {
|
| 350 |
+
createExplosion(player.x + player.width/2, player.y + player.height/2);
|
| 351 |
+
takeDamage(20);
|
| 352 |
+
return false;
|
| 353 |
+
}
|
| 354 |
+
|
| 355 |
+
// Remove enemy if off screen
|
| 356 |
+
return this.x + this.width > 0;
|
| 357 |
+
}
|
| 358 |
+
}
|
| 359 |
+
|
| 360 |
+
// Missile class
|
| 361 |
+
class Missile {
|
| 362 |
+
constructor() {
|
| 363 |
+
this.x = player.x + player.width;
|
| 364 |
+
this.y = player.y + player.height / 2;
|
| 365 |
+
this.width = 20;
|
| 366 |
+
this.height = 10;
|
| 367 |
+
this.speed = 15;
|
| 368 |
+
this.color = '#f1c40f';
|
| 369 |
+
}
|
| 370 |
+
|
| 371 |
+
draw() {
|
| 372 |
+
// Missile body
|
| 373 |
+
ctx.fillStyle = this.color;
|
| 374 |
+
ctx.fillRect(this.x, this.y, this.width, this.height);
|
| 375 |
+
|
| 376 |
+
// Missile tip
|
| 377 |
+
ctx.fillStyle = '#e74c3c';
|
| 378 |
+
ctx.beginPath();
|
| 379 |
+
ctx.moveTo(this.x + this.width, this.y);
|
| 380 |
+
ctx.lineTo(this.x + this.width + 10, this.y + this.height/2);
|
| 381 |
+
ctx.lineTo(this.x + this.width, this.y + this.height);
|
| 382 |
+
ctx.closePath();
|
| 383 |
+
ctx.fill();
|
| 384 |
+
}
|
| 385 |
+
|
| 386 |
+
update() {
|
| 387 |
+
this.x += this.speed * gameSpeed;
|
| 388 |
+
|
| 389 |
+
// Draw missile
|
| 390 |
+
this.draw();
|
| 391 |
+
|
| 392 |
+
// Check collision with enemies
|
| 393 |
+
for (let i = 0; i < enemies.length; i++) {
|
| 394 |
+
const enemy = enemies[i];
|
| 395 |
+
if (this.x < enemy.x + enemy.width &&
|
| 396 |
+
this.x + this.width > enemy.x &&
|
| 397 |
+
this.y < enemy.y + enemy.height &&
|
| 398 |
+
this.y + this.height > enemy.y) {
|
| 399 |
+
createExplosion(enemy.x + enemy.width/2, enemy.y + enemy.height/2);
|
| 400 |
+
score += 100;
|
| 401 |
+
scoreElement.textContent = score;
|
| 402 |
+
return false;
|
| 403 |
+
}
|
| 404 |
+
}
|
| 405 |
+
|
| 406 |
+
// Remove missile if off screen
|
| 407 |
+
return this.x < canvas.width;
|
| 408 |
+
}
|
| 409 |
+
}
|
| 410 |
+
|
| 411 |
+
// Player take damage
|
| 412 |
+
function takeDamage(amount) {
|
| 413 |
+
health -= amount;
|
| 414 |
+
if (health < 0) health = 0;
|
| 415 |
+
healthElement.textContent = health;
|
| 416 |
+
|
| 417 |
+
if (health <= 0) {
|
| 418 |
+
endGame();
|
| 419 |
+
}
|
| 420 |
+
}
|
| 421 |
+
|
| 422 |
+
// Spawn enemies
|
| 423 |
+
function spawnEnemy() {
|
| 424 |
+
if (!gameRunning) return;
|
| 425 |
+
|
| 426 |
+
if (Math.random() < 0.03) {
|
| 427 |
+
enemies.push(new Enemy());
|
| 428 |
+
}
|
| 429 |
+
|
| 430 |
+
// Increase difficulty with score
|
| 431 |
+
gameSpeed = 1 + score * 0.0001;
|
| 432 |
+
}
|
| 433 |
+
|
| 434 |
+
// Fire missile
|
| 435 |
+
function fireMissile() {
|
| 436 |
+
if (!gameRunning || missiles <= 0) return;
|
| 437 |
+
|
| 438 |
+
missiles--;
|
| 439 |
+
missilesElement.textContent = missiles;
|
| 440 |
+
missilesArray.push(new Missile());
|
| 441 |
+
}
|
| 442 |
+
|
| 443 |
+
// End game
|
| 444 |
+
function endGame() {
|
| 445 |
+
gameRunning = false;
|
| 446 |
+
finalScoreElement.textContent = score;
|
| 447 |
+
gameOverScreen.classList.remove('hidden');
|
| 448 |
+
}
|
| 449 |
+
|
| 450 |
+
// Game loop
|
| 451 |
+
function gameLoop() {
|
| 452 |
+
if (!gameRunning) return;
|
| 453 |
+
|
| 454 |
+
// Clear canvas
|
| 455 |
+
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
| 456 |
+
|
| 457 |
+
// Draw player
|
| 458 |
+
player.draw();
|
| 459 |
+
|
| 460 |
+
// Spawn enemies
|
| 461 |
+
spawnEnemy();
|
| 462 |
+
|
| 463 |
+
// Update and draw enemies
|
| 464 |
+
enemies = enemies.filter(enemy => enemy.update());
|
| 465 |
+
|
| 466 |
+
// Update and draw missiles
|
| 467 |
+
missilesArray = missilesArray.filter(missile => missile.update());
|
| 468 |
+
|
| 469 |
+
requestAnimationFrame(gameLoop);
|
| 470 |
+
}
|
| 471 |
+
|
| 472 |
+
// Initialize game
|
| 473 |
+
startBtn.addEventListener('click', () => {
|
| 474 |
+
startScreen.classList.add('hidden');
|
| 475 |
+
gameRunning = true;
|
| 476 |
+
score = 0;
|
| 477 |
+
health = 100;
|
| 478 |
+
missiles = 30;
|
| 479 |
+
|
| 480 |
+
scoreElement.textContent = score;
|
| 481 |
+
healthElement.textContent = health;
|
| 482 |
+
missilesElement.textContent = missiles;
|
| 483 |
+
|
| 484 |
+
// Reset player position
|
| 485 |
+
player.y = canvas.height / 2;
|
| 486 |
+
|
| 487 |
+
// Clear game objects
|
| 488 |
+
enemies = [];
|
| 489 |
+
missilesArray = [];
|
| 490 |
+
|
| 491 |
+
gameLoop();
|
| 492 |
+
});
|
| 493 |
+
|
| 494 |
+
// Restart game
|
| 495 |
+
restartBtn.addEventListener('click', () => {
|
| 496 |
+
gameOverScreen.classList.add('hidden');
|
| 497 |
+
startScreen.classList.remove('hidden');
|
| 498 |
+
});
|
| 499 |
+
|
| 500 |
+
// Movement controls
|
| 501 |
+
const keys = {};
|
| 502 |
+
|
| 503 |
+
window.addEventListener('keydown', (e) => {
|
| 504 |
+
keys[e.key] = true;
|
| 505 |
+
|
| 506 |
+
if (e.key === ' ' && gameRunning) {
|
| 507 |
+
fireMissile();
|
| 508 |
+
}
|
| 509 |
+
});
|
| 510 |
+
|
| 511 |
+
window.addEventListener('keyup', (e) => {
|
| 512 |
+
keys[e.key] = false;
|
| 513 |
+
});
|
| 514 |
+
|
| 515 |
+
// Touch controls
|
| 516 |
+
document.getElementById('up-btn').addEventListener('touchstart', (e) => {
|
| 517 |
+
e.preventDefault();
|
| 518 |
+
player.y -= player.speed;
|
| 519 |
+
});
|
| 520 |
+
|
| 521 |
+
document.getElementById('down-btn').addEventListener('touchstart', (e) => {
|
| 522 |
+
e.preventDefault();
|
| 523 |
+
player.y += player.speed;
|
| 524 |
+
});
|
| 525 |
+
|
| 526 |
+
document.getElementById('left-btn').addEventListener('touchstart', (e) => {
|
| 527 |
+
e.preventDefault();
|
| 528 |
+
player.x -= player.speed;
|
| 529 |
+
});
|
| 530 |
+
|
| 531 |
+
document.getElementById('right-btn').addEventListener('touchstart', (e) => {
|
| 532 |
+
e.preventDefault();
|
| 533 |
+
player.x += player.speed;
|
| 534 |
+
});
|
| 535 |
+
|
| 536 |
+
document.getElementById('fire-btn').addEventListener('touchstart', (e) => {
|
| 537 |
+
e.preventDefault();
|
| 538 |
+
if (gameRunning) fireMissile();
|
| 539 |
+
});
|
| 540 |
+
|
| 541 |
+
// Movement handler
|
| 542 |
+
function handleMovement() {
|
| 543 |
+
if (!gameRunning) return;
|
| 544 |
+
|
| 545 |
+
if (keys['ArrowUp'] || keys['w'] || keys['W']) {
|
| 546 |
+
player.y -= player.speed;
|
| 547 |
+
}
|
| 548 |
+
if (keys['ArrowDown'] || keys['s'] || keys['S']) {
|
| 549 |
+
player.y += player.speed;
|
| 550 |
+
}
|
| 551 |
+
if (keys['ArrowLeft'] || keys['a'] || keys['A']) {
|
| 552 |
+
player.x -= player.speed;
|
| 553 |
+
}
|
| 554 |
+
if (keys['ArrowRight'] || keys['d'] || keys['D']) {
|
| 555 |
+
player.x += player.speed;
|
| 556 |
+
}
|
| 557 |
+
|
| 558 |
+
// Boundary checks
|
| 559 |
+
if (player.y < 10) player.y = 10;
|
| 560 |
+
if (player.y > canvas.height - player.height - 10) player.y = canvas.height - player.height - 10;
|
| 561 |
+
if (player.x < 10) player.x = 10;
|
| 562 |
+
if (player.x > canvas.width - player.width - 10) player.x = canvas.width - player.width - 10;
|
| 563 |
+
|
| 564 |
+
requestAnimationFrame(handleMovement);
|
| 565 |
+
}
|
| 566 |
+
|
| 567 |
+
handleMovement();
|
| 568 |
+
</script>
|
| 569 |
+
<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=aryansrk/trail" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
| 570 |
+
</html>
|
prompts.txt
ADDED
|
File without changes
|