keisetsu commited on
Commit
fd1925a
·
verified ·
1 Parent(s): af88eed

Add 2 files

Browse files
Files changed (2) hide show
  1. README.md +7 -5
  2. index.html +473 -19
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Mario Respect Bug Game
3
- emoji: 🏢
4
- colorFrom: yellow
5
- colorTo: red
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: mario-respect-bug-game
3
+ emoji: 🐳
4
+ colorFrom: blue
5
+ colorTo: blue
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite
10
  ---
11
 
12
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
index.html CHANGED
@@ -1,19 +1,473 @@
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>Mario Tribute Game</title>
7
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
8
+ <style>
9
+ @import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');
10
+
11
+ * {
12
+ margin: 0;
13
+ padding: 0;
14
+ box-sizing: border-box;
15
+ }
16
+
17
+ body {
18
+ font-family: 'Press Start 2P', cursive;
19
+ background-color: #5b8ee5;
20
+ overflow: hidden;
21
+ height: 100vh;
22
+ display: flex;
23
+ flex-direction: column;
24
+ align-items: center;
25
+ justify-content: center;
26
+ color: white;
27
+ }
28
+
29
+ #game-container {
30
+ position: relative;
31
+ width: 800px;
32
+ height: 400px;
33
+ background: linear-gradient(to bottom, #5b8ee5 0%, #5b8ee5 60%, #3a6b1a 60%, #3a6b1a 100%);
34
+ border: 8px solid #d35400;
35
+ border-radius: 5px;
36
+ box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
37
+ overflow: hidden;
38
+ }
39
+
40
+ #ground {
41
+ position: absolute;
42
+ bottom: 0;
43
+ width: 100%;
44
+ height: 30px;
45
+ background: linear-gradient(to bottom, #8b4513, #a0522d);
46
+ }
47
+
48
+ #player {
49
+ position: absolute;
50
+ width: 40px;
51
+ height: 60px;
52
+ background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 60"><rect x="12" y="10" width="6" height="6" fill="%23ffffff"/><rect x="22" y="10" width="6" height="6" fill="%23ffffff"/><rect x="8" y="16" width="24" height="30" fill="%23e52521"/><rect x="12" y="18" width="4" height="4" fill="%23ffffff"/><rect x="24" y="18" width="4" height="4" fill="%23ffffff"/><rect x="10" y="46" width="8" height="8" fill="%23333333"/><rect x="22" y="46" width="8" height="8" fill="%23333333"/></svg>');
53
+ bottom: 30px;
54
+ left: 50px;
55
+ transition: transform 0.1s;
56
+ z-index: 10;
57
+ }
58
+
59
+ .coin {
60
+ position: absolute;
61
+ width: 20px;
62
+ height: 20px;
63
+ background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><circle cx="10" cy="10" r="8" fill="%23f1c40f" stroke="%23f39c12" stroke-width="2"/><circle cx="10" cy="10" r="4" fill="%23f39c12"/></svg>');
64
+ z-index: 5;
65
+ }
66
+
67
+ .enemy {
68
+ position: absolute;
69
+ width: 40px;
70
+ height: 30px;
71
+ background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 30"><rect x="5" y="5" width="30" height="20" rx="10" fill="%23e74c3c"/><circle cx="15" cy="13" r="3" fill="%23333"/><circle cx="25" cy="13" r="3" fill="%23333"/><path d="M10,20 Q20,25 30,20" stroke="%23333" fill="none" stroke-width="2"/></svg>');
72
+ bottom: 30px;
73
+ z-index: 5;
74
+ }
75
+
76
+ #score-board {
77
+ position: absolute;
78
+ top: 20px;
79
+ left: 20px;
80
+ background: rgba(0, 0, 0, 0.5);
81
+ padding: 10px 15px;
82
+ border-radius: 5px;
83
+ display: flex;
84
+ align-items: center;
85
+ gap: 10px;
86
+ }
87
+
88
+ #game-over {
89
+ position: absolute;
90
+ top: 0;
91
+ left: 0;
92
+ width: 100%;
93
+ height: 100%;
94
+ background: rgba(0, 0, 0, 0.8);
95
+ display: none;
96
+ flex-direction: column;
97
+ justify-content: center;
98
+ align-items: center;
99
+ z-index: 20;
100
+ }
101
+
102
+ #start-screen {
103
+ position: absolute;
104
+ top: 0;
105
+ left: 0;
106
+ width: 100%;
107
+ height: 100%;
108
+ background: rgba(0, 0, 0, 0.8);
109
+ display: flex;
110
+ flex-direction: column;
111
+ justify-content: center;
112
+ align-items: center;
113
+ z-index: 20;
114
+ }
115
+
116
+ button {
117
+ font-family: 'Press Start 2P', cursive;
118
+ background: #e74c3c;
119
+ color: white;
120
+ border: none;
121
+ padding: 15px 25px;
122
+ margin-top: 20px;
123
+ cursor: pointer;
124
+ border-radius: 5px;
125
+ transition: all 0.3s;
126
+ }
127
+
128
+ button:hover {
129
+ background: #c0392b;
130
+ transform: scale(1.05);
131
+ }
132
+
133
+ h1 {
134
+ color: #f1c40f;
135
+ text-shadow: 5px 5px 0 #e74c3c;
136
+ font-size: 36px;
137
+ margin-bottom: 20px;
138
+ animation: bounce 0.5s infinite alternate;
139
+ }
140
+
141
+ @keyframes bounce {
142
+ from { transform: translateY(0); }
143
+ to { transform: translateY(-10px); }
144
+ }
145
+
146
+ .cloud {
147
+ position: absolute;
148
+ width: 100px;
149
+ height: 60px;
150
+ background: white;
151
+ border-radius: 50px;
152
+ opacity: 0.8;
153
+ }
154
+
155
+ .cloud:before, .cloud:after {
156
+ content: '';
157
+ position: absolute;
158
+ background: white;
159
+ border-radius: 50%;
160
+ }
161
+
162
+ .cloud:before {
163
+ width: 50px;
164
+ height: 50px;
165
+ top: -20px;
166
+ left: 20px;
167
+ }
168
+
169
+ .cloud:after {
170
+ width: 30px;
171
+ height: 30px;
172
+ top: -10px;
173
+ right: 20px;
174
+ }
175
+
176
+ #controls {
177
+ margin-top: 20px;
178
+ text-align: center;
179
+ color: #f1c40f;
180
+ font-size: 14px;
181
+ }
182
+
183
+ #lives {
184
+ display: flex;
185
+ gap: 5px;
186
+ margin-left: 20px;
187
+ }
188
+
189
+ .life {
190
+ width: 20px;
191
+ height: 20px;
192
+ background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path fill="%23e74c3c" d="M10,3 C12,0 16,1 17,5 C18,9 13,13 10,16 C7,13 2,9 3,5 C4,1 8,0 10,3 Z"/></svg>');
193
+ }
194
+ </style>
195
+ </head>
196
+ <body>
197
+ <h1>Mario Tribute</h1>
198
+
199
+ <div id="game-container">
200
+ <div id="ground"></div>
201
+ <div id="player"></div>
202
+
203
+ <div id="score-board">
204
+ <i class="fas fa-coins" style="color: gold;"></i>
205
+ <span id="score">0</span>
206
+ <div id="lives">
207
+ <div class="life"></div>
208
+ <div class="life"></div>
209
+ <div class="life"></div>
210
+ </div>
211
+ </div>
212
+
213
+ <div id="start-screen">
214
+ <h2>Collect Coins!</h2>
215
+ <p>Avoid the enemies!</p>
216
+ <button id="start-btn">START GAME</button>
217
+ <div id="controls">
218
+ <p><i class="fas fa-arrow-left"></i> <i class="fas fa-arrow-right"></i> - Move</p>
219
+ <p><i class="fas fa-arrow-up"></i> - Jump</p>
220
+ </div>
221
+ </div>
222
+
223
+ <div id="game-over">
224
+ <h2>GAME OVER!</h2>
225
+ <p>Final Score: <span id="final-score">0</span></p>
226
+ <button id="restart-btn">PLAY AGAIN</button>
227
+ </div>
228
+ </div>
229
+
230
+ <script>
231
+ const player = document.getElementById('player');
232
+ const gameContainer = document.getElementById('game-container');
233
+ const startScreen = document.getElementById('start-screen');
234
+ const gameOverScreen = document.getElementById('game-over');
235
+ const scoreDisplay = document.getElementById('score');
236
+ const finalScoreDisplay = document.getElementById('final-score');
237
+ const startBtn = document.getElementById('start-btn');
238
+ const restartBtn = document.getElementById('restart-btn');
239
+ const livesContainer = document.getElementById('lives');
240
+
241
+ let score = 0;
242
+ let lives = 3;
243
+ let gameRunning = false;
244
+ let playerX = 50;
245
+ let playerY = 0;
246
+ let playerVelocityY = 0;
247
+ let playerJumping = false;
248
+ let gravity = 0.6; // 重力を調整
249
+ let keys = {};
250
+ let coins = [];
251
+ let enemies = [];
252
+ let clouds = [];
253
+ let gameSpeed = 2;
254
+ let spawnRate = 100;
255
+ let animationId;
256
+
257
+ // Keyboard controls
258
+ document.addEventListener('keydown', (e) => {
259
+ keys[e.key] = true;
260
+
261
+ // スペースキーでもジャンプできるように
262
+ if ((e.key === 'ArrowUp' || e.key === ' ' || e.key === 'w') && !playerJumping && gameRunning) {
263
+ playerJumping = true;
264
+ playerVelocityY = -15; // ジャンプ力を強く
265
+ }
266
+ });
267
+
268
+ document.addEventListener('keyup', (e) => {
269
+ keys[e.key] = false;
270
+ });
271
+
272
+ // Start game
273
+ startBtn.addEventListener('click', startGame);
274
+ restartBtn.addEventListener('click', startGame);
275
+
276
+ function startGame() {
277
+ score = 0;
278
+ lives = 3;
279
+ playerX = 50;
280
+ playerY = 0;
281
+ playerVelocityY = 0;
282
+ playerJumping = false;
283
+ scoreDisplay.textContent = score;
284
+ updateLives();
285
+
286
+ // Clear existing elements
287
+ coins.forEach(coin => coin.remove());
288
+ enemies.forEach(enemy => enemy.remove());
289
+ coins = [];
290
+ enemies = [];
291
+
292
+ // Hide screens
293
+ startScreen.style.display = 'none';
294
+ gameOverScreen.style.display = 'none';
295
+
296
+ // Initialize clouds
297
+ createClouds();
298
+
299
+ gameRunning = true;
300
+ gameLoop();
301
+ }
302
+
303
+ function createClouds() {
304
+ // Clear existing clouds
305
+ clouds.forEach(cloud => cloud.remove());
306
+ clouds = [];
307
+
308
+ // Create new clouds
309
+ for (let i = 0; i < 5; i++) {
310
+ const cloud = document.createElement('div');
311
+ cloud.className = 'cloud';
312
+ cloud.style.left = `${Math.random() * 700}px`;
313
+ cloud.style.top = `${50 + Math.random() * 100}px`;
314
+ gameContainer.appendChild(cloud);
315
+ clouds.push(cloud);
316
+ }
317
+ }
318
+
319
+ function updateLives() {
320
+ livesContainer.innerHTML = '';
321
+ for (let i = 0; i < lives; i++) {
322
+ const life = document.createElement('div');
323
+ life.className = 'life';
324
+ livesContainer.appendChild(life);
325
+ }
326
+ }
327
+
328
+ function gameLoop() {
329
+ if (!gameRunning) return;
330
+
331
+ // Move player
332
+ if (keys['ArrowLeft'] || keys['a'] && playerX > 0) {
333
+ playerX -= 5;
334
+ player.style.transform = 'scaleX(-1)';
335
+ }
336
+ if (keys['ArrowRight'] || keys['d'] && playerX < 760) {
337
+ playerX += 5;
338
+ player.style.transform = 'scaleX(1)';
339
+ }
340
+
341
+ // Apply gravity
342
+ playerVelocityY += gravity;
343
+ playerY += playerVelocityY;
344
+
345
+ // Ground collision
346
+ if (playerY > 0) {
347
+ playerY = 0;
348
+ playerVelocityY = 0;
349
+ playerJumping = false;
350
+ }
351
+
352
+ // Update player position
353
+ player.style.left = `${playerX}px`;
354
+ player.style.bottom = `${30 + playerY}px`;
355
+
356
+ // Spawn coins and enemies randomly
357
+ if (Math.random() * spawnRate < 1) {
358
+ spawnCoin();
359
+ }
360
+
361
+ if (Math.random() * (spawnRate * 2) < 1) {
362
+ spawnEnemy();
363
+ }
364
+
365
+ // Move coins
366
+ coins.forEach((coin, index) => {
367
+ const coinLeft = parseInt(coin.style.left);
368
+ coin.style.left = `${coinLeft - gameSpeed}px`;
369
+
370
+ // Remove coin if out of screen
371
+ if (coinLeft < -20) {
372
+ coin.remove();
373
+ coins.splice(index, 1);
374
+ }
375
+
376
+ // Check collision with player
377
+ if (checkCollision(player, coin)) {
378
+ score += 10;
379
+ scoreDisplay.textContent = score;
380
+ coin.remove();
381
+ coins.splice(index, 1);
382
+
383
+ // Increase difficulty
384
+ if (score % 50 === 0) {
385
+ gameSpeed += 0.5;
386
+ spawnRate = Math.max(50, spawnRate - 5);
387
+ }
388
+ }
389
+ });
390
+
391
+ // Move enemies
392
+ enemies.forEach((enemy, index) => {
393
+ const enemyLeft = parseInt(enemy.style.left);
394
+ enemy.style.left = `${enemyLeft - gameSpeed * 1.5}px`;
395
+
396
+ // Remove enemy if out of screen
397
+ if (enemyLeft < -40) {
398
+ enemy.remove();
399
+ enemies.splice(index, 1);
400
+ }
401
+
402
+ // Check collision with player
403
+ if (checkCollision(player, enemy)) {
404
+ lives--;
405
+ updateLives();
406
+
407
+ if (lives <= 0) {
408
+ gameOver();
409
+ } else {
410
+ // Knockback effect
411
+ const knockbackDirection = playerX < enemyLeft ? -20 : 20;
412
+ playerX += knockbackDirection;
413
+ playerVelocityY = -8; // ノックバックのジャンプ力を調整
414
+ playerJumping = true;
415
+
416
+ enemy.remove();
417
+ enemies.splice(index, 1);
418
+ }
419
+ }
420
+ });
421
+
422
+ // Move clouds
423
+ clouds.forEach(cloud => {
424
+ const cloudLeft = parseInt(cloud.style.left);
425
+ cloud.style.left = `${cloudLeft - gameSpeed * 0.5}px`;
426
+
427
+ // Reset cloud position when out of screen
428
+ if (cloudLeft < -100) {
429
+ cloud.style.left = '800px';
430
+ cloud.style.top = `${50 + Math.random() * 100}px`;
431
+ }
432
+ });
433
+
434
+ animationId = requestAnimationFrame(gameLoop);
435
+ }
436
+
437
+ function spawnCoin() {
438
+ const coin = document.createElement('div');
439
+ coin.className = 'coin';
440
+ coin.style.left = '800px';
441
+ coin.style.bottom = `${60 + Math.random() * 200}px`;
442
+ gameContainer.appendChild(coin);
443
+ coins.push(coin);
444
+ }
445
+
446
+ function spawnEnemy() {
447
+ const enemy = document.createElement('div');
448
+ enemy.className = 'enemy';
449
+ enemy.style.left = '800px';
450
+ enemy.style.bottom = '30px';
451
+ gameContainer.appendChild(enemy);
452
+ enemies.push(enemy);
453
+ }
454
+
455
+ function checkCollision(element1, element2) {
456
+ const rect1 = element1.getBoundingClientRect();
457
+ const rect2 = element2.getBoundingClientRect();
458
+
459
+ return rect1.left < rect2.right &&
460
+ rect1.right > rect2.left &&
461
+ rect1.top < rect2.bottom &&
462
+ rect1.bottom > rect2.top;
463
+ }
464
+
465
+ function gameOver() {
466
+ gameRunning = false;
467
+ cancelAnimationFrame(animationId);
468
+ finalScoreDisplay.textContent = score;
469
+ gameOverScreen.style.display = 'flex';
470
+ }
471
+ </script>
472
+ <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: absolute; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">This website has been generated by <a href="https://enzostvs-deepsite.hf.space" style="color: #fff;" target="_blank" >DeepSite</a> <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;"></p></body>
473
+ </html>