Spaces:
Running
Running
Add 3 files
Browse files- README.md +6 -4
- index.html +512 -19
- prompts.txt +1 -0
README.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
colorFrom: gray
|
| 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: shadow-fighter
|
| 3 |
+
emoji: 🐳
|
| 4 |
colorFrom: gray
|
| 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,512 @@
|
|
| 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>Sohail: Shadow Fighter</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 walk {
|
| 11 |
+
0%, 100% { transform: translateY(0); }
|
| 12 |
+
50% { transform: translateY(-5px); }
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
+
@keyframes attack {
|
| 16 |
+
0% { transform: translateX(0) rotate(0); }
|
| 17 |
+
50% { transform: translateX(20px) rotate(5deg); }
|
| 18 |
+
100% { transform: translateX(0) rotate(0); }
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
@keyframes jump {
|
| 22 |
+
0%, 100% { transform: translateY(0); }
|
| 23 |
+
50% { transform: translateY(-100px); }
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
@keyframes enemyHit {
|
| 27 |
+
0%, 100% { transform: translateX(0); }
|
| 28 |
+
25% { transform: translateX(30px); }
|
| 29 |
+
50% { transform: translateX(-30px); }
|
| 30 |
+
75% { transform: translateX(15px); }
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
@keyframes enemyDie {
|
| 34 |
+
to { transform: translateY(200px) rotate(360deg); opacity: 0; }
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
.game-container {
|
| 38 |
+
background: linear-gradient(to bottom, #111827, #1f2937);
|
| 39 |
+
overflow: hidden;
|
| 40 |
+
position: relative;
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
.player {
|
| 44 |
+
transition: left 0.1s linear;
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
.player.walking {
|
| 48 |
+
animation: walk 0.5s infinite;
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
.player.attacking {
|
| 52 |
+
animation: attack 0.3s forwards;
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
.player.jumping {
|
| 56 |
+
animation: jump 0.8s forwards;
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
.enemy {
|
| 60 |
+
transition: left 0.2s linear;
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
.enemy.hit {
|
| 64 |
+
animation: enemyHit 0.5s forwards;
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
.enemy.dying {
|
| 68 |
+
animation: enemyDie 1s forwards;
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
.health-bar {
|
| 72 |
+
transition: width 0.3s ease;
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
.sword-slash {
|
| 76 |
+
opacity: 0;
|
| 77 |
+
transition: opacity 0.2s;
|
| 78 |
+
}
|
| 79 |
+
|
| 80 |
+
.sword-slash.active {
|
| 81 |
+
opacity: 1;
|
| 82 |
+
}
|
| 83 |
+
|
| 84 |
+
.shadow {
|
| 85 |
+
filter: drop-shadow(0 0 8px rgba(0, 0, 0, 0.7));
|
| 86 |
+
}
|
| 87 |
+
</style>
|
| 88 |
+
</head>
|
| 89 |
+
<body class="bg-gray-900 text-white">
|
| 90 |
+
<div class="container mx-auto px-4 py-8">
|
| 91 |
+
<h1 class="text-4xl font-bold text-center mb-6 text-yellow-400">Sohail: Shadow Fighter</h1>
|
| 92 |
+
|
| 93 |
+
<div class="flex justify-between items-center mb-4">
|
| 94 |
+
<div class="flex items-center">
|
| 95 |
+
<div class="w-32 bg-gray-700 rounded-full h-4 mr-2">
|
| 96 |
+
<div id="player-health" class="health-bar bg-green-500 h-4 rounded-full" style="width: 100%"></div>
|
| 97 |
+
</div>
|
| 98 |
+
<span class="font-bold">Sohail</span>
|
| 99 |
+
</div>
|
| 100 |
+
|
| 101 |
+
<div class="text-xl font-bold">
|
| 102 |
+
Score: <span id="score">0</span>
|
| 103 |
+
</div>
|
| 104 |
+
|
| 105 |
+
<div class="flex items-center">
|
| 106 |
+
<span class="font-bold mr-2">Enemies: <span id="enemies-left">5</span></span>
|
| 107 |
+
<div class="w-32 bg-gray-700 rounded-full h-4">
|
| 108 |
+
<div id="enemy-health" class="health-bar bg-red-500 h-4 rounded-full" style="width: 100%"></div>
|
| 109 |
+
</div>
|
| 110 |
+
</div>
|
| 111 |
+
</div>
|
| 112 |
+
|
| 113 |
+
<div class="game-container relative h-96 w-full rounded-lg border-2 border-gray-700 shadow-lg">
|
| 114 |
+
<!-- Ground -->
|
| 115 |
+
<div class="absolute bottom-0 w-full h-16 bg-gray-800"></div>
|
| 116 |
+
|
| 117 |
+
<!-- Player -->
|
| 118 |
+
<div id="player" class="player absolute bottom-16 left-32 w-24 h-32 flex flex-col items-center">
|
| 119 |
+
<div class="sword-slash absolute -left-10 -top-10 w-32 h-32 opacity-0 transition-opacity">
|
| 120 |
+
<img src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA1MTIgNTEyIj48cGF0aCBmaWxsPSIjZmZmIiBkPSJNNDQ4IDBMMzY4LjEgMTI4aDgzLjlMNDQ4IDB6bS0xMjggMTI4TDI1NiAyNTZsOTYuMS05Ni4xTDM2MCAxMjhoLTQwem0tODcuOSAwTDEyOCAyNTZsOTYuMS05Ni4xTDI0MCAxMjhoLTc5Ljl6bS0xMjggMEwwIDQ0OGwxMjgtMTI4aDgzLjlMMjI0IDEyOGgtODcuOXoiLz48L3N2Zz4=" class="w-full h-full rotate-45" />
|
| 121 |
+
</div>
|
| 122 |
+
<div class="relative">
|
| 123 |
+
<div class="w-16 h-24 bg-blue-600 rounded-t-full shadow"></div>
|
| 124 |
+
<div class="absolute top-0 left-1/2 transform -translate-x-1/2 w-8 h-8 bg-yellow-400 rounded-full"></div>
|
| 125 |
+
<div class="absolute top-8 left-1/2 transform -translate-x-1/2 w-4 h-4 bg-black rounded-full"></div>
|
| 126 |
+
<div class="absolute top-12 left-1/2 transform -translate-x-1/2 w-16 h-2 bg-gray-300 rounded-full"></div>
|
| 127 |
+
</div>
|
| 128 |
+
<div class="flex justify-center mt-2">
|
| 129 |
+
<div class="w-4 h-8 bg-blue-800"></div>
|
| 130 |
+
<div class="w-16 h-4 bg-blue-600"></div>
|
| 131 |
+
<div class="w-4 h-8 bg-blue-800"></div>
|
| 132 |
+
</div>
|
| 133 |
+
<div class="w-24 h-4 bg-gray-700 rounded-full mt-1"></div>
|
| 134 |
+
<div class="absolute -bottom-4 left-1/2 transform -translate-x-1/2 w-20 h-4 bg-gray-900 opacity-50 rounded-full blur"></div>
|
| 135 |
+
</div>
|
| 136 |
+
|
| 137 |
+
<!-- Enemy -->
|
| 138 |
+
<div id="enemy" class="enemy absolute bottom-16 right-32 w-24 h-32 flex flex-col items-center">
|
| 139 |
+
<div class="relative">
|
| 140 |
+
<div class="w-16 h-24 bg-red-600 rounded-t-full shadow"></div>
|
| 141 |
+
<div class="absolute top-0 left-1/2 transform -translate-x-1/2 w-8 h-8 bg-gray-400 rounded-full"></div>
|
| 142 |
+
<div class="absolute top-8 left-1/2 transform -translate-x-1/2 w-4 h-4 bg-black rounded-full"></div>
|
| 143 |
+
<div class="absolute top-12 left-1/2 transform -translate-x-1/2 w-16 h-2 bg-gray-300 rounded-full"></div>
|
| 144 |
+
</div>
|
| 145 |
+
<div class="flex justify-center mt-2">
|
| 146 |
+
<div class="w-4 h-8 bg-red-800"></div>
|
| 147 |
+
<div class="w-16 h-4 bg-red-600"></div>
|
| 148 |
+
<div class="w-4 h-8 bg-red-800"></div>
|
| 149 |
+
</div>
|
| 150 |
+
<div class="w-24 h-4 bg-gray-700 rounded-full mt-1"></div>
|
| 151 |
+
<div class="absolute -bottom-4 left-1/2 transform -translate-x-1/2 w-20 h-4 bg-gray-900 opacity-50 rounded-full blur"></div>
|
| 152 |
+
</div>
|
| 153 |
+
|
| 154 |
+
<!-- Game Over Screen -->
|
| 155 |
+
<div id="game-over" class="absolute inset-0 bg-black bg-opacity-80 flex flex-col items-center justify-center hidden">
|
| 156 |
+
<h2 class="text-5xl font-bold text-red-500 mb-4">GAME OVER</h2>
|
| 157 |
+
<p class="text-2xl mb-8">Final Score: <span id="final-score">0</span></p>
|
| 158 |
+
<button id="restart-btn" class="px-8 py-3 bg-yellow-500 text-black font-bold rounded-lg hover:bg-yellow-400 transition">Play Again</button>
|
| 159 |
+
</div>
|
| 160 |
+
|
| 161 |
+
<!-- Victory Screen -->
|
| 162 |
+
<div id="victory" class="absolute inset-0 bg-black bg-opacity-80 flex flex-col items-center justify-center hidden">
|
| 163 |
+
<h2 class="text-5xl font-bold text-green-500 mb-4">VICTORY!</h2>
|
| 164 |
+
<p class="text-2xl mb-8">Final Score: <span id="victory-score">0</span></p>
|
| 165 |
+
<button id="next-level-btn" class="px-8 py-3 bg-yellow-500 text-black font-bold rounded-lg hover:bg-yellow-400 transition">Next Level</button>
|
| 166 |
+
</div>
|
| 167 |
+
</div>
|
| 168 |
+
|
| 169 |
+
<div class="mt-6 flex justify-center space-x-4">
|
| 170 |
+
<button id="left-btn" class="px-6 py-3 bg-gray-700 rounded-lg hover:bg-gray-600 transition">
|
| 171 |
+
<i class="fas fa-arrow-left"></i>
|
| 172 |
+
</button>
|
| 173 |
+
<button id="right-btn" class="px-6 py-3 bg-gray-700 rounded-lg hover:bg-gray-600 transition">
|
| 174 |
+
<i class="fas fa-arrow-right"></i>
|
| 175 |
+
</button>
|
| 176 |
+
<button id="attack-btn" class="px-6 py-3 bg-red-600 rounded-lg hover:bg-red-500 transition">
|
| 177 |
+
<i class="fas fa-bolt"></i> Attack
|
| 178 |
+
</button>
|
| 179 |
+
<button id="jump-btn" class="px-6 py-3 bg-blue-600 rounded-lg hover:bg-blue-500 transition">
|
| 180 |
+
<i class="fas fa-arrow-up"></i> Jump
|
| 181 |
+
</button>
|
| 182 |
+
</div>
|
| 183 |
+
|
| 184 |
+
<div class="mt-8 bg-gray-800 p-4 rounded-lg">
|
| 185 |
+
<h3 class="text-xl font-bold mb-2 text-yellow-400">Controls:</h3>
|
| 186 |
+
<ul class="list-disc pl-5">
|
| 187 |
+
<li>Arrow buttons to move left and right</li>
|
| 188 |
+
<li>Attack button to strike enemies</li>
|
| 189 |
+
<li>Jump button to avoid attacks</li>
|
| 190 |
+
<li>Defeat all enemies to win!</li>
|
| 191 |
+
</ul>
|
| 192 |
+
</div>
|
| 193 |
+
</div>
|
| 194 |
+
|
| 195 |
+
<script>
|
| 196 |
+
document.addEventListener('DOMContentLoaded', () => {
|
| 197 |
+
// Game elements
|
| 198 |
+
const player = document.getElementById('player');
|
| 199 |
+
const enemy = document.getElementById('enemy');
|
| 200 |
+
const playerHealth = document.getElementById('player-health');
|
| 201 |
+
const enemyHealth = document.getElementById('enemy-health');
|
| 202 |
+
const scoreElement = document.getElementById('score');
|
| 203 |
+
const enemiesLeftElement = document.getElementById('enemies-left');
|
| 204 |
+
const gameOverScreen = document.getElementById('game-over');
|
| 205 |
+
const victoryScreen = document.getElementById('victory');
|
| 206 |
+
const finalScoreElement = document.getElementById('final-score');
|
| 207 |
+
const victoryScoreElement = document.getElementById('victory-score');
|
| 208 |
+
const swordSlash = player.querySelector('.sword-slash');
|
| 209 |
+
|
| 210 |
+
// Buttons
|
| 211 |
+
const leftBtn = document.getElementById('left-btn');
|
| 212 |
+
const rightBtn = document.getElementById('right-btn');
|
| 213 |
+
const attackBtn = document.getElementById('attack-btn');
|
| 214 |
+
const jumpBtn = document.getElementById('jump-btn');
|
| 215 |
+
const restartBtn = document.getElementById('restart-btn');
|
| 216 |
+
const nextLevelBtn = document.getElementById('next-level-btn');
|
| 217 |
+
|
| 218 |
+
// Game state
|
| 219 |
+
let playerX = 128;
|
| 220 |
+
let enemyX = 500;
|
| 221 |
+
let playerHP = 100;
|
| 222 |
+
let currentEnemyHP = 100;
|
| 223 |
+
let score = 0;
|
| 224 |
+
let enemiesDefeated = 0;
|
| 225 |
+
const totalEnemies = 5;
|
| 226 |
+
let isAttacking = false;
|
| 227 |
+
let isJumping = false;
|
| 228 |
+
let gameActive = true;
|
| 229 |
+
let enemyMovingInterval;
|
| 230 |
+
let enemyAttackingInterval;
|
| 231 |
+
|
| 232 |
+
// Initialize game
|
| 233 |
+
initGame();
|
| 234 |
+
|
| 235 |
+
function initGame() {
|
| 236 |
+
playerX = 128;
|
| 237 |
+
enemyX = 500;
|
| 238 |
+
playerHP = 100;
|
| 239 |
+
currentEnemyHP = 100;
|
| 240 |
+
enemiesDefeated = 0;
|
| 241 |
+
gameActive = true;
|
| 242 |
+
|
| 243 |
+
updatePositions();
|
| 244 |
+
updateHealthBars();
|
| 245 |
+
updateScore();
|
| 246 |
+
updateEnemiesLeft();
|
| 247 |
+
|
| 248 |
+
gameOverScreen.classList.add('hidden');
|
| 249 |
+
victoryScreen.classList.add('hidden');
|
| 250 |
+
|
| 251 |
+
startEnemyAI();
|
| 252 |
+
}
|
| 253 |
+
|
| 254 |
+
function updatePositions() {
|
| 255 |
+
player.style.left = `${playerX}px`;
|
| 256 |
+
enemy.style.left = `${enemyX}px`;
|
| 257 |
+
}
|
| 258 |
+
|
| 259 |
+
function updateHealthBars() {
|
| 260 |
+
playerHealth.style.width = `${playerHP}%`;
|
| 261 |
+
enemyHealth.style.width = `${currentEnemyHP}%`;
|
| 262 |
+
}
|
| 263 |
+
|
| 264 |
+
function updateScore() {
|
| 265 |
+
scoreElement.textContent = score;
|
| 266 |
+
}
|
| 267 |
+
|
| 268 |
+
function updateEnemiesLeft() {
|
| 269 |
+
enemiesLeftElement.textContent = totalEnemies - enemiesDefeated;
|
| 270 |
+
}
|
| 271 |
+
|
| 272 |
+
// Movement controls
|
| 273 |
+
leftBtn.addEventListener('mousedown', () => {
|
| 274 |
+
if (!gameActive) return;
|
| 275 |
+
player.classList.add('walking');
|
| 276 |
+
moveLeft();
|
| 277 |
+
});
|
| 278 |
+
|
| 279 |
+
leftBtn.addEventListener('mouseup', () => {
|
| 280 |
+
player.classList.remove('walking');
|
| 281 |
+
});
|
| 282 |
+
|
| 283 |
+
leftBtn.addEventListener('mouseleave', () => {
|
| 284 |
+
player.classList.remove('walking');
|
| 285 |
+
});
|
| 286 |
+
|
| 287 |
+
rightBtn.addEventListener('mousedown', () => {
|
| 288 |
+
if (!gameActive) return;
|
| 289 |
+
player.classList.add('walking');
|
| 290 |
+
moveRight();
|
| 291 |
+
});
|
| 292 |
+
|
| 293 |
+
rightBtn.addEventListener('mouseup', () => {
|
| 294 |
+
player.classList.remove('walking');
|
| 295 |
+
});
|
| 296 |
+
|
| 297 |
+
rightBtn.addEventListener('mouseleave', () => {
|
| 298 |
+
player.classList.remove('walking');
|
| 299 |
+
});
|
| 300 |
+
|
| 301 |
+
function moveLeft() {
|
| 302 |
+
if (playerX > 0) {
|
| 303 |
+
playerX -= 10;
|
| 304 |
+
updatePositions();
|
| 305 |
+
checkPlayerPosition();
|
| 306 |
+
}
|
| 307 |
+
}
|
| 308 |
+
|
| 309 |
+
function moveRight() {
|
| 310 |
+
if (playerX < 800) {
|
| 311 |
+
playerX += 10;
|
| 312 |
+
updatePositions();
|
| 313 |
+
checkPlayerPosition();
|
| 314 |
+
}
|
| 315 |
+
}
|
| 316 |
+
|
| 317 |
+
// Keyboard controls
|
| 318 |
+
document.addEventListener('keydown', (e) => {
|
| 319 |
+
if (!gameActive) return;
|
| 320 |
+
|
| 321 |
+
if (e.key === 'ArrowLeft') {
|
| 322 |
+
player.classList.add('walking');
|
| 323 |
+
moveLeft();
|
| 324 |
+
} else if (e.key === 'ArrowRight') {
|
| 325 |
+
player.classList.add('walking');
|
| 326 |
+
moveRight();
|
| 327 |
+
} else if (e.key === ' ' || e.key === 'x') {
|
| 328 |
+
attack();
|
| 329 |
+
} else if (e.key === 'ArrowUp' || e.key === 'z') {
|
| 330 |
+
jump();
|
| 331 |
+
}
|
| 332 |
+
});
|
| 333 |
+
|
| 334 |
+
document.addEventListener('keyup', (e) => {
|
| 335 |
+
if (e.key === 'ArrowLeft' || e.key === 'ArrowRight') {
|
| 336 |
+
player.classList.remove('walking');
|
| 337 |
+
}
|
| 338 |
+
});
|
| 339 |
+
|
| 340 |
+
// Attack
|
| 341 |
+
attackBtn.addEventListener('click', attack);
|
| 342 |
+
|
| 343 |
+
function attack() {
|
| 344 |
+
if (!gameActive || isAttacking || isJumping) return;
|
| 345 |
+
|
| 346 |
+
isAttacking = true;
|
| 347 |
+
player.classList.add('attacking');
|
| 348 |
+
swordSlash.classList.add('active');
|
| 349 |
+
|
| 350 |
+
// Check if enemy is in range
|
| 351 |
+
const distance = Math.abs(playerX - enemyX);
|
| 352 |
+
if (distance < 150) {
|
| 353 |
+
hitEnemy();
|
| 354 |
+
}
|
| 355 |
+
|
| 356 |
+
setTimeout(() => {
|
| 357 |
+
player.classList.remove('attacking');
|
| 358 |
+
swordSlash.classList.remove('active');
|
| 359 |
+
isAttacking = false;
|
| 360 |
+
}, 300);
|
| 361 |
+
}
|
| 362 |
+
|
| 363 |
+
function hitEnemy() {
|
| 364 |
+
const damage = Math.floor(Math.random() * 20) + 10;
|
| 365 |
+
currentEnemyHP = Math.max(0, currentEnemyHP - damage);
|
| 366 |
+
updateHealthBars();
|
| 367 |
+
|
| 368 |
+
enemy.classList.add('hit');
|
| 369 |
+
setTimeout(() => {
|
| 370 |
+
enemy.classList.remove('hit');
|
| 371 |
+
}, 500);
|
| 372 |
+
|
| 373 |
+
if (currentEnemyHP <= 0) {
|
| 374 |
+
defeatEnemy();
|
| 375 |
+
}
|
| 376 |
+
}
|
| 377 |
+
|
| 378 |
+
function defeatEnemy() {
|
| 379 |
+
clearInterval(enemyMovingInterval);
|
| 380 |
+
clearInterval(enemyAttackingInterval);
|
| 381 |
+
|
| 382 |
+
enemy.classList.add('dying');
|
| 383 |
+
score += 100;
|
| 384 |
+
enemiesDefeated++;
|
| 385 |
+
updateScore();
|
| 386 |
+
updateEnemiesLeft();
|
| 387 |
+
|
| 388 |
+
setTimeout(() => {
|
| 389 |
+
if (enemiesDefeated >= totalEnemies) {
|
| 390 |
+
victory();
|
| 391 |
+
} else {
|
| 392 |
+
spawnNewEnemy();
|
| 393 |
+
}
|
| 394 |
+
}, 1000);
|
| 395 |
+
}
|
| 396 |
+
|
| 397 |
+
function spawnNewEnemy() {
|
| 398 |
+
enemyX = 600 + Math.random() * 100;
|
| 399 |
+
currentEnemyHP = 100;
|
| 400 |
+
enemyHealth.style.width = '100%';
|
| 401 |
+
enemy.classList.remove('dying');
|
| 402 |
+
updatePositions();
|
| 403 |
+
startEnemyAI();
|
| 404 |
+
}
|
| 405 |
+
|
| 406 |
+
// Jump
|
| 407 |
+
jumpBtn.addEventListener('click', jump);
|
| 408 |
+
|
| 409 |
+
function jump() {
|
| 410 |
+
if (!gameActive || isJumping) return;
|
| 411 |
+
|
| 412 |
+
isJumping = true;
|
| 413 |
+
player.classList.add('jumping');
|
| 414 |
+
|
| 415 |
+
setTimeout(() => {
|
| 416 |
+
player.classList.remove('jumping');
|
| 417 |
+
isJumping = false;
|
| 418 |
+
}, 800);
|
| 419 |
+
}
|
| 420 |
+
|
| 421 |
+
// Enemy AI
|
| 422 |
+
function startEnemyAI() {
|
| 423 |
+
// Enemy movement
|
| 424 |
+
enemyMovingInterval = setInterval(() => {
|
| 425 |
+
if (!gameActive) return;
|
| 426 |
+
|
| 427 |
+
const distance = playerX - enemyX;
|
| 428 |
+
|
| 429 |
+
if (Math.abs(distance) > 150) {
|
| 430 |
+
// Move toward player
|
| 431 |
+
enemyX += distance > 0 ? 5 : -5;
|
| 432 |
+
updatePositions();
|
| 433 |
+
}
|
| 434 |
+
}, 100);
|
| 435 |
+
|
| 436 |
+
// Enemy attacks
|
| 437 |
+
enemyAttackingInterval = setInterval(() => {
|
| 438 |
+
if (!gameActive || isJumping) return;
|
| 439 |
+
|
| 440 |
+
const distance = Math.abs(playerX - enemyX);
|
| 441 |
+
if (distance < 120) {
|
| 442 |
+
enemyAttack();
|
| 443 |
+
}
|
| 444 |
+
}, 1500 + Math.random() * 2000);
|
| 445 |
+
}
|
| 446 |
+
|
| 447 |
+
function enemyAttack() {
|
| 448 |
+
if (!gameActive) return;
|
| 449 |
+
|
| 450 |
+
// Simple attack - just damage player if close
|
| 451 |
+
const distance = Math.abs(playerX - enemyX);
|
| 452 |
+
if (distance < 120 && !isJumping) {
|
| 453 |
+
const damage = Math.floor(Math.random() * 15) + 5;
|
| 454 |
+
playerHP = Math.max(0, playerHP - damage);
|
| 455 |
+
updateHealthBars();
|
| 456 |
+
|
| 457 |
+
if (playerHP <= 0) {
|
| 458 |
+
gameOver();
|
| 459 |
+
}
|
| 460 |
+
}
|
| 461 |
+
}
|
| 462 |
+
|
| 463 |
+
function checkPlayerPosition() {
|
| 464 |
+
const distance = Math.abs(playerX - enemyX);
|
| 465 |
+
if (distance < 80 && !isJumping) {
|
| 466 |
+
// Player too close - push back
|
| 467 |
+
playerX = playerX < enemyX ? enemyX - 80 : enemyX + 80;
|
| 468 |
+
updatePositions();
|
| 469 |
+
|
| 470 |
+
// Also take damage
|
| 471 |
+
const damage = Math.floor(Math.random() * 10) + 5;
|
| 472 |
+
playerHP = Math.max(0, playerHP - damage);
|
| 473 |
+
updateHealthBars();
|
| 474 |
+
|
| 475 |
+
if (playerHP <= 0) {
|
| 476 |
+
gameOver();
|
| 477 |
+
}
|
| 478 |
+
}
|
| 479 |
+
}
|
| 480 |
+
|
| 481 |
+
// Game over
|
| 482 |
+
function gameOver() {
|
| 483 |
+
gameActive = false;
|
| 484 |
+
clearInterval(enemyMovingInterval);
|
| 485 |
+
clearInterval(enemyAttackingInterval);
|
| 486 |
+
|
| 487 |
+
finalScoreElement.textContent = score;
|
| 488 |
+
gameOverScreen.classList.remove('hidden');
|
| 489 |
+
}
|
| 490 |
+
|
| 491 |
+
// Victory
|
| 492 |
+
function victory() {
|
| 493 |
+
gameActive = false;
|
| 494 |
+
clearInterval(enemyMovingInterval);
|
| 495 |
+
clearInterval(enemyAttackingInterval);
|
| 496 |
+
|
| 497 |
+
victoryScoreElement.textContent = score;
|
| 498 |
+
victoryScreen.classList.remove('hidden');
|
| 499 |
+
}
|
| 500 |
+
|
| 501 |
+
// Restart game
|
| 502 |
+
restartBtn.addEventListener('click', initGame);
|
| 503 |
+
|
| 504 |
+
// Next level (just restart for now)
|
| 505 |
+
nextLevelBtn.addEventListener('click', () => {
|
| 506 |
+
score += 500; // Bonus for completing level
|
| 507 |
+
initGame();
|
| 508 |
+
});
|
| 509 |
+
});
|
| 510 |
+
</script>
|
| 511 |
+
<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=Fdgg55/shadow-fighter" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
| 512 |
+
</html>
|
prompts.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
Create a sohail shadow fighter with all animations and enimies with human like figures swords and other things like real shadow fighter game
|