File size: 10,975 Bytes
23ded4d 7b02b75 23ded4d 010e22a 23ded4d 010e22a 23ded4d 73ec3a6 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Pyramid Builder Adventure</title>
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://unpkg.com/feather-icons"></script>
<style>
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&display=swap');
body {
font-family: 'Poppins', sans-serif;
background-color: #1a1a2e;
color: #e6e6e6;
overflow: hidden;
}
.game-container {
perspective: 1000px;
}
.btn-primary {
background: linear-gradient(135deg, #6e45e2 0%, #88d3ce 100%);
box-shadow: 0 4px 15px rgba(110, 69, 226, 0.4);
transition: all 0.3s ease;
}
.btn-primary:hover {
transform: translateY(-3px);
box-shadow: 0 6px 20px rgba(110, 69, 226, 0.6);
}
.btn-primary:active {
transform: translateY(1px);
}
.volume-slider::-webkit-slider-thumb {
-webkit-appearance: none;
width: 20px;
height: 20px;
border-radius: 50%;
background: #6e45e2;
cursor: pointer;
}
.language-dropdown {
background-color: #16213e;
border: 1px solid #6e45e2;
}
.language-option {
transition: all 0.2s ease;
}
.language-option:hover {
background-color: rgba(110, 69, 226, 0.2);
}
/* Animation for game entrance */
@keyframes fadeIn {
from { opacity: 0; transform: scale(0.9); }
to { opacity: 1; transform: scale(1); }
}
.fade-in {
animation: fadeIn 0.5s ease-out forwards;
}
</style>
</head>
<body class="flex items-center justify-center h-screen">
<div class="game-container w-full max-w-4xl h-[600px] bg-gradient-to-br from-gray-900 to-gray-800 rounded-2xl overflow-hidden shadow-2xl fade-in">
<!-- Main Menu -->
<div id="main-menu" class="h-full flex flex-col items-center justify-center p-8">
<h1 class="text-5xl font-bold mb-6 text-transparent bg-clip-text bg-gradient-to-r from-purple-400 to-cyan-300">
Pyramid Builder Adventure
</h1>
<p class="text-xl mb-12 text-gray-300 text-center max-w-2xl">
Collect stones from the river and stack them to build an ancient pyramid!
</p>
<button id="start-btn" class="btn-primary px-12 py-4 rounded-full text-xl font-semibold mb-16">
Start Game
</button>
<a href="game.html" class="btn-primary px-12 py-4 rounded-full text-xl font-semibold mb-16 hidden" id="direct-start-btn">
Play Directly
</a>
<div class="w-full max-w-md space-y-8">
<!-- Sound Controls -->
<div class="flex items-center space-x-4">
<i data-feather="volume-2" class="text-gray-300"></i>
<input type="range" min="0" max="100" value="70" class="volume-slider w-full h-2 bg-gray-700 rounded-lg appearance-none cursor-pointer">
<button id="mute-btn" class="text-gray-300 hover:text-white">
<i data-feather="volume-2"></i>
</button>
</div>
<!-- Language Selector -->
<div class="relative">
<select id="language-select" class="language-dropdown w-full py-3 px-4 pr-8 rounded-lg text-gray-300 appearance-none focus:outline-none focus:ring-2 focus:ring-purple-500">
<option value="en" class="language-option flex items-center">
<img src="https://flagcdn.com/w20/gb.png" class="w-5 h-5 mr-2"> English
</option>
<option value="ar" class="language-option flex items-center">
<img src="https://flagcdn.com/w20/sa.png" class="w-5 h-5 mr-2"> العربية
</option>
</select>
<div class="absolute inset-y-0 right-0 flex items-center pr-3 pointer-events-none">
<i data-feather="chevron-down" class="text-gray-400"></i>
</div>
</div>
</div>
</div>
<!-- Game Screen (initially hidden) -->
<div id="game-screen" class="h-full hidden relative overflow-hidden">
<!-- Game UI -->
<div class="absolute top-4 left-4 z-10 bg-black bg-opacity-50 rounded-lg p-3 flex items-center">
<span id="blocks-counter" class="font-bold text-white">Blocks: 0/10</span>
</div>
<div class="absolute top-4 right-4 z-10 flex space-x-3">
<button id="pause-btn" class="bg-black bg-opacity-50 p-2 rounded-lg text-white hover:bg-opacity-70">
<i data-feather="pause"></i>
</button>
<button id="restart-btn" class="bg-black bg-opacity-50 p-2 rounded-lg text-white hover:bg-opacity-70">
<i data-feather="refresh-cw"></i>
</button>
</div>
<!-- Game Elements -->
<div class="absolute bottom-0 left-0 w-full h-1/3 bg-blue-900">
<!-- River -->
<div class="absolute inset-0 overflow-hidden">
<div class="water absolute bottom-0 left-0 right-0 h-full bg-blue-700 opacity-70"></div>
<!-- Water animation would be added here with CSS or JS -->
</div>
<!-- Stones -->
<div class="absolute bottom-20 left-1/4 w-16 h-16 bg-gray-500 rounded-lg transform rotate-12"></div>
<div class="absolute bottom-16 right-1/3 w-14 h-14 bg-gray-600 rounded-lg transform -rotate-6"></div>
<div class="absolute bottom-24 left-2/3 w-12 h-12 bg-gray-400 rounded-lg transform rotate-3"></div>
<!-- Player -->
<div id="player" class="absolute bottom-20 left-1/2 w-16 h-16 bg-amber-600 rounded-sm shadow-md cursor-grab block">
<!-- Player block -->
</div>
</div>
<!-- Construction Area -->
<div class="absolute bottom-1/3 right-1/4 w-32 h-32 bg-yellow-900 bg-opacity-30 rounded-lg border-2 border-dashed border-yellow-500">
<!-- Pyramid base would be built here -->
</div>
<!-- Collected Stones Area -->
<div class="absolute bottom-1/3 left-1/4 w-32 h-16 bg-gray-800 bg-opacity-50 rounded-lg flex items-end justify-center space-x-1">
<!-- Collected stones would appear here -->
</div>
</div>
</div>
<script>
feather.replace();
// Language translations
const translations = {
en: {
title: "Pyramid Builder Adventure",
subtitle: "Collect stones from the river and stack them to build an ancient pyramid!",
start: "Start Game",
blocks: "Blocks",
pause: "Pause",
restart: "Restart"
},
ar: {
title: "مغامرة بناء الهرم",
subtitle: "اجمع الحجارة من النهر وقم بترتيبها لبناء هرم قديم!",
start: "ابدأ اللعبة",
blocks: "الكتل",
pause: "إيقاف مؤقت",
restart: "إعادة التشغيل"
}
};
// DOM elements
const mainMenu = document.getElementById('main-menu');
const gameScreen = document.getElementById('game-screen');
const startBtn = document.getElementById('start-btn');
const muteBtn = document.getElementById('mute-btn');
const languageSelect = document.getElementById('language-select');
const blocksCounter = document.getElementById('blocks-counter');
const pauseBtn = document.getElementById('pause-btn');
const restartBtn = document.getElementById('restart-btn');
// Current language
let currentLanguage = 'en';
// Update UI language
function updateLanguage(lang) {
currentLanguage = lang;
document.documentElement.lang = lang;
document.documentElement.dir = lang === 'ar' ? 'rtl' : 'ltr';
const texts = translations[lang];
// Update main menu
document.querySelector('#main-menu h1').textContent = texts.title;
document.querySelector('#main-menu p').textContent = texts.subtitle;
startBtn.textContent = texts.start;
// Update game UI
if (gameScreen.style.display !== 'none') {
blocksCounter.textContent = `${texts.blocks}: 0/10`;
pauseBtn.innerHTML = `<i data-feather="pause"></i>`;
restartBtn.innerHTML = `<i data-feather="refresh-cw"></i>`;
feather.replace();
}
}
// Event listeners
startBtn.addEventListener('click', () => {
mainMenu.style.display = 'none';
gameScreen.style.display = 'block';
updateLanguage(currentLanguage);
// Here you would initialize the game
// For now we'll just simulate some blocks being collected
let blocks = 0;
const interval = setInterval(() => {
if (blocks >= 10) {
clearInterval(interval);
return;
}
blocks++;
blocksCounter.textContent = `${translations[currentLanguage].blocks}: ${blocks}/10`;
}, 1000);
});
muteBtn.addEventListener('click', () => {
const icon = muteBtn.querySelector('i');
if (icon.getAttribute('data-feather') === 'volume-2') {
icon.setAttribute('data-feather', 'volume-x');
// Mute audio
} else {
icon.setAttribute('data-feather', 'volume-2');
// Unmute audio
}
feather.replace();
});
languageSelect.addEventListener('change', (e) => {
updateLanguage(e.target.value);
});
// Initialize
updateLanguage('en');
</script>
</body>
</html>
|