joegjoeh10 commited on
Commit
05f3324
·
verified ·
1 Parent(s): 5206fbe

Add 3 files

Browse files
Files changed (3) hide show
  1. README.md +7 -5
  2. index.html +345 -19
  3. prompts.txt +1 -0
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Fps
3
- emoji: 🦀
4
- colorFrom: pink
5
- colorTo: gray
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: fps
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,345 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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>FPS Bot Shooter</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <style>
9
+ body {
10
+ margin: 0;
11
+ padding: 0;
12
+ overflow: hidden;
13
+ font-family: 'Arial', sans-serif;
14
+ }
15
+ #gameContainer {
16
+ position: relative;
17
+ width: 100vw;
18
+ height: 100vh;
19
+ background-color: #1a202c;
20
+ overflow: hidden;
21
+ }
22
+ #crosshair {
23
+ position: absolute;
24
+ top: 50%;
25
+ left: 50%;
26
+ transform: translate(-50%, -50%);
27
+ width: 30px;
28
+ height: 30px;
29
+ pointer-events: none;
30
+ }
31
+ .bot {
32
+ position: absolute;
33
+ width: 50px;
34
+ height: 50px;
35
+ background-color: #e53e3e;
36
+ border-radius: 50%;
37
+ display: flex;
38
+ justify-content: center;
39
+ align-items: center;
40
+ color: white;
41
+ font-weight: bold;
42
+ transition: transform 0.1s;
43
+ }
44
+ .bullet-hole {
45
+ position: absolute;
46
+ width: 10px;
47
+ height: 10px;
48
+ background-color: black;
49
+ border-radius: 50%;
50
+ pointer-events: none;
51
+ }
52
+ #healthBar {
53
+ position: absolute;
54
+ top: 20px;
55
+ left: 20px;
56
+ width: 200px;
57
+ height: 30px;
58
+ background-color: #4a5568;
59
+ border-radius: 5px;
60
+ overflow: hidden;
61
+ }
62
+ #healthFill {
63
+ height: 100%;
64
+ width: 100%;
65
+ background-color: #48bb78;
66
+ transition: width 0.3s;
67
+ }
68
+ #scoreDisplay {
69
+ position: absolute;
70
+ top: 20px;
71
+ right: 20px;
72
+ color: white;
73
+ font-size: 24px;
74
+ font-weight: bold;
75
+ }
76
+ #ammoDisplay {
77
+ position: absolute;
78
+ bottom: 20px;
79
+ right: 20px;
80
+ color: white;
81
+ font-size: 24px;
82
+ font-weight: bold;
83
+ }
84
+ #gameOver {
85
+ position: absolute;
86
+ top: 0;
87
+ left: 0;
88
+ width: 100%;
89
+ height: 100%;
90
+ background-color: rgba(0, 0, 0, 0.8);
91
+ display: none;
92
+ flex-direction: column;
93
+ justify-content: center;
94
+ align-items: center;
95
+ color: white;
96
+ font-size: 48px;
97
+ z-index: 100;
98
+ }
99
+ #restartBtn {
100
+ margin-top: 20px;
101
+ padding: 10px 20px;
102
+ background-color: #4299e1;
103
+ color: white;
104
+ border: none;
105
+ border-radius: 5px;
106
+ font-size: 24px;
107
+ cursor: pointer;
108
+ }
109
+ #restartBtn:hover {
110
+ background-color: #3182ce;
111
+ }
112
+ #weapon {
113
+ position: absolute;
114
+ bottom: 50px;
115
+ left: 50%;
116
+ transform: translateX(-50%);
117
+ width: 150px;
118
+ height: 100px;
119
+ background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23ffffff"><path d="M20 3h-3c0-1.7-1.3-3-3-3h-4c-1.7 0-3 1.3-3 3h-3c-1.1 0-2 0.9-2 2v15c0 1.1 0.9 2 2 2h14c1.1 0 2-0.9 2-2v-15c0-1.1-0.9-2-2-2zM10 1h4c0.6 0 1 0.4 1 1h-6c0-0.6 0.4-1 1-1zM18 20h-14v-15h3v2h2v-2h4v2h2v-2h3v15z"/></svg>');
120
+ background-repeat: no-repeat;
121
+ background-position: center;
122
+ background-size: contain;
123
+ filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.5));
124
+ }
125
+ #reloadIndicator {
126
+ position: absolute;
127
+ bottom: 30px;
128
+ left: 50%;
129
+ transform: translateX(-50%);
130
+ color: white;
131
+ font-size: 18px;
132
+ display: none;
133
+ }
134
+ </style>
135
+ </head>
136
+ <body>
137
+ <div id="gameContainer">
138
+ <div id="crosshair">
139
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="white" width="30" height="30">
140
+ <path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8zm-1-13h2v6h-2zm0 8h2v2h-2z"/>
141
+ </svg>
142
+ </div>
143
+
144
+ <div id="healthBar">
145
+ <div id="healthFill"></div>
146
+ </div>
147
+
148
+ <div id="scoreDisplay">Score: 0</div>
149
+ <div id="ammoDisplay">Ammo: 10/30</div>
150
+
151
+ <div id="weapon"></div>
152
+ <div id="reloadIndicator">Reloading...</div>
153
+
154
+ <div id="gameOver">
155
+ <div>GAME OVER</div>
156
+ <div id="finalScore">Score: 0</div>
157
+ <button id="restartBtn">Play Again</button>
158
+ </div>
159
+ </div>
160
+
161
+ <script>
162
+ // Game variables
163
+ const gameContainer = document.getElementById('gameContainer');
164
+ const healthFill = document.getElementById('healthFill');
165
+ const scoreDisplay = document.getElementById('scoreDisplay');
166
+ const ammoDisplay = document.getElementById('ammoDisplay');
167
+ const gameOverScreen = document.getElementById('gameOver');
168
+ const finalScore = document.getElementById('finalScore');
169
+ const restartBtn = document.getElementById('restartBtn');
170
+ const reloadIndicator = document.getElementById('reloadIndicator');
171
+
172
+ let health = 100;
173
+ let score = 0;
174
+ let ammo = 10;
175
+ let maxAmmo = 10;
176
+ let totalAmmo = 30;
177
+ let isReloading = false;
178
+ let gameActive = true;
179
+ let bots = [];
180
+ let bulletHoles = [];
181
+ let botSpawnInterval;
182
+ let botMoveInterval;
183
+ let botAttackInterval;
184
+
185
+ // Initialize game
186
+ function initGame() {
187
+ health = 100;
188
+ score = 0;
189
+ ammo = 10;
190
+ totalAmmo = 30;
191
+ isReloading = false;
192
+ gameActive = true;
193
+
194
+ // Clear existing bots and bullet holes
195
+ bots.forEach(bot => bot.element.remove());
196
+ bots = [];
197
+ bulletHoles.forEach(hole => hole.remove());
198
+ bulletHoles = [];
199
+
200
+ // Update UI
201
+ updateHealth();
202
+ updateScore();
203
+ updateAmmo();
204
+
205
+ // Hide game over screen
206
+ gameOverScreen.style.display = 'none';
207
+
208
+ // Start bot spawning and movement
209
+ botSpawnInterval = setInterval(spawnBot, 2000);
210
+ botMoveInterval = setInterval(moveBots, 50);
211
+ botAttackInterval = setInterval(botAttack, 1000);
212
+ }
213
+
214
+ // Update health bar
215
+ function updateHealth() {
216
+ healthFill.style.width = `${health}%`;
217
+ healthFill.style.backgroundColor = health > 50 ? '#48bb78' : health > 20 ? '#ed8936' : '#e53e3e';
218
+ }
219
+
220
+ // Update score display
221
+ function updateScore() {
222
+ scoreDisplay.textContent = `Score: ${score}`;
223
+ }
224
+
225
+ // Update ammo display
226
+ function updateAmmo() {
227
+ ammoDisplay.textContent = `Ammo: ${ammo}/${totalAmmo}`;
228
+ }
229
+
230
+ // Spawn a new bot
231
+ function spawnBot() {
232
+ if (!gameActive) return;
233
+
234
+ const botElement = document.createElement('div');
235
+ botElement.className = 'bot';
236
+
237
+ // Position bot randomly around the edges
238
+ const edge = Math.floor(Math.random() * 4); // 0: top, 1: right, 2: bottom, 3: left
239
+ let x, y;
240
+
241
+ switch (edge) {
242
+ case 0: // top
243
+ x = Math.random() * window.innerWidth;
244
+ y = -50;
245
+ break;
246
+ case 1: // right
247
+ x = window.innerWidth + 50;
248
+ y = Math.random() * window.innerHeight;
249
+ break;
250
+ case 2: // bottom
251
+ x = Math.random() * window.innerWidth;
252
+ y = window.innerHeight + 50;
253
+ break;
254
+ case 3: // left
255
+ x = -50;
256
+ y = Math.random() * window.innerHeight;
257
+ break;
258
+ }
259
+
260
+ botElement.style.left = `${x}px`;
261
+ botElement.style.top = `${y}px`;
262
+
263
+ const bot = {
264
+ element: botElement,
265
+ x: x,
266
+ y: y,
267
+ health: 100,
268
+ speed: 1 + Math.random() * 2
269
+ };
270
+
271
+ gameContainer.appendChild(botElement);
272
+ bots.push(bot);
273
+ }
274
+
275
+ // Move bots towards player
276
+ function moveBots() {
277
+ if (!gameActive) return;
278
+
279
+ const centerX = window.innerWidth / 2;
280
+ const centerY = window.innerHeight / 2;
281
+
282
+ bots.forEach(bot => {
283
+ // Calculate direction to player
284
+ const dx = centerX - bot.x;
285
+ const dy = centerY - bot.y;
286
+ const distance = Math.sqrt(dx * dx + dy * dy);
287
+
288
+ // Normalize and apply speed
289
+ if (distance > 0) {
290
+ bot.x += (dx / distance) * bot.speed;
291
+ bot.y += (dy / distance) * bot.speed;
292
+ }
293
+
294
+ // Update position
295
+ bot.element.style.left = `${bot.x}px`;
296
+ bot.element.style.top = `${bot.y}px`;
297
+
298
+ // Check if bot reached player
299
+ if (distance < 50) {
300
+ health -= 10;
301
+ updateHealth();
302
+
303
+ // Remove bot
304
+ bot.element.remove();
305
+ bots.splice(bots.indexOf(bot), 1);
306
+
307
+ // Check game over
308
+ if (health <= 0) {
309
+ gameOver();
310
+ }
311
+ }
312
+ });
313
+ }
314
+
315
+ // Bots attack player
316
+ function botAttack() {
317
+ if (!gameActive) return;
318
+
319
+ bots.forEach(bot => {
320
+ // 20% chance to attack
321
+ if (Math.random() < 0.2) {
322
+ health -= 5;
323
+ updateHealth();
324
+
325
+ // Flash red when hit
326
+ gameContainer.style.backgroundColor = '#e53e3e';
327
+ setTimeout(() => {
328
+ gameContainer.style.backgroundColor = '#1a202c';
329
+ }, 100);
330
+
331
+ // Check game over
332
+ if (health <= 0) {
333
+ gameOver();
334
+ }
335
+ }
336
+ });
337
+ }
338
+
339
+ // Shoot at bots
340
+ function shoot(event) {
341
+ if (!gameActive || isReloading) return;
342
+
343
+ // Check if we have ammo
344
+
345
+ </html>
prompts.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ make a first person shooter where you play against bots