Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Aurora Archive Arena</title>
- <style>
- * {
- margin: 0;
- padding: 0;
- box-sizing: border-box;
- }
- body {
- font-family: 'Georgia', serif;
- background: #0a0a0a;
- color: #fff;
- overflow: hidden;
- display: flex;
- justify-content: center;
- align-items: center;
- height: 100vh;
- }
- #gameContainer {
- position: relative;
- width: 100%;
- max-width: 1200px;
- height: 100vh;
- max-height: 800px;
- }
- #gameCanvas {
- border: 3px solid #4a5568;
- background: #1a1a2e;
- display: block;
- width: 100%;
- height: 100%;
- box-shadow: 0 0 40px rgba(138, 43, 226, 0.5);
- }
- .aurora-overlay {
- position: absolute;
- top: 0;
- left: 0;
- right: 0;
- height: 40%;
- pointer-events: none;
- background: linear-gradient(180deg,
- rgba(0, 255, 200, 0.3) 0%,
- rgba(138, 43, 226, 0.3) 33%,
- rgba(0, 150, 255, 0.3) 66%,
- transparent 100%);
- opacity: 0.6;
- animation: aurora-flow 8s ease-in-out infinite;
- z-index: 1;
- }
- @keyframes aurora-flow {
- 0%, 100% {
- background: linear-gradient(180deg,
- rgba(0, 255, 200, 0.3) 0%,
- rgba(138, 43, 226, 0.3) 33%,
- rgba(0, 150, 255, 0.3) 66%,
- transparent 100%);
- }
- 33% {
- background: linear-gradient(180deg,
- rgba(138, 43, 226, 0.3) 0%,
- rgba(0, 150, 255, 0.3) 33%,
- rgba(255, 100, 200, 0.3) 66%,
- transparent 100%);
- }
- 66% {
- background: linear-gradient(180deg,
- rgba(0, 150, 255, 0.3) 0%,
- rgba(255, 100, 200, 0.3) 33%,
- rgba(0, 255, 200, 0.3) 66%,
- transparent 100%);
- }
- }
- #ui {
- position: absolute;
- bottom: 20px;
- left: 50%;
- transform: translateX(-50%);
- display: flex;
- gap: 10px;
- z-index: 10;
- background: rgba(0, 0, 0, 0.8);
- padding: 15px;
- border-radius: 10px;
- border: 2px solid #8a2be2;
- }
- .spell-btn {
- padding: 12px 20px;
- background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
- border: 2px solid #fff;
- color: #fff;
- font-size: 14px;
- font-weight: bold;
- cursor: pointer;
- border-radius: 8px;
- transition: all 0.3s;
- text-transform: uppercase;
- letter-spacing: 1px;
- }
- .spell-btn:hover {
- transform: scale(1.05);
- box-shadow: 0 0 20px rgba(138, 43, 226, 0.8);
- }
- .spell-btn:active {
- transform: scale(0.95);
- }
- .spell-btn.ice { background: linear-gradient(135deg, #00d4ff 0%, #0066ff 100%); }
- .spell-btn.fire { background: linear-gradient(135deg, #ff6b6b 0%, #ff3d00 100%); }
- .spell-btn.wind { background: linear-gradient(135deg, #a8e6cf 0%, #3d9970 100%); }
- .spell-btn.light { background: linear-gradient(135deg, #fffacd 0%, #ffd700 100%); color: #333; }
- .spell-btn.earth { background: linear-gradient(135deg, #8b4513 0%, #654321 100%); }
- .spell-btn.shadow { background: linear-gradient(135deg, #4a4a4a 0%, #1a1a1a 100%); }
- #auroraInfo {
- position: absolute;
- top: 20px;
- left: 50%;
- transform: translateX(-50%);
- background: rgba(0, 0, 0, 0.9);
- padding: 15px 30px;
- border-radius: 10px;
- border: 2px solid #8a2be2;
- text-align: center;
- z-index: 10;
- min-width: 300px;
- }
- #auroraInfo h3 {
- color: #8a2be2;
- margin-bottom: 10px;
- font-size: 18px;
- text-transform: uppercase;
- letter-spacing: 2px;
- }
- #battleLog {
- position: absolute;
- top: 100px;
- right: 20px;
- width: 250px;
- max-height: 300px;
- overflow-y: auto;
- background: rgba(0, 0, 0, 0.9);
- padding: 15px;
- border-radius: 10px;
- border: 2px solid #667eea;
- z-index: 10;
- font-size: 12px;
- line-height: 1.6;
- }
- #battleLog::-webkit-scrollbar {
- width: 8px;
- }
- #battleLog::-webkit-scrollbar-track {
- background: #1a1a2e;
- }
- #battleLog::-webkit-scrollbar-thumb {
- background: #667eea;
- border-radius: 4px;
- }
- .log-entry {
- margin-bottom: 8px;
- padding: 5px;
- border-left: 3px solid #8a2be2;
- padding-left: 8px;
- }
- .log-player { border-left-color: #00d4ff; }
- .log-enemy { border-left-color: #ff3d00; }
- .log-aurora { border-left-color: #ffd700; background: rgba(255, 215, 0, 0.1); }
- #startScreen, #gameOverScreen {
- position: absolute;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- background: rgba(0, 0, 0, 0.95);
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- z-index: 100;
- }
- #startScreen h1, #gameOverScreen h1 {
- font-size: 48px;
- margin-bottom: 20px;
- background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
- -webkit-background-clip: text;
- -webkit-text-fill-color: transparent;
- background-clip: text;
- }
- #startScreen p, #gameOverScreen p {
- font-size: 18px;
- margin-bottom: 30px;
- max-width: 600px;
- text-align: center;
- line-height: 1.6;
- }
- .start-btn {
- padding: 15px 40px;
- background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
- border: 3px solid #fff;
- color: #fff;
- font-size: 20px;
- font-weight: bold;
- cursor: pointer;
- border-radius: 10px;
- transition: all 0.3s;
- text-transform: uppercase;
- letter-spacing: 2px;
- }
- .start-btn:hover {
- transform: scale(1.1);
- box-shadow: 0 0 30px rgba(138, 43, 226, 1);
- }
- .hidden {
- display: none !important;
- }
- </style>
- </head>
- <body>
- <div id="gameContainer">
- <div class="aurora-overlay"></div>
- <canvas id="gameCanvas" width="1200" height="800"></canvas>
- <div id="startScreen">
- <h1>⚔️ Aurora Archive Arena ⚔️</h1>
- <p>Battle in a mystical library where northern lights transform magic itself. Ice becomes fire, wind becomes light—adapt your strategy as the aurora shifts!</p>
- <button class="start-btn" onclick="startGame()">Enter the Archive</button>
- </div>
- <div id="gameOverScreen" class="hidden">
- <h1 id="gameOverTitle">Victory!</h1>
- <p id="gameOverText">The aurora fades as peace returns to the Archive...</p>
- <button class="start-btn" onclick="resetGame()">Battle Again</button>
- </div>
- <div id="auroraInfo" class="hidden">
- <h3>🌌 Aurora Shift 🌌</h3>
- <div id="transformations"></div>
- </div>
- <div id="battleLog" class="hidden">
- <strong style="color: #667eea; display: block; margin-bottom: 10px;">📜 Battle Log</strong>
- </div>
- <div id="ui" class="hidden">
- <button class="spell-btn ice" onclick="castSpell('ice')">❄️ Ice</button>
- <button class="spell-btn fire" onclick="castSpell('fire')">🔥 Fire</button>
- <button class="spell-btn wind" onclick="castSpell('wind')">💨 Wind</button>
- <button class="spell-btn light" onclick="castSpell('light')">✨ Light</button>
- <button class="spell-btn earth" onclick="castSpell('earth')">🪨 Earth</button>
- <button class="spell-btn shadow" onclick="castSpell('shadow')">🌑 Shadow</button>
- </div>
- </div>
- <script>
- const canvas = document.getElementById('gameCanvas');
- const ctx = canvas.getContext('2d');
- // Game state
- let gameActive = false;
- let player = { hp: 100, maxHp: 100, x: 200, y: 500 };
- let enemy = { hp: 100, maxHp: 100, x: 1000, y: 500 };
- let auroraTransforms = {};
- let turnCount = 0;
- let particleEffects = [];
- let books = [];
- // Spell data
- const spells = {
- ice: { damage: 20, color: '#00d4ff', name: 'Ice' },
- fire: { damage: 25, color: '#ff3d00', name: 'Fire' },
- wind: { damage: 15, color: '#3d9970', name: 'Wind' },
- light: { damage: 22, color: '#ffd700', name: 'Light' },
- earth: { damage: 18, color: '#8b4513', name: 'Earth' },
- shadow: { damage: 23, color: '#4a4a4a', name: 'Shadow' }
- };
- const spellTypes = Object.keys(spells);
- // Initialize books
- function initBooks() {
- for (let i = 0; i < 20; i++) {
- books.push({
- x: Math.random() * canvas.width,
- y: Math.random() * 200 + 50,
- width: 30 + Math.random() * 20,
- height: 40 + Math.random() * 20,
- color: `hsl(${Math.random() * 360}, 50%, 40%)`
- });
- }
- }
- // Generate aurora transformations
- function generateAuroraShift() {
- auroraTransforms = {};
- const shuffled = [...spellTypes].sort(() => Math.random() - 0.5);
- spellTypes.forEach((spell, i) => {
- let target = shuffled[i];
- while (target === spell) {
- target = spellTypes[Math.floor(Math.random() * spellTypes.length)];
- }
- auroraTransforms[spell] = target;
- });
- updateAuroraDisplay();
- addLog(`✨ The aurora shifts! Magic transforms...`, 'aurora');
- }
- function updateAuroraDisplay() {
- const transformDiv = document.getElementById('transformations');
- transformDiv.innerHTML = '';
- for (let [from, to] of Object.entries(auroraTransforms)) {
- const div = document.createElement('div');
- div.style.margin = '5px 0';
- div.innerHTML = `${spells[from].name} → ${spells[to].name}`;
- div.style.color = spells[to].color;
- transformDiv.appendChild(div);
- }
- }
- function drawBackground() {
- // Library background
- ctx.fillStyle = '#1a1a2e';
- ctx.fillRect(0, 0, canvas.width, canvas.height);
- // Bookshelves
- ctx.fillStyle = '#2d2d44';
- ctx.fillRect(0, 0, canvas.width, 250);
- ctx.fillRect(0, 0, 150, canvas.height);
- ctx.fillRect(canvas.width - 150, 0, 150, canvas.height);
- // Books
- books.forEach(book => {
- ctx.fillStyle = book.color;
- ctx.fillRect(book.x, book.y, book.width, book.height);
- ctx.strokeStyle = '#000';
- ctx.lineWidth = 2;
- ctx.strokeRect(book.x, book.y, book.width, book.height);
- });
- // Floor
- ctx.fillStyle = '#16213e';
- ctx.fillRect(0, 650, canvas.width, 150);
- // Floor pattern
- ctx.strokeStyle = '#0f3460';
- ctx.lineWidth = 2;
- for (let i = 0; i < canvas.width; i += 50) {
- ctx.beginPath();
- ctx.moveTo(i, 650);
- ctx.lineTo(i, 800);
- ctx.stroke();
- }
- }
- function drawCharacter(char, isPlayer) {
- // Body
- ctx.fillStyle = isPlayer ? '#667eea' : '#e74c3c';
- ctx.beginPath();
- ctx.arc(char.x, char.y, 40, 0, Math.PI * 2);
- ctx.fill();
- // Robe
- ctx.fillStyle = isPlayer ? '#764ba2' : '#c0392b';
- ctx.beginPath();
- ctx.moveTo(char.x - 40, char.y + 20);
- ctx.lineTo(char.x - 30, char.y + 100);
- ctx.lineTo(char.x + 30, char.y + 100);
- ctx.lineTo(char.x + 40, char.y + 20);
- ctx.closePath();
- ctx.fill();
- // Eyes
- ctx.fillStyle = '#fff';
- ctx.beginPath();
- ctx.arc(char.x - 15, char.y - 5, 8, 0, Math.PI * 2);
- ctx.arc(char.x + 15, char.y - 5, 8, 0, Math.PI * 2);
- ctx.fill();
- ctx.fillStyle = '#000';
- ctx.beginPath();
- ctx.arc(char.x - 15, char.y - 5, 4, 0, Math.PI * 2);
- ctx.arc(char.x + 15, char.y - 5, 4, 0, Math.PI * 2);
- ctx.fill();
- // Hat
- ctx.fillStyle = isPlayer ? '#4c3f91' : '#8b0000';
- ctx.beginPath();
- ctx.moveTo(char.x - 35, char.y - 40);
- ctx.lineTo(char.x, char.y - 80);
- ctx.lineTo(char.x + 35, char.y - 40);
- ctx.closePath();
- ctx.fill();
- // Hat brim
- ctx.fillRect(char.x - 45, char.y - 40, 90, 8);
- // Health bar
- const barWidth = 100;
- const barHeight = 10;
- const barX = char.x - barWidth / 2;
- const barY = char.y - 120;
- ctx.fillStyle = '#000';
- ctx.fillRect(barX, barY, barWidth, barHeight);
- const hpPercent = char.hp / char.maxHp;
- ctx.fillStyle = hpPercent > 0.5 ? '#00ff00' : hpPercent > 0.25 ? '#ffff00' : '#ff0000';
- ctx.fillRect(barX, barY, barWidth * hpPercent, barHeight);
- ctx.strokeStyle = '#fff';
- ctx.lineWidth = 2;
- ctx.strokeRect(barX, barY, barWidth, barHeight);
- // HP text
- ctx.fillStyle = '#fff';
- ctx.font = 'bold 14px Georgia';
- ctx.textAlign = 'center';
- ctx.fillText(`${Math.max(0, Math.floor(char.hp))} HP`, char.x, barY - 5);
- }
- function createParticle(x, y, color, size = 5) {
- return {
- x, y, color, size,
- vx: (Math.random() - 0.5) * 10,
- vy: (Math.random() - 0.5) * 10,
- life: 1,
- decay: 0.02
- };
- }
- function updateParticles() {
- particleEffects = particleEffects.filter(p => {
- p.x += p.vx;
- p.y += p.vy;
- p.life -= p.decay;
- ctx.globalAlpha = p.life;
- ctx.fillStyle = p.color;
- ctx.beginPath();
- ctx.arc(p.x, p.y, p.size, 0, Math.PI * 2);
- ctx.fill();
- return p.life > 0;
- });
- ctx.globalAlpha = 1;
- }
- function castSpell(spellType) {
- if (!gameActive) return;
- const originalSpell = spellType;
- const transformedSpell = auroraTransforms[spellType];
- const spell = spells[transformedSpell];
- // Create spell particles
- for (let i = 0; i < 20; i++) {
- particleEffects.push(createParticle(player.x, player.y, spell.color, 8));
- }
- // Damage enemy
- enemy.hp -= spell.damage;
- addLog(`You cast ${spells[originalSpell].name}! Aurora transforms it to ${spell.name}! ${spell.damage} damage!`, 'player');
- // Enemy turn
- setTimeout(() => {
- if (enemy.hp > 0) {
- enemyTurn();
- } else {
- endGame(true);
- }
- }, 1000);
- turnCount++;
- if (turnCount % 3 === 0) {
- setTimeout(generateAuroraShift, 1500);
- }
- }
- function enemyTurn() {
- const randomSpell = spellTypes[Math.floor(Math.random() * spellTypes.length)];
- const originalSpell = randomSpell;
- const transformedSpell = auroraTransforms[randomSpell];
- const spell = spells[transformedSpell];
- // Create spell particles
- for (let i = 0; i < 20; i++) {
- particleEffects.push(createParticle(enemy.x, enemy.y, spell.color, 8));
- }
- player.hp -= spell.damage;
- addLog(`Enemy casts ${spells[originalSpell].name}! Transforms to ${spell.name}! ${spell.damage} damage!`, 'enemy');
- if (player.hp <= 0) {
- endGame(false);
- }
- }
- function addLog(text, type = '') {
- const log = document.getElementById('battleLog');
- const entry = document.createElement('div');
- entry.className = `log-entry log-${type}`;
- entry.textContent = text;
- log.insertBefore(entry, log.firstChild);
- // Keep only last 15 entries
- while (log.children.length > 16) {
- log.removeChild(log.lastChild);
- }
- }
- function gameLoop() {
- if (!gameActive) return;
- drawBackground();
- drawCharacter(player, true);
- drawCharacter(enemy, false);
- updateParticles();
- requestAnimationFrame(gameLoop);
- }
- function startGame() {
- document.getElementById('startScreen').classList.add('hidden');
- document.getElementById('ui').classList.remove('hidden');
- document.getElementById('auroraInfo').classList.remove('hidden');
- document.getElementById('battleLog').classList.remove('hidden');
- player.hp = player.maxHp;
- enemy.hp = enemy.maxHp;
- gameActive = true;
- turnCount = 0;
- particleEffects = [];
- initBooks();
- generateAuroraShift();
- addLog('Battle begins! The aurora illuminates the archive...', 'aurora');
- gameLoop();
- }
- function endGame(playerWon) {
- gameActive = false;
- const screen = document.getElementById('gameOverScreen');
- const title = document.getElementById('gameOverTitle');
- const text = document.getElementById('gameOverText');
- if (playerWon) {
- title.textContent = '🎉 Victory! 🎉';
- text.textContent = 'The enemy mage falls! The archive is safe, and the aurora dances in celebration!';
- } else {
- title.textContent = '💀 Defeat 💀';
- text.textContent = 'The aurora dims as you fall... But knowledge endures. Try again, brave mage!';
- }
- screen.classList.remove('hidden');
- }
- function resetGame() {
- document.getElementById('gameOverScreen').classList.add('hidden');
- document.getElementById('battleLog').innerHTML = '<strong style="color: #667eea; display: block; margin-bottom: 10px;">📜 Battle Log</strong>';
- startGame();
- }
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment