Add 2 files
Browse files- README.md +7 -5
- index.html +315 -19
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: nam
|
| 3 |
+
emoji: 🐳
|
| 4 |
+
colorFrom: gray
|
| 5 |
+
colorTo: red
|
| 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,315 @@
|
|
| 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>Pixel Flapper</title>
|
| 7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
+
<style>
|
| 9 |
+
@font-face {
|
| 10 |
+
font-family: 'Press Start 2P';
|
| 11 |
+
src: url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');
|
| 12 |
+
}
|
| 13 |
+
|
| 14 |
+
body {
|
| 15 |
+
margin: 0;
|
| 16 |
+
padding: 0;
|
| 17 |
+
overflow: hidden;
|
| 18 |
+
font-family: 'Press Start 2P', cursive;
|
| 19 |
+
background-color: #87CEEB;
|
| 20 |
+
touch-action: manipulation;
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
#gameCanvas {
|
| 24 |
+
display: block;
|
| 25 |
+
background-color: #87CEEB;
|
| 26 |
+
image-rendering: pixelated;
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
.pixel-border {
|
| 30 |
+
border: 4px solid #1E90FF;
|
| 31 |
+
box-shadow: 8px 8px 0 rgba(0, 0, 139, 0.3);
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
.pixel-button {
|
| 35 |
+
background-color: #1E90FF;
|
| 36 |
+
color: white;
|
| 37 |
+
border: none;
|
| 38 |
+
padding: 12px 24px;
|
| 39 |
+
font-family: 'Press Start 2P', cursive;
|
| 40 |
+
font-size: 16px;
|
| 41 |
+
cursor: pointer;
|
| 42 |
+
box-shadow: 4px 4px 0 rgba(0, 0, 139, 0.3);
|
| 43 |
+
transition: all 0.1s;
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
.pixel-button:hover {
|
| 47 |
+
transform: translate(2px, 2px);
|
| 48 |
+
box-shadow: 2px 2px 0 rgba(0, 0, 139, 0.3);
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
.pixel-button:active {
|
| 52 |
+
transform: translate(4px, 4px);
|
| 53 |
+
box-shadow: none;
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
.pixel-text {
|
| 57 |
+
color: #1E3A8A;
|
| 58 |
+
text-shadow: 2px 2px 0 rgba(255, 255, 255, 0.5);
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
.game-container {
|
| 62 |
+
position: relative;
|
| 63 |
+
width: 100vw;
|
| 64 |
+
height: 100vh;
|
| 65 |
+
display: flex;
|
| 66 |
+
justify-content: center;
|
| 67 |
+
align-items: center;
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
.modal {
|
| 71 |
+
position: absolute;
|
| 72 |
+
background-color: rgba(255, 255, 255, 0.9);
|
| 73 |
+
padding: 30px;
|
| 74 |
+
border-radius: 8px;
|
| 75 |
+
text-align: center;
|
| 76 |
+
z-index: 10;
|
| 77 |
+
display: none;
|
| 78 |
+
}
|
| 79 |
+
|
| 80 |
+
/* Smoother animation */
|
| 81 |
+
canvas {
|
| 82 |
+
will-change: transform;
|
| 83 |
+
}
|
| 84 |
+
</style>
|
| 85 |
+
</head>
|
| 86 |
+
<body class="bg-blue-100">
|
| 87 |
+
<div class="game-container">
|
| 88 |
+
<canvas id="gameCanvas" class="pixel-border"></canvas>
|
| 89 |
+
|
| 90 |
+
<div id="startModal" class="modal pixel-border">
|
| 91 |
+
<h1 class="text-3xl mb-6 pixel-text">PIXEL FLAPPER</h1>
|
| 92 |
+
<p class="mb-6 text-blue-800">Press SPACE or TAP to flap!</p>
|
| 93 |
+
<button id="startButton" class="pixel-button">START GAME</button>
|
| 94 |
+
</div>
|
| 95 |
+
|
| 96 |
+
<div id="gameOverModal" class="modal pixel-border" style="display: none;">
|
| 97 |
+
<h1 class="text-3xl mb-4 text-red-600">GAME OVER</h1>
|
| 98 |
+
<p id="scoreText" class="text-xl mb-6 pixel-text">Score: 0</p>
|
| 99 |
+
<p id="highScoreText" class="text-lg mb-6 pixel-text">High Score: 0</p>
|
| 100 |
+
<button id="restartButton" class="pixel-button">PLAY AGAIN</button>
|
| 101 |
+
</div>
|
| 102 |
+
</div>
|
| 103 |
+
|
| 104 |
+
<script>
|
| 105 |
+
// Game variables
|
| 106 |
+
const canvas = document.getElementById('gameCanvas');
|
| 107 |
+
const ctx = canvas.getContext('2d');
|
| 108 |
+
const startModal = document.getElementById('startModal');
|
| 109 |
+
const gameOverModal = document.getElementById('gameOverModal');
|
| 110 |
+
const startButton = document.getElementById('startButton');
|
| 111 |
+
const restartButton = document.getElementById('restartButton');
|
| 112 |
+
const scoreText = document.getElementById('scoreText');
|
| 113 |
+
const highScoreText = document.getElementById('highScoreText');
|
| 114 |
+
|
| 115 |
+
// Set canvas size (slightly smaller for better mobile play)
|
| 116 |
+
canvas.width = 360;
|
| 117 |
+
canvas.height = 540;
|
| 118 |
+
|
| 119 |
+
// Game state
|
| 120 |
+
let gameRunning = false;
|
| 121 |
+
let score = 0;
|
| 122 |
+
let highScore = localStorage.getItem('pixelFlapperHighScore') || 0;
|
| 123 |
+
let frames = 0;
|
| 124 |
+
let lastFrameTime = 0;
|
| 125 |
+
let gameSpeed = 1;
|
| 126 |
+
|
| 127 |
+
// Bird properties (made slightly larger and more responsive)
|
| 128 |
+
const bird = {
|
| 129 |
+
x: 80,
|
| 130 |
+
y: canvas.height / 2,
|
| 131 |
+
width: 36,
|
| 132 |
+
height: 36,
|
| 133 |
+
velocity: 0,
|
| 134 |
+
gravity: 0.4, // Reduced gravity for easier control
|
| 135 |
+
jumpForce: -9, // Slightly reduced jump force for smoother jumps
|
| 136 |
+
color: '#FFD700'
|
| 137 |
+
};
|
| 138 |
+
|
| 139 |
+
// Pipes (wider gap and slower initial speed)
|
| 140 |
+
let pipes = [];
|
| 141 |
+
const pipeWidth = 60;
|
| 142 |
+
const pipeGap = 180; // Increased gap for easier play
|
| 143 |
+
const pipeSpeed = 2.5; // Slower initial speed
|
| 144 |
+
let pipeFrequency = 100; // frames
|
| 145 |
+
|
| 146 |
+
// Game functions
|
| 147 |
+
function startGame() {
|
| 148 |
+
gameRunning = true;
|
| 149 |
+
score = 0;
|
| 150 |
+
bird.y = canvas.height / 2;
|
| 151 |
+
bird.velocity = 0;
|
| 152 |
+
pipes = [];
|
| 153 |
+
frames = 0;
|
| 154 |
+
gameSpeed = 1;
|
| 155 |
+
startModal.style.display = 'none';
|
| 156 |
+
gameOverModal.style.display = 'none';
|
| 157 |
+
lastFrameTime = performance.now();
|
| 158 |
+
requestAnimationFrame(animate);
|
| 159 |
+
}
|
| 160 |
+
|
| 161 |
+
function endGame() {
|
| 162 |
+
gameRunning = false;
|
| 163 |
+
if (score > highScore) {
|
| 164 |
+
highScore = score;
|
| 165 |
+
localStorage.setItem('pixelFlapperHighScore', highScore);
|
| 166 |
+
}
|
| 167 |
+
scoreText.textContent = `Score: ${score}`;
|
| 168 |
+
highScoreText.textContent = `High Score: ${highScore}`;
|
| 169 |
+
gameOverModal.style.display = 'block';
|
| 170 |
+
}
|
| 171 |
+
|
| 172 |
+
function animate(currentTime) {
|
| 173 |
+
if (!gameRunning) return;
|
| 174 |
+
|
| 175 |
+
// Calculate delta time for smooth animation
|
| 176 |
+
const deltaTime = currentTime - lastFrameTime;
|
| 177 |
+
lastFrameTime = currentTime;
|
| 178 |
+
|
| 179 |
+
// Clear canvas
|
| 180 |
+
ctx.fillStyle = '#87CEEB';
|
| 181 |
+
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
| 182 |
+
|
| 183 |
+
// Update bird with delta time
|
| 184 |
+
bird.velocity += bird.gravity * (deltaTime / 16);
|
| 185 |
+
bird.y += bird.velocity * (deltaTime / 16);
|
| 186 |
+
|
| 187 |
+
// Check if bird hits the ground or ceiling
|
| 188 |
+
if (bird.y + bird.height > canvas.height || bird.y < 0) {
|
| 189 |
+
endGame();
|
| 190 |
+
}
|
| 191 |
+
|
| 192 |
+
// Generate pipes
|
| 193 |
+
if (frames % pipeFrequency === 0) {
|
| 194 |
+
const gapPosition = Math.random() * (canvas.height - pipeGap - 120) + 60;
|
| 195 |
+
pipes.push({
|
| 196 |
+
x: canvas.width,
|
| 197 |
+
gapPosition: gapPosition,
|
| 198 |
+
passed: false
|
| 199 |
+
});
|
| 200 |
+
|
| 201 |
+
// Gradually increase difficulty
|
| 202 |
+
if (pipeFrequency > 70) {
|
| 203 |
+
pipeFrequency -= 1;
|
| 204 |
+
}
|
| 205 |
+
gameSpeed += 0.005;
|
| 206 |
+
}
|
| 207 |
+
|
| 208 |
+
// Update and draw pipes
|
| 209 |
+
for (let i = pipes.length - 1; i >= 0; i--) {
|
| 210 |
+
pipes[i].x -= pipeSpeed * gameSpeed;
|
| 211 |
+
|
| 212 |
+
// Check for collision (with more forgiving hitbox)
|
| 213 |
+
if (
|
| 214 |
+
bird.x + bird.width - 5 > pipes[i].x + 5 &&
|
| 215 |
+
bird.x + 5 < pipes[i].x + pipeWidth - 5 &&
|
| 216 |
+
(bird.y + 5 < pipes[i].gapPosition ||
|
| 217 |
+
bird.y + bird.height - 5 > pipes[i].gapPosition + pipeGap)
|
| 218 |
+
) {
|
| 219 |
+
endGame();
|
| 220 |
+
}
|
| 221 |
+
|
| 222 |
+
// Check if bird passed the pipe
|
| 223 |
+
if (!pipes[i].passed && bird.x > pipes[i].x + pipeWidth) {
|
| 224 |
+
pipes[i].passed = true;
|
| 225 |
+
score++;
|
| 226 |
+
}
|
| 227 |
+
|
| 228 |
+
// Remove pipes that are off screen
|
| 229 |
+
if (pipes[i].x + pipeWidth < 0) {
|
| 230 |
+
pipes.splice(i, 1);
|
| 231 |
+
}
|
| 232 |
+
|
| 233 |
+
// Draw pipes
|
| 234 |
+
ctx.fillStyle = '#1E90FF';
|
| 235 |
+
ctx.fillRect(pipes[i].x, 0, pipeWidth, pipes[i].gapPosition);
|
| 236 |
+
ctx.fillRect(pipes[i].x, pipes[i].gapPosition + pipeGap, pipeWidth, canvas.height - pipes[i].gapPosition - pipeGap);
|
| 237 |
+
|
| 238 |
+
// Pipe borders
|
| 239 |
+
ctx.fillStyle = '#1E3A8A';
|
| 240 |
+
ctx.fillRect(pipes[i].x - 2, 0, 2, pipes[i].gapPosition);
|
| 241 |
+
ctx.fillRect(pipes[i].x - 2, pipes[i].gapPosition + pipeGap, 2, canvas.height - pipes[i].gapPosition - pipeGap);
|
| 242 |
+
ctx.fillRect(pipes[i].x + pipeWidth, 0, 2, pipes[i].gapPosition);
|
| 243 |
+
ctx.fillRect(pipes[i].x + pipeWidth, pipes[i].gapPosition + pipeGap, 2, canvas.height - pipes[i].gapPosition - pipeGap);
|
| 244 |
+
}
|
| 245 |
+
|
| 246 |
+
// Draw bird
|
| 247 |
+
ctx.fillStyle = bird.color;
|
| 248 |
+
ctx.fillRect(bird.x, bird.y, bird.width, bird.height);
|
| 249 |
+
|
| 250 |
+
// Bird eyes
|
| 251 |
+
ctx.fillStyle = '#1E3A8A';
|
| 252 |
+
ctx.fillRect(bird.x + 24, bird.y + 10, 8, 8);
|
| 253 |
+
|
| 254 |
+
// Bird beak
|
| 255 |
+
ctx.fillStyle = '#FF6347';
|
| 256 |
+
ctx.fillRect(bird.x + 36, bird.y + 14, 12, 8);
|
| 257 |
+
|
| 258 |
+
// Draw score
|
| 259 |
+
ctx.fillStyle = '#1E3A8A';
|
| 260 |
+
ctx.font = '24px "Press Start 2P", cursive';
|
| 261 |
+
ctx.textAlign = 'center';
|
| 262 |
+
ctx.fillText(score, canvas.width / 2, 50);
|
| 263 |
+
|
| 264 |
+
frames++;
|
| 265 |
+
requestAnimationFrame(animate);
|
| 266 |
+
}
|
| 267 |
+
|
| 268 |
+
function flap() {
|
| 269 |
+
if (!gameRunning && startModal.style.display === 'none' && gameOverModal.style.display === 'none') {
|
| 270 |
+
startGame();
|
| 271 |
+
}
|
| 272 |
+
bird.velocity = bird.jumpForce;
|
| 273 |
+
}
|
| 274 |
+
|
| 275 |
+
// Event listeners (optimized for responsiveness)
|
| 276 |
+
startButton.addEventListener('click', startGame);
|
| 277 |
+
restartButton.addEventListener('click', startGame);
|
| 278 |
+
|
| 279 |
+
// More responsive controls
|
| 280 |
+
document.addEventListener('keydown', (e) => {
|
| 281 |
+
if (e.code === 'Space' || e.key === 'ArrowUp') {
|
| 282 |
+
e.preventDefault();
|
| 283 |
+
flap();
|
| 284 |
+
}
|
| 285 |
+
});
|
| 286 |
+
|
| 287 |
+
// Touch controls with immediate response
|
| 288 |
+
canvas.addEventListener('mousedown', flap);
|
| 289 |
+
canvas.addEventListener('touchstart', (e) => {
|
| 290 |
+
e.preventDefault();
|
| 291 |
+
flap();
|
| 292 |
+
}, { passive: false });
|
| 293 |
+
|
| 294 |
+
// Show start screen initially
|
| 295 |
+
startModal.style.display = 'block';
|
| 296 |
+
|
| 297 |
+
// Responsive canvas sizing
|
| 298 |
+
function resizeCanvas() {
|
| 299 |
+
const scale = Math.min(
|
| 300 |
+
window.innerWidth / canvas.width,
|
| 301 |
+
window.innerHeight / canvas.height
|
| 302 |
+
) * 0.9; // Slightly smaller to ensure full visibility
|
| 303 |
+
|
| 304 |
+
canvas.style.width = `${canvas.width * scale}px`;
|
| 305 |
+
canvas.style.height = `${canvas.height * scale}px`;
|
| 306 |
+
}
|
| 307 |
+
|
| 308 |
+
window.addEventListener('resize', resizeCanvas);
|
| 309 |
+
resizeCanvas();
|
| 310 |
+
|
| 311 |
+
// Pre-warm the animation for smoother start
|
| 312 |
+
requestAnimationFrame(() => {});
|
| 313 |
+
</script>
|
| 314 |
+
<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=NamQT/nam" style="color: #fff;text-decoration: underline;" target="_blank" >🧬 Remix</a></p></body>
|
| 315 |
+
</html>
|