continue
Browse files- README.md +9 -5
- index.html +474 -18
README.md
CHANGED
|
@@ -1,10 +1,14 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
title: undefined
|
| 3 |
+
colorFrom: pink
|
| 4 |
+
colorTo: pink
|
| 5 |
+
emoji: 🐳
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
| 8 |
+
tags:
|
| 9 |
+
- deepsite-v3
|
| 10 |
---
|
| 11 |
|
| 12 |
+
# Welcome to your new DeepSite project!
|
| 13 |
+
This project was created with [DeepSite](https://deepsite.hf.co).
|
| 14 |
+
|
index.html
CHANGED
|
@@ -1,19 +1,475 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
</html>
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en" class="dark">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>SkyFlap Odyssey: Aerial Avian Adventure</title>
|
| 7 |
+
<link rel="icon" type="image/x-icon" href="/static/favicon.ico">
|
| 8 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 9 |
+
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
|
| 10 |
+
<script src="https://unpkg.com/feather-icons"></script>
|
| 11 |
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/phaser/3.60.0/phaser.min.js"></script>
|
| 12 |
+
<style>
|
| 13 |
+
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');
|
| 14 |
+
|
| 15 |
+
* {
|
| 16 |
+
margin: 0;
|
| 17 |
+
padding: 0;
|
| 18 |
+
box-sizing: border-box;
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
body {
|
| 22 |
+
font-family: 'Poppins', sans-serif;
|
| 23 |
+
background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #334155 100%);
|
| 24 |
+
color: #f8fafc;
|
| 25 |
+
overflow-x: hidden;
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
.game-container {
|
| 29 |
+
position: relative;
|
| 30 |
+
max-width: 1200px;
|
| 31 |
+
margin: 0 auto;
|
| 32 |
+
border-radius: 20px;
|
| 33 |
+
overflow: hidden;
|
| 34 |
+
box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
#gameCanvas {
|
| 38 |
+
display: block;
|
| 39 |
+
margin: 0 auto;
|
| 40 |
+
border: 3px solid #475569;
|
| 41 |
+
border-radius: 15px;
|
| 42 |
+
background: linear-gradient(180deg, #1e40af 0%, #3b82f6 100%);
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
.stats-overlay {
|
| 46 |
+
position: absolute;
|
| 47 |
+
top: 20px;
|
| 48 |
+
left: 20px;
|
| 49 |
+
z-index: 10;
|
| 50 |
+
background: rgba(15, 23, 42, 0.8);
|
| 51 |
+
padding: 15px;
|
| 52 |
+
border-radius: 12px;
|
| 53 |
+
backdrop-filter: blur(10px);
|
| 54 |
+
border: 1px solid rgba(255, 255, 255, 0.1);
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
.score-animation {
|
| 58 |
+
animation: scorePop 0.6s ease-out;
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
@keyframes scorePop {
|
| 62 |
+
0% { transform: scale(1); }
|
| 63 |
+
50% { transform: scale(1.3); }
|
| 64 |
+
100% { transform: scale(1); }
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
.power-up-indicator {
|
| 68 |
+
animation: pulse 2s infinite;
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
@keyframes pulse {
|
| 72 |
+
0% { opacity: 1; }
|
| 73 |
+
50% { opacity: 0.6; }
|
| 74 |
+
100% { opacity: 1; }
|
| 75 |
+
}
|
| 76 |
+
|
| 77 |
+
.menu-transition {
|
| 78 |
+
transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
.parallax-bg {
|
| 82 |
+
position: absolute;
|
| 83 |
+
width: 100%;
|
| 84 |
+
height: 100%;
|
| 85 |
+
top: 0;
|
| 86 |
+
left: 0;
|
| 87 |
+
z-index: -1;
|
| 88 |
+
}
|
| 89 |
+
|
| 90 |
+
.bg-layer-1 { animation: scrollBg 60s linear infinite; }
|
| 91 |
+
.bg-layer-2 { animation: scrollBg 40s linear infinite; }
|
| 92 |
+
.bg-layer-3 { animation: scrollBg 20s linear infinite; }
|
| 93 |
+
|
| 94 |
+
@keyframes scrollBg {
|
| 95 |
+
from { transform: translateX(0); }
|
| 96 |
+
to { transform: translateX(-100%); }
|
| 97 |
+
}
|
| 98 |
+
</style>
|
| 99 |
+
</head>
|
| 100 |
+
<body class="min-h-screen flex items-center justify-center p-4">
|
| 101 |
+
<!-- Parallax Background Elements -->
|
| 102 |
+
<div class="parallax-bg">
|
| 103 |
+
<div class="bg-layer-1 absolute inset-0 opacity-20">
|
| 104 |
+
<div class="flex">
|
| 105 |
+
<div class="w-64 h-64 bg-gradient-to-br from-blue-400 to-purple-500 rounded-full blur-3xl"></div>
|
| 106 |
+
<div class="w-48 h-48 bg-gradient-to-br from-green-400 to-blue-500 rounded-full blur-2xl ml-32"></div>
|
| 107 |
+
</div>
|
| 108 |
+
</div>
|
| 109 |
+
<div class="bg-layer-2 absolute inset-0 opacity-15">
|
| 110 |
+
<div class="flex mt-32">
|
| 111 |
+
<div class="w-32 h-32 bg-gradient-to-br from-yellow-400 to-red-500 rounded-full blur-2xl"></div>
|
| 112 |
+
<div class="w-56 h-56 bg-gradient-to-br from-pink-400 to-red-500 rounded-full blur-3xl ml-64"></div>
|
| 113 |
+
</div>
|
| 114 |
+
</div>
|
| 115 |
+
<div class="bg-layer-3 absolute inset-0 opacity-10">
|
| 116 |
+
<div class="flex mt-64">
|
| 117 |
+
<div class="w-40 h-40 bg-gradient-to-br from-purple-400 to-pink-500 rounded-full blur-2xl ml-96"></div>
|
| 118 |
+
</div>
|
| 119 |
+
</div>
|
| 120 |
+
</div>
|
| 121 |
+
|
| 122 |
+
<div class="game-container">
|
| 123 |
+
<!-- Game Stats Overlay -->
|
| 124 |
+
<div class="stats-overlay">
|
| 125 |
+
<div class="flex items-center space-x-6">
|
| 126 |
+
<div class="text-center">
|
| 127 |
+
<div class="text-sm text-gray-400">SCORE</div>
|
| 128 |
+
<div id="currentScore" class="text-2xl font-bold text-white score-animation">0</div>
|
| 129 |
+
</div>
|
| 130 |
+
<div class="text-center">
|
| 131 |
+
<div class="text-sm text-gray-400">BEST</div>
|
| 132 |
+
<div id="bestScore" class="text-xl font-semibold text-yellow-400">0</div>
|
| 133 |
+
</div>
|
| 134 |
+
<div id="powerUpDisplay" class="hidden">
|
| 135 |
+
<div class="text-center">
|
| 136 |
+
<div class="text-sm text-gray-400">POWER</div>
|
| 137 |
+
<div class="text-lg font-semibold text-green-400 power-up-indicator">ACTIVE</div>
|
| 138 |
+
</div>
|
| 139 |
+
</div>
|
| 140 |
+
</div>
|
| 141 |
+
</div>
|
| 142 |
+
|
| 143 |
+
<!-- Game Canvas -->
|
| 144 |
+
<div id="gameCanvas" class="w-full h-auto"></div>
|
| 145 |
+
|
| 146 |
+
<!-- Start Menu -->
|
| 147 |
+
<div id="startMenu" class="absolute inset-0 flex flex-col items-center justify-center bg-gradient-to-br from-black/80 to-blue-900/80 backdrop-blur-sm">
|
| 148 |
+
<div class="text-center space-y-6">
|
| 149 |
+
<h1 class="text-5xl font-bold bg-gradient-to-r from-blue-400 to-purple-500 bg-clip-text text-transparent">
|
| 150 |
+
SkyFlap Odyssey
|
| 151 |
+
</h1>
|
| 152 |
+
<p class="text-xl text-gray-300">Aerial Avian Adventure</p>
|
| 153 |
+
|
| 154 |
+
<div class="space-y-4 mt-8">
|
| 155 |
+
<button onclick="startGame()" class="w-64 bg-gradient-to-r from-blue-500 to-purple-600 hover:from-blue-600 hover:to-purple-700 text-white font-semibold py-3 px-6 rounded-xl transition-all duration-300 transform hover:scale-105">
|
| 156 |
+
<i data-feather="play" class="inline mr-2"></i>
|
| 157 |
+
Start Flight
|
| 158 |
+
</button>
|
| 159 |
+
|
| 160 |
+
<button onclick="showSettings()" class="w-64 bg-gray-700 hover:bg-gray-600 text-white font-semibold py-3 px-6 rounded-xl transition-all duration-300">
|
| 161 |
+
<i data-feather="settings" class="inline mr-2"></i>
|
| 162 |
+
Game Settings
|
| 163 |
+
</button>
|
| 164 |
+
</div>
|
| 165 |
+
|
| 166 |
+
<div class="mt-6 text-sm text-gray-400">
|
| 167 |
+
<p>Tap, Click, or Press SPACE to flap</p>
|
| 168 |
+
<p>Gamepad supported</p>
|
| 169 |
+
</div>
|
| 170 |
+
</div>
|
| 171 |
+
</div>
|
| 172 |
+
|
| 173 |
+
<!-- Game Over Menu -->
|
| 174 |
+
<div id="gameOverMenu" class="absolute inset-0 flex flex-col items-center justify-center bg-gradient-to-br from-red-900/80 to-black/80 backdrop-blur-sm hidden">
|
| 175 |
+
<div class="text-center space-y-6">
|
| 176 |
+
<h2 class="text-4xl font-bold text-red-400">Flight Terminated</h2>
|
| 177 |
+
|
| 178 |
+
<div class="bg-black/50 p-6 rounded-2xl space-y-4">
|
| 179 |
+
<div class="text-2xl font-semibold">Final Score: <span id="finalScore" class="text-yellow-400">0</span></div>
|
| 180 |
+
<div class="text-lg">Best Score: <span id="finalBestScore" class="text-green-400">0</span></div>
|
| 181 |
+
|
| 182 |
+
<div class="space-y-3">
|
| 183 |
+
<button onclick="restartGame()" class="w-64 bg-gradient-to-r from-green-500 to-blue-600 hover:from-green-600 hover:to-blue-700 text-white font-semibold py-3 px-6 rounded-xl transition-all duration-300">
|
| 184 |
+
<i data-feather="refresh-cw" class="inline mr-2"></i>
|
| 185 |
+
Fly Again
|
| 186 |
+
</button>
|
| 187 |
+
|
| 188 |
+
<button onclick="showStartMenu()" class="w-64 bg-gray-700 hover:bg-gray-600 text-white font-semibold py-3 px-6 rounded-xl transition-all duration-300">
|
| 189 |
+
<i data-feather="home" class="inline mr-2"></i>
|
| 190 |
+
Main Menu
|
| 191 |
+
</button>
|
| 192 |
+
</div>
|
| 193 |
+
</div>
|
| 194 |
+
</div>
|
| 195 |
+
|
| 196 |
+
<!-- Settings Menu -->
|
| 197 |
+
<div id="settingsMenu" class="absolute inset-0 flex flex-col items-center justify-center bg-gradient-to-br from-gray-900/80 to-black/80 backdrop-blur-sm hidden">
|
| 198 |
+
<div class="bg-black/70 p-8 rounded-2xl max-w-md w-full space-y-6">
|
| 199 |
+
<h2 class="text-3xl font-bold text-center text-white">Settings</h2>
|
| 200 |
+
|
| 201 |
+
<div class="space-y-4">
|
| 202 |
+
<div>
|
| 203 |
+
<label class="block text-sm font-medium text-gray-300 mb-2">Music Volume</label>
|
| 204 |
+
<input type="range" min="0" max="100" value="50" class="w-full h-2 bg-gray-600 rounded-lg appearance-none cursor-pointer slider">
|
| 205 |
+
</div>
|
| 206 |
+
|
| 207 |
+
<div>
|
| 208 |
+
<label class="block text-sm font-medium text-gray-300 mb-2">SFX Volume</label>
|
| 209 |
+
<input type="range" min="0" max="100" value="70" class="w-full h-2 bg-gray-600 rounded-lg appearance-none cursor-pointer slider">
|
| 210 |
+
</div>
|
| 211 |
+
|
| 212 |
+
<div class="flex items-center justify-between">
|
| 213 |
+
<span class="text-sm font-medium text-gray-300">Visual Effects</span>
|
| 214 |
+
<label class="relative inline-flex items-center cursor-pointer">
|
| 215 |
+
<input type="checkbox" checked class="sr-only peer">
|
| 216 |
+
<div class="w-11 h-6 bg-gray-700 peer-focus:outline-none rounded-full peer-checked:after:translate-x-full after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-blue-500"></div>
|
| 217 |
+
</label>
|
| 218 |
+
</div>
|
| 219 |
+
</div>
|
| 220 |
+
|
| 221 |
+
<div class="flex space-x-4 pt-4">
|
| 222 |
+
<button onclick="saveSettings()" class="flex-1 bg-gradient-to-r from-blue-500 to-purple-600 hover:from-blue-600 hover:to-purple-700 text-white font-semibold py-2 px-4 rounded-xl transition-all duration-300">
|
| 223 |
+
Save
|
| 224 |
+
</button>
|
| 225 |
+
|
| 226 |
+
<button onclick="showStartMenu()" class="flex-1 bg-gray-700 hover:bg-gray-600 text-white font-semibold py-2 px-4 rounded-xl transition-all duration-300">
|
| 227 |
+
Cancel
|
| 228 |
+
</button>
|
| 229 |
+
</div>
|
| 230 |
+
</div>
|
| 231 |
+
</div>
|
| 232 |
+
</div>
|
| 233 |
+
|
| 234 |
+
<!-- Control Instructions -->
|
| 235 |
+
<div class="mt-8 text-center space-y-2">
|
| 236 |
+
<div class="flex justify-center space-x-8 text-sm text-gray-400">
|
| 237 |
+
<div class="flex items-center space-x-2">
|
| 238 |
+
<i data-feather="mouse-pointer"></i>
|
| 239 |
+
<span>Click/Tap</span>
|
| 240 |
+
</div>
|
| 241 |
+
<div class="flex items-center space-x-2">
|
| 242 |
+
<i data-feather="square"></i>
|
| 243 |
+
<span>Space Bar</span>
|
| 244 |
+
</div>
|
| 245 |
+
<div class="flex items-center space-x-2">
|
| 246 |
+
<i data-feather="gamepad"></i>
|
| 247 |
+
<span>Gamepad A</span>
|
| 248 |
+
</div>
|
| 249 |
+
</div>
|
| 250 |
+
</div>
|
| 251 |
+
|
| 252 |
+
<script>
|
| 253 |
+
// Initialize game variables
|
| 254 |
+
let game;
|
| 255 |
+
let currentScore = 0;
|
| 256 |
+
let bestScore = 0;
|
| 257 |
+
let isGameRunning = false;
|
| 258 |
+
|
| 259 |
+
// Load best score from localStorage
|
| 260 |
+
if (localStorage.getItem('skyflapBestScore')) {
|
| 261 |
+
bestScore = parseInt(localStorage.getItem('skyflapBestScore'));
|
| 262 |
+
document.getElementById('bestScore').textContent = bestScore;
|
| 263 |
+
}
|
| 264 |
+
|
| 265 |
+
// Game configuration
|
| 266 |
+
const config = {
|
| 267 |
+
type: Phaser.AUTO,
|
| 268 |
+
width: 800,
|
| 269 |
+
height: 600,
|
| 270 |
+
parent: 'gameCanvas',
|
| 271 |
+
physics: {
|
| 272 |
+
default: 'arcade',
|
| 273 |
+
arcade: {
|
| 274 |
+
gravity: { y: 800 },
|
| 275 |
+
debug: false
|
| 276 |
+
}
|
| 277 |
+
},
|
| 278 |
+
scene: {
|
| 279 |
+
preload: preload,
|
| 280 |
+
create: create,
|
| 281 |
+
update: update
|
| 282 |
+
},
|
| 283 |
+
scale: {
|
| 284 |
+
mode: Phaser.Scale.FIT,
|
| 285 |
+
autoCenter: Phaser.Scale.CENTER_BOTH
|
| 286 |
+
}
|
| 287 |
+
};
|
| 288 |
+
|
| 289 |
+
function preload() {
|
| 290 |
+
// Load placeholder assets - in real implementation, these would be actual game assets
|
| 291 |
+
this.load.image('bird', 'http://static.photos/nature/64x64/1');
|
| 292 |
+
this.load.image('pipe', 'http://static.photos/green/128x512/2');
|
| 293 |
+
this.load.image('background', 'http://static.photos/blue/800x600/3');
|
| 294 |
+
}
|
| 295 |
+
|
| 296 |
+
function create() {
|
| 297 |
+
// Create background
|
| 298 |
+
this.add.image(400, 300, 'background');
|
| 299 |
+
|
| 300 |
+
// Create bird
|
| 301 |
+
this.bird = this.physics.add.sprite(100, 300, 'bird');
|
| 302 |
+
this.bird.setCollideWorldBounds(true);
|
| 303 |
+
|
| 304 |
+
// Create pipe group
|
| 305 |
+
this.pipes = this.physics.add.group();
|
| 306 |
+
|
| 307 |
+
// Input handlers
|
| 308 |
+
this.input.on('pointerdown', flap, this);
|
| 309 |
+
this.input.keyboard.on('keydown-SPACE', flap, this);
|
| 310 |
+
|
| 311 |
+
// Timer for pipe generation
|
| 312 |
+
this.pipeTimer = this.time.addEvent({
|
| 313 |
+
delay: 1500,
|
| 314 |
+
callback: generatePipe,
|
| 315 |
+
callbackScope: this,
|
| 316 |
+
loop: true
|
| 317 |
+
});
|
| 318 |
+
|
| 319 |
+
// Collision detection
|
| 320 |
+
this.physics.add.collider(this.bird, this.pipes, gameOver, null, this);
|
| 321 |
+
|
| 322 |
+
// Score text
|
| 323 |
+
this.scoreText = this.add.text(400, 50, '0', {
|
| 324 |
+
fontSize: '32px',
|
| 325 |
+
fill: '#ffffff',
|
| 326 |
+
stroke: '#000000',
|
| 327 |
+
strokeThickness: 4
|
| 328 |
+
}).setOrigin(0.5);
|
| 329 |
+
}
|
| 330 |
+
|
| 331 |
+
function update() {
|
| 332 |
+
if (!isGameRunning) return;
|
| 333 |
+
|
| 334 |
+
// Rotate bird based on velocity
|
| 335 |
+
this.bird.rotation = Phaser.Math.Clamp(this.bird.body.velocity.y * 0.01, -0.5, 0.5);
|
| 336 |
+
}
|
| 337 |
+
|
| 338 |
+
function flap() {
|
| 339 |
+
if (!isGameRunning) return;
|
| 340 |
+
this.bird.setVelocityY(-300);
|
| 341 |
+
}
|
| 342 |
+
|
| 343 |
+
function generatePipe() {
|
| 344 |
+
if (!isGameRunning) return;
|
| 345 |
+
|
| 346 |
+
const gap = 200;
|
| 347 |
+
const pipeX = 800;
|
| 348 |
+
const pipeY = Phaser.Math.Between(100, 500);
|
| 349 |
+
|
| 350 |
+
// Top pipe
|
| 351 |
+
const topPipe = this.pipes.create(pipeX, pipeY - gap / 2, 'pipe');
|
| 352 |
+
topPipe.setScale(1, -1);
|
| 353 |
+
topPipe.setVelocityX(-200);
|
| 354 |
+
|
| 355 |
+
// Bottom pipe
|
| 356 |
+
const bottomPipe = this.pipes.create(pipeX, pipeY + gap / 2, 'pipe');
|
| 357 |
+
bottomPipe.setVelocityX(-200);
|
| 358 |
+
|
| 359 |
+
// Remove pipes when they go off screen
|
| 360 |
+
this.time.delayedCall(4000, () => {
|
| 361 |
+
topPipe.destroy();
|
| 362 |
+
bottomPipe.destroy();
|
| 363 |
+
});
|
| 364 |
+
|
| 365 |
+
// Increment score when passing pipes
|
| 366 |
+
this.time.delayedCall(2000, () => {
|
| 367 |
+
currentScore++;
|
| 368 |
+
updateScore();
|
| 369 |
+
});
|
| 370 |
+
}
|
| 371 |
+
|
| 372 |
+
function gameOver() {
|
| 373 |
+
isGameRunning = false;
|
| 374 |
+
|
| 375 |
+
// Update best score
|
| 376 |
+
if (currentScore > bestScore) {
|
| 377 |
+
bestScore = currentScore;
|
| 378 |
+
localStorage.setItem('skyflapBestScore', bestScore);
|
| 379 |
+
|
| 380 |
+
// Show game over menu
|
| 381 |
+
document.getElementById('finalScore').textContent = currentScore;
|
| 382 |
+
document.getElementById('finalBestScore').textContent = bestScore;
|
| 383 |
+
document.getElementById('gameOverMenu').classList.remove('hidden');
|
| 384 |
+
}
|
| 385 |
+
|
| 386 |
+
function updateScore() {
|
| 387 |
+
document.getElementById('currentScore').textContent = currentScore;
|
| 388 |
+
document.getElementById('bestScore').textContent = bestScore;
|
| 389 |
+
|
| 390 |
+
// Add animation
|
| 391 |
+
document.getElementById('currentScore').classList.add('score-animation');
|
| 392 |
+
setTimeout(() => {
|
| 393 |
+
document.getElementById('currentScore').classList.remove('score-animation');
|
| 394 |
+
}, 600);
|
| 395 |
+
}
|
| 396 |
+
|
| 397 |
+
// UI Control Functions
|
| 398 |
+
function startGame() {
|
| 399 |
+
document.getElementById('startMenu').classList.add('hidden');
|
| 400 |
+
document.getElementById('gameOverMenu').classList.add('hidden');
|
| 401 |
+
isGameRunning = true;
|
| 402 |
+
currentScore = 0;
|
| 403 |
+
updateScore();
|
| 404 |
+
|
| 405 |
+
// Initialize game if not already created
|
| 406 |
+
if (!game) {
|
| 407 |
+
game = new Phaser.Game(config);
|
| 408 |
+
} else {
|
| 409 |
+
// Reset game state
|
| 410 |
+
game.scene.restart();
|
| 411 |
+
}
|
| 412 |
+
}
|
| 413 |
+
|
| 414 |
+
function restartGame() {
|
| 415 |
+
document.getElementById('gameOverMenu').classList.add('hidden');
|
| 416 |
+
isGameRunning = true;
|
| 417 |
+
currentScore = 0;
|
| 418 |
+
updateScore();
|
| 419 |
+
game.scene.restart();
|
| 420 |
+
}
|
| 421 |
+
|
| 422 |
+
function showStartMenu() {
|
| 423 |
+
document.getElementById('startMenu').classList.remove('hidden');
|
| 424 |
+
document.getElementById('settingsMenu').classList.add('hidden');
|
| 425 |
+
document.getElementById('gameOverMenu').classList.add('hidden');
|
| 426 |
+
isGameRunning = false;
|
| 427 |
+
}
|
| 428 |
+
|
| 429 |
+
function showSettings() {
|
| 430 |
+
document.getElementById('startMenu').classList.add('hidden');
|
| 431 |
+
document.getElementById('settingsMenu').classList.remove('hidden');
|
| 432 |
+
}
|
| 433 |
+
|
| 434 |
+
function saveSettings() {
|
| 435 |
+
// Save settings logic would go here
|
| 436 |
+
showStartMenu();
|
| 437 |
+
}
|
| 438 |
+
|
| 439 |
+
// Gamepad support
|
| 440 |
+
window.addEventListener("gamepadconnected", (e) => {
|
| 441 |
+
console.log("Gamepad connected:", e.gamepad.id);
|
| 442 |
+
});
|
| 443 |
+
|
| 444 |
+
window.addEventListener("gamepaddisconnected", (e) => {
|
| 445 |
+
console.log("Gamepad disconnected:", e.gamepad.id);
|
| 446 |
+
});
|
| 447 |
+
|
| 448 |
+
// Initialize Feather Icons
|
| 449 |
+
document.addEventListener('DOMContentLoaded', function() {
|
| 450 |
+
feather.replace();
|
| 451 |
+
});
|
| 452 |
+
|
| 453 |
+
// Responsive adjustments
|
| 454 |
+
function handleResize() {
|
| 455 |
+
const container = document.querySelector('.game-container');
|
| 456 |
+
const canvas = document.getElementById('gameCanvas');
|
| 457 |
+
|
| 458 |
+
if (window.innerWidth < 768) {
|
| 459 |
+
container.style.maxWidth = '100%';
|
| 460 |
+
if (game) {
|
| 461 |
+
game.scale.setGameSize(400, 300);
|
| 462 |
+
}
|
| 463 |
+
} else {
|
| 464 |
+
container.style.maxWidth = '1200px';
|
| 465 |
+
if (game) {
|
| 466 |
+
game.scale.setGameSize(800, 600);
|
| 467 |
+
}
|
| 468 |
+
}
|
| 469 |
+
}
|
| 470 |
+
|
| 471 |
+
window.addEventListener('resize', handleResize);
|
| 472 |
+
handleResize();
|
| 473 |
+
</script>
|
| 474 |
+
</body>
|
| 475 |
</html>
|