Spaces:
Running

sim / index.html
les777's picture
Add 3 files
5b24c3e verified
Raw History Blame Contribute Delete
50 kB
<!DOCTYPE html> <html lang="pt-BR"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>GameHub - Jogue Online</title> <script src="https://cdn.tailwindcss.com"></script> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"> <style> .game-card:hover { transform: translateY(-5px); box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2); } .hero { background: linear-gradient(rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.7)), url('https://images.unsplash.com/photo-1542751375-ad40-4d01-87d7-b52b8a8a2acf?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1470&q=80'); background-size: cover; background-position: center; } /* Estilos para os jogos */ .game-container { position: relative; width: 100%; height: 400px; background-color: #1f2937; border-radius: 8px; overflow: hidden; } #snake-game, #memory-game, #flappy-game { width: 100%; height: 100%; } .game-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.8); display: flex; flex-direction: column; justify-content: center; align-items: center; color: white; z-index: 10; } .game-controls { position: absolute; bottom: 20px; left: 0; width: 100%; display: flex; justify-content: center; gap: 10px; z-index: 5; } .game-btn { background: rgba(124, 58, 237, 0.7); color: white; border: none; padding: 8px 16px; border-radius: 4px; cursor: pointer; transition: all 0.3s; } .game-btn:hover { background: rgba(124, 58, 237, 1); } .game-tab { display: none; } .game-tab.active { display: block; } .game-nav { display: flex; justify-content: center; margin-bottom: 20px; gap: 10px; } .game-nav-btn { background: #374151; color: white; border: none; padding: 10px 20px; border-radius: 4px; cursor: pointer; transition: all 0.3s; } .game-nav-btn.active { background: #7c3aed; } /* Estilo específico para o jogo da cobrinha */ #snake-canvas { background-color: #111827; } /* Estilo para o jogo de memória */ .memory-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; padding: 20px; } .memory-card { height: 80px; background: #7c3aed; border-radius: 5px; display: flex; justify-content: center; align-items: center; font-size: 24px; color: white; cursor: pointer; transition: all 0.3s; } .memory-card.flipped { background: #374151; } .memory-card.matched { visibility: hidden; } /* Estilo para o Flappy Bird */ #flappy-canvas { background-color: #4b5563; } </style> </head> <body class="bg-gray-900 text-white"> <!-- Navigation --> <nav class="bg-gray-800 py-4 px-6 sticky top-0 z-50 shadow-lg"> <div class="container mx-auto flex justify-between items-center"> <div class="flex items-center space-x-2"> <i class="fas fa-gamepad text-2xl text-purple-500"></i> <a href="#" class="text-2xl font-bold text-transparent bg-clip-text bg-gradient-to-r from-purple-400 to-pink-600">GameHub</a> </div> <div class="hidden md:flex space-x-8"> <a href="#" class="hover:text-purple-400 transition">Início</a> <a href="#featured" class="hover:text-purple-400 transition">Jogos</a> <a href="#online-games" class="hover:text-purple-400 transition">Jogar Online</a> <a href="#news" class="hover:text-purple-400 transition">Notícias</a> <a href="#" class="hover:text-purple-400 transition">Sobre</a> </div> <div class="flex items-center space-x-4"> <button class="bg-purple-600 hover:bg-purple-700 px-4 py-2 rounded-md transition">Login</button> <button class="md:hidden text-2xl" id="mobile-menu-button"> <i class="fas fa-bars"></i> </button> </div> </div> <!-- Mobile Menu --> <div class="md:hidden hidden bg-gray-700 py-2 px-4" id="mobile-menu"> <a href="#" class="block py-2 hover:text-purple-400 transition">Início</a> <a href="#featured" class="block py-2 hover:text-purple-400 transition">Jogos</a> <a href="#online-games" class="block py-2 hover:text-purple-400 transition">Jogar Online</a> <a href="#news" class="block py-2 hover:text-purple-400 transition">Notícias</a> <a href="#" class="block py-2 hover:text-purple-400 transition">Sobre</a> </div> </nav> <!-- Hero Section --> <section class="hero min-h-[500px] flex items-center"> <div class="container mx-auto px-6 text-center"> <h1 class="text-5xl md:text-6xl font-bold mb-6">Jogue os Melhores Jogos Online</h1> <p class="text-xl md:text-2xl mb-8 max-w-2xl mx-auto">Divirta-se com nossa coleção de jogos online gratuitos. Sem downloads, jogue diretamente no navegador!</p> <div class="flex flex-col sm:flex-row justify-center gap-4"> <a href="#online-games" class="bg-purple-600 hover:bg-purple-700 px-8 py-3 rounded-md text-lg font-semibold transition">Jogar Agora</a> <button class="bg-gray-700 hover:bg-gray-600 px-8 py-3 rounded-md text-lg font-semibold transition">Assinar Premium</button> </div> </div> </section> <!-- Featured Games --> <section class="py-16 px-6" id="featured"> <div class="container mx-auto"> <h2 class="text-3xl font-bold mb-12 text-center">Jogos em Destaque</h2> <div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-8"> <!-- Game Card 1 --> <div class="game-card bg-gray-800 rounded-lg overflow-hidden transition duration-300"> <img src="https://images.unsplash.com/photo-1542751375-ad40-4d01-87d7-b52b8a8a2acf?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1470&q=80" alt="Cyber Adventure" class="w-full h-48 object-cover"> <div class="p-4"> <div class="flex justify-between items-start mb-2"> <h3 class="text-xl font-semibold">Cyber Adventure</h3> <span class="bg-purple-600 text-xs px-2 py-1 rounded">RPG</span> </div> <p class="text-gray-400 text-sm mb-4">Um mundo aberto cyberpunk cheio de ação e mistérios.</p> <div class="flex justify-between items-center"> <div class="flex space-x-1 text-yellow-400"> <i class="fas fa-star"></i> <i class="fas fa-star"></i> <i class="fas fa-star"></i> <i class="fas fa-star"></i> <i class="fas fa-star-half-alt"></i> </div> <button class="bg-gray-700 hover:bg-gray-600 px-3 py-1 text-sm rounded transition">Detalhes</button> </div> </div> </div> <!-- Game Card 2 --> <div class="game-card bg-gray-800 rounded-lg overflow-hidden transition duration-300"> <img src="https://images.unsplash.com/photo-1551103782-8ab07afd45c1?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1470&q=80" alt="Space Explorers" class="w-full h-48 object-cover"> <div class="p-4"> <div class="flex justify-between items-start mb-2"> <h3 class="text-xl font-semibold">Space Explorers</h3> <span class="bg-blue-600 text-xs px-2 py-1 rounded">Aventura</span> </div> <p class="text-gray-400 text-sm mb-4">Explore galáxias desconhecidas em sua nave espacial.</p> <div class="flex justify-between items-center"> <div class="flex space-x-1 text-yellow-400"> <i class="fas fa-star"></i> <i class="fas fa-star"></i> <i class="fas fa-star"></i> <i class="fas fa-star"></i> <i class="far fa-star"></i> </div> <button class="bg-gray-700 hover:bg-gray-600 px-3 py-1 text-sm rounded transition">Detalhes</button> </div> </div> </div> <!-- Game Card 3 --> <div class="game-card bg-gray-800 rounded-lg overflow-hidden transition duration-300"> <img src="https://images.unsplash.com/photo-1511512578047-dba367496e6c?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1471&q=80" alt="Zombie Apocalypse" class="w-full h-48 object-cover"> <div class="p-4"> <div class="flex justify-between items-start mb-2"> <h3 class="text-xl font-semibold">Zombie Apocalypse</h3> <span class="bg-red-600 text-xs px-2 py-1 rounded">Terror</span> </div> <p class="text-gray-400 text-sm mb-4">Sobreviva em um mundo dominado por zumbis famintos.</p> <div class="flex justify-between items-center"> <div class="flex space-x-1 text-yellow-400"> <i class="fas fa-star"></i> <i class="fas fa-star"></i> <i class="fas fa-star"></i> <i class="fas fa-star"></i> <i class="fas fa-star"></i> </div> <button class="bg-gray-700 hover:bg-gray-600 px-3 py-1 text-sm rounded transition">Detalhes</button> </div> </div> </div> <!-- Game Card 4 --> <div class="game-card bg-gray-800 rounded-lg overflow-hidden transition duration-300"> <img src="https://images.unsplash.com/photo-1547036967-23d11aacaee0?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1470&q=80" alt="Football Legends" class="w-full h-48 object-cover"> <div class="p-4"> <div class="flex justify-between items-start mb-2"> <h3 class="text-xl font-semibold">Football Legends</h3> <span class="bg-green-600 text-xs px-2 py-1 rounded">Esporte</span> </div> <p class="text-gray-400 text-sm mb-4">O jogo de futebol mais realista já criado.</p> <div class="flex justify-between items-center"> <div class="flex space-x-1 text-yellow-400"> <i class="fas fa-star"></i> <i class="fas fa-star"></i> <i class="fas fa-star"></i> <i class="fas fa-star"></i> <i class="fas fa-star-half-alt"></i> </div> <button class="bg-gray-700 hover:bg-gray-600 px-3 py-1 text-sm rounded transition">Detalhes</button> </div> </div> </div> </div> <div class="text-center mt-12"> <button class="bg-purple-600 hover:bg-purple-700 px-8 py-3 rounded-md text-lg font-semibold transition">Ver Mais Jogos</button> </div> </div> </section> <!-- Online Games Section --> <section class="py-16 px-6 bg-gray-800" id="online-games"> <div class="container mx-auto"> <h2 class="text-3xl font-bold mb-12 text-center">Jogos Online</h2> <p class="text-xl text-center mb-12 max-w-3xl mx-auto">Jogue diretamente no seu navegador! Escolha um dos nossos jogos abaixo e divirta-se sem precisar de downloads.</p> <div class="game-nav"> <button class="game-nav-btn active" data-tab="snake-game">Snake Game</button> <button class="game-nav-btn" data-tab="memory-game">Jogo da Memória</button> <button class="game-nav-btn" data-tab="flappy-game">Flappy Bird</button> </div> <div class="game-container relative"> <!-- Snake Game --> <div id="snake-game" class="game-tab active"> <div class="game-overlay" id="snake-overlay"> <h3 class="text-2xl font-bold mb-4">Snake Game</h3> <p class="mb-6">Use as teclas de seta para controlar a cobra. Colete a comida para crescer!</p> <button class="game-btn" id="start-snake">Iniciar Jogo</button> </div> <canvas id="snake-canvas"></canvas> <div class="game-controls"> <button class="game-btn" id="pause-snake">Pausar</button> <button class="game-btn" id="reset-snake">Reiniciar</button> </div> </div> <!-- Memory Game --> <div id="memory-game" class="game-tab"> <div class="game-overlay" id="memory-overlay"> <h3 class="text-2xl font-bold mb-4">Jogo da Memória</h3> <p class="mb-6">Encontre todos os pares de cartas no menor tempo possível!</p> <button class="game-btn" id="start-memory">Iniciar Jogo</button> </div> <div class="memory-grid" id="memory-board"></div> <div class="game-controls"> <span id="memory-timer">Tempo: 0s</span> <span id="memory-moves">Movimentos: 0</span> <button class="game-btn" id="reset-memory">Reiniciar</button> </div> </div> <!-- Flappy Bird --> <div id="flappy-game" class="game-tab"> <div class="game-overlay" id="flappy-overlay"> <h3 class="text-2xl font-bold mb-4">Flappy Bird</h3> <p class="mb-6">Pressione qualquer tecla ou clique para fazer o pássaro voar e desviar dos obstáculos!</p> <button class="game-btn" id="start-flappy">Iniciar Jogo</button> </div> <canvas id="flappy-canvas"></canvas> <div class="game-controls"> <span id="flappy-score">Pontuação: 0</span> <button class="game-btn" id="reset-flappy">Reiniciar</button> </div> </div> </div> <div class="mt-12 grid grid-cols-1 md:grid-cols-3 gap-8"> <div class="bg-gray-700 p-6 rounded-lg"> <div class="flex items-center mb-4"> <i class="fas fa-gamepad text-2xl text-purple-500 mr-3"></i> <h3 class="text-xl font-semibold">Jogos Variados</h3> </div> <p class="text-gray-400">Oferecemos uma variedade de jogos para todos os gostos, desde clássicos até novidades.</p> </div> <div class="bg-gray-700 p-6 rounded-lg"> <div class="flex items-center mb-4"> <i class="fas fa-desktop text-2xl text-purple-500 mr-3"></i> <h3 class="text-xl font-semibold">Sem Downloads</h3> </div> <p class="text-gray-400">Todos os jogos rodam diretamente no seu navegador, sem necessidade de instalação.</p> </div> <div class="bg-gray-700 p-6 rounded-lg"> <div class="flex items-center mb-4"> <i class="fas fa-trophy text-2xl text-purple-500 mr-3"></i> <h3 class="text-xl font-semibold">Competições</h3> </div> <p class="text-gray-400">Participe de torneios e competições com outros jogadores para mostrar suas habilidades.</p> </div> </div> </div> </section> <!-- News Section --> <section class="py-16 px-6" id="news"> <div class="container mx-auto"> <h2 class="text-3xl font-bold mb-12 text-center">Últimas Notícias</h2> <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8"> <!-- News 1 --> <div class="bg-gray-700 rounded-lg overflow-hidden transition hover:shadow-lg"> <img src="https://images.unsplash.com/photo-1493711662062-fa541adb3fc8?ixlib=rb-4.0.3&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1470&q=80" alt="Game News" class="w-full h-48 object-cover"> <div class="p-6"> <span class="text-purple-400 text-sm">15/06/2023</span> <h3 class="text-xl font-semibold mt-2 mb-3">Cyber Adventure 2 anunciado para 2024</h3> <p class="text-gray-400 mb-4">A sequência do aclamado RPG cyberpunk foi anunciada com lançamento previsto para o primeiro trimestre de 2024.</p> <a href="#" class="text-purple-400 hover:text-purple-300 font-medium flex items-center transition"> Ler mais <i class="fas fa-arrow-right ml-2"></i> </a> </div> </div> <!-- News 2 --> <div class="bg-gray-700 rounded-lg overflow-hidden transition hover:shadow-lg"> <img src="https://images.unsplash.com/photo-1543489822-c49534f3071f?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1470&q=80" alt="Game News" class="w-full h-48 object-cover"> <div class="p-6"> <span class="text-purple-400 text-sm">10/06/2023</span> <h3 class="text-xl font-semibold mt-2 mb-3">Novo patch para Space Explorers</h3> <p class="text-gray-400 mb-4">O update 2.3 traz novas missões, melhorias de desempenho e corrige diversos bugs reportados pelos jogadores.</p> <a href="#" class="text-purple-400 hover:text-purple-300 font-medium flex items-center transition"> Ler mais <i class="fas fa-arrow-right ml-2"></i> </a> </div> </div> <!-- News 3 --> <div class="bg-gray-700 rounded-lg overflow-hidden transition hover:shadow-lg"> <img src="https://images.unsplash.com/photo-1513828583688-c52646db42da?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1470&q=80" alt="Game News" class="w-full h-48 object-cover"> <div class="p-6"> <span class="text-purple-400 text-sm">05/06/2023</span> <h3 class="text-xl font-semibold mt-2 mb-3">Torneio de Football Legends com premiação de R$50.000</h3> <p class="text-gray-400 mb-4">Inscrições abertas para o maior torneio do jogo no Brasil. Participe e mostre suas habilidades!</p> <a href="#" class="text-purple-400 hover:text-purple-300 font-medium flex items-center transition"> Ler mais <i class="fas fa-arrow-right ml-2"></i> </a> </div> </div> </div> </div> </section> <!-- Newsletter --> <section class="py-16 px-6"> <div class="container mx-auto max-w-4xl bg-gray-800 rounded-lg p-8 text-center"> <h2 class="text-3xl font-bold mb-4">Assine Nossa Newsletter</h2> <p class="text-gray-400 mb-8 max-w-2xl mx-auto">Receba as últimas notícias, lançamentos e promoções diretamente no seu e-mail.</p> <div class="flex flex-col sm:flex-row gap-4 max-w-md mx-auto"> <input type="email" placeholder="Seu melhor e-mail" class="flex-grow px-4 py-3 rounded-md bg-gray-700 text-white focus:outline-none focus:ring-2 focus:ring-purple-600"> <button class="bg-purple-600 hover:bg-purple-700 px-6 py-3 rounded-md font-semibold transition">Assinar</button> </div> </div> </section> <!-- Footer --> <footer class="bg-gray-800 py-12 px-6"> <div class="container mx-auto"> <div class="grid grid-cols-1 md:grid-cols-4 gap-8"> <div> <div class="flex items-center space-x-2 mb-4"> <i class="fas fa-gamepad text-2xl text-purple-500"></i> <span class="text-2xl font-bold text-transparent bg-clip-text bg-gradient-to-r from-purple-400 to-pink-600">GameHub</span> </div> <p class="text-gray-400">Seu portal definitivo para o mundo dos jogos. Encontre os melhores títulos, notícias e muito mais.</p> <div class="flex space-x-4 mt-6"> <a href="#" class="text-gray-400 hover:text-purple-400 transition"><i class="fab fa-facebook-f"></i></a> <a href="#" class="text-gray-400 hover:text-purple-400 transition"><i class="fab fa-twitter"></i></a> <a href="#" class="text-gray-400 hover:text-purple-400 transition"><i class="fab fa-instagram"></i></a> <a href="#" class="text-gray-400 hover:text-purple-400 transition"><i class="fab fa-discord"></i></a> </div> </div> <div> <h3 class="text-xl font-semibold mb-4">Links Rápidos</h3> <ul class="space-y-2"> <li><a href="#" class="text-gray-400 hover:text-purple-400 transition">Início</a></li> <li><a href="#featured" class="text-gray-400 hover:text-purple-400 transition">Jogos</a></li> <li><a href="#online-games" class="text-gray-400 hover:text-purple-400 transition">Jogar Online</a></li> <li><a href="#news" class="text-gray-400 hover:text-purple-400 transition">Notícias</a></li> <li><a href="#" class="text-gray-400 hover:text-purple-400 transition">Contato</a></li> </ul> </div> <div> <h3 class="text-xl font-semibold mb-4">Categorias</h3> <ul class="space-y-2"> <li><a href="#" class="text-gray-400 hover:text-purple-400 transition">Ação</a></li> <li><a href="#" class="text-gray-400 hover:text-purple-400 transition">Aventura</a></li> <li><a href="#" class="text-gray-400 hover:text-purple-400 transition">RPG</a></li> <li><a href="#" class="text-gray-400 hover:text-purple-400 transition">Esportes</a></li> <li><a href="#" class="text-gray-400 hover:text-purple-400 transition">Estratégia</a></li> </ul> </div> <div> <h3 class="text-xl font-semibold mb-4">Contato</h3> <ul class="space-y-2 text-gray-400"> <li class="flex items-start"> <i class="fas fa-map-marker-alt mt-1 mr-3 text-purple-400"></i> <span>Av. dos Jogos, 1234 - São Paulo, SP</span> </li> <li class="flex items-center"> <i class="fas fa-phone-alt mr-3 text-purple-400"></i> <span>(11) 9876-5432</span> </li> <li class="flex items-center"> <i class="fas fa-envelope mr-3 text-purple-400"></i> <span>contato@gamehub.com</span> </li> </ul> </div> </div> <div class="border-t border-gray-700 mt-12 pt-8 text-center text-gray-400"> <p>&copy; 2023 GameHub. Todos os direitos reservados.</p> </div> </div> </footer> <script> // Mobile menu toggle const mobileMenuButton = document.getElementById('mobile-menu-button'); const mobileMenu = document.getElementById('mobile-menu'); mobileMenuButton.addEventListener('click', () => { mobileMenu.classList.toggle('hidden'); }); // Game tabs navigation const tabButtons = document.querySelectorAll('.game-nav-btn'); const tabs = document.querySelectorAll('.game-tab'); tabButtons.forEach(button => { button.addEventListener('click', () => { // Remove active class from all buttons and tabs tabButtons.forEach(btn => btn.classList.remove('active')); tabs.forEach(tab => tab.classList.remove('active')); // Add active class to clicked button and corresponding tab button.classList.add('active'); const tabId = button.getAttribute('data-tab'); document.getElementById(tabId).classList.add('active'); }); }); // Snake Game const snakeCanvas = document.getElementById('snake-canvas'); const snakeCtx = snakeCanvas.getContext('2d'); const startSnakeBtn = document.getElementById('start-snake'); const pauseSnakeBtn = document.getElementById('pause-snake'); const resetSnakeBtn = document.getElementById('reset-snake'); const snakeOverlay = document.getElementById('snake-overlay'); // Set canvas size snakeCanvas.width = snakeCanvas.parentElement.clientWidth; snakeCanvas.height = snakeCanvas.parentElement.clientHeight; // Game variables let snakeGameRunning = false; let snakeGamePaused = false; let snake = []; let food = {}; let direction = 'right'; let nextDirection = 'right'; let score = 0; let gameSpeed = 150; let gameLoop; // Initialize snake function initSnake() { snake = [ {x: 10, y: 10}, {x: 9, y: 10}, {x: 8, y: 10} ]; direction = 'right'; nextDirection = 'right'; score = 0; placeFood(); } // Place food at random position function placeFood() { const gridSize = 20; const cols = Math.floor(snakeCanvas.width / gridSize); const rows = Math.floor(snakeCanvas.height / gridSize); food = { x: Math.floor(Math.random() * cols), y: Math.floor(Math.random() * rows) }; // Make sure food doesn't appear on snake for (let segment of snake) { if (segment.x === food.x && segment.y === food.y) { return placeFood(); } } } // Draw everything function draw() { // Clear canvas snakeCtx.fillStyle = '#111827'; snakeCtx.fillRect(0, 0, snakeCanvas.width, snakeCanvas.height); // Draw snake snake.forEach((segment, index) => { if (index === 0) { snakeCtx.fillStyle = '#4c1d95'; // Head color } else { snakeCtx.fillStyle = '#7c3aed'; // Body color } snakeCtx.fillRect( segment.x * 20, segment.y * 20, 18, 18 ); // Add eyes to head if (index === 0) { snakeCtx.fillStyle = 'white'; // Eye positions based on direction if (direction === 'right') { snakeCtx.fillRect(segment.x * 20 + 12, segment.y * 20 + 4, 4, 4); snakeCtx.fillRect(segment.x * 20 + 12, segment.y * 20 + 12, 4, 4); } else if (direction === 'left') { snakeCtx.fillRect(segment.x * 20 + 2, segment.y * 20 + 4, 4, 4); snakeCtx.fillRect(segment.x * 20 + 2, segment.y * 20 + 12, 4, 4); } else if (direction === 'up') { snakeCtx.fillRect(segment.x * 20 + 4, segment.y * 20 + 2, 4, 4); snakeCtx.fillRect(segment.x * 20 + 12, segment.y * 20 + 2, 4, 4); } else if (direction === 'down') { snakeCtx.fillRect(segment.x * 20 + 4, segment.y * 20 + 12, 4, 4); snakeCtx.fillRect(segment.x * 20 + 12, segment.y * 20 + 12, 4, 4); } } }); // Draw food snakeCtx.fillStyle = '#10b981'; snakeCtx.beginPath(); snakeCtx.arc( food.x * 20 + 9, food.y * 20 + 9, 8, 0, Math.PI * 2 ); snakeCtx.fill(); // Draw score snakeCtx.fillStyle = 'white'; snakeCtx.font = '16px Arial'; snakeCtx.fillText(`Pontuação: ${score}`, 10, 20); } // Game loop function gameUpdate() { if (snakeGamePaused) return; // Move snake const head = {x: snake[0].x, y: snake[0].y}; direction = nextDirection; switch (direction) { case 'up': head.y -= 1; break; case 'down': head.y += 1; break; case 'left': head.x -= 1; break; case 'right': head.x += 1; break; } // Check collision with walls const gridSize = 20; const cols = Math.floor(snakeCanvas.width / gridSize); const rows = Math.floor(snakeCanvas.height / gridSize); if (head.x < 0 || head.x >= cols || head.y < 0 || head.y >= rows) { gameOver(); return; } // Check collision with self for (let i = 0; i < snake.length; i++) { if (head.x === snake[i].x && head.y === snake[i].y) { gameOver(); return; } } // Check if snake ate food if (head.x === food.x && head.y === food.y) { score += 10; placeFood(); } else { // Remove tail if no food was eaten snake.pop(); } // Add new head snake.unshift(head); draw(); } // Game over function gameOver() { clearInterval(gameLoop); snakeGameRunning = false; snakeOverlay.style.display = 'flex'; snakeOverlay.innerHTML = ` <h3 class="text-2xl font-bold mb-4">Game Over</h3> <p class="mb-6">Sua pontuação: ${score}</p> <button class="game-btn" id="restart-snake">Jogar Novamente</button> `; document.getElementById('restart-snake').addEventListener('click', startSnakeGame); } // Start game function startSnakeGame() { snakeOverlay.style.display = 'none'; initSnake(); draw(); snakeGameRunning = true; snakeGamePaused = false; gameLoop = setInterval(gameUpdate, gameSpeed); } // Pause game function pauseSnakeGame() { if (!snakeGameRunning) return; snakeGamePaused = !snakeGamePaused; pauseSnakeBtn.textContent = snakeGamePaused ? 'Continuar' : 'Pausar'; } // Reset game function resetSnakeGame() { clearInterval(gameLoop); snakeGameRunning = false; snakeOverlay.style.display = 'flex'; snakeOverlay.innerHTML = ` <h3 class="text-2xl font-bold mb-4">Snake Game</h3> <p class="mb-6">Use as teclas de seta para controlar a cobra. Colete a comida para crescer!</p> <button class="game-btn" id="start-snake">Iniciar Jogo</button> `; document.getElementById('start-snake').addEventListener('click', startSnakeGame); } // Event listeners startSnakeBtn.addEventListener('click', startSnakeGame); pauseSnakeBtn.addEventListener('click', pauseSnakeGame); resetSnakeBtn.addEventListener('click', resetSnakeGame); // Keyboard controls document.addEventListener('keydown', (e) => { if (!snakeGameRunning) return; switch (e.key) { case 'ArrowUp': if (direction !== 'down') nextDirection = 'up'; break; case 'ArrowDown': if (direction !== 'up') nextDirection = 'down'; break; case 'ArrowLeft': if (direction !== 'right') nextDirection = 'left'; break; case 'ArrowRight': if (direction !== 'left') nextDirection = 'right'; break; case ' ': pauseSnakeGame(); break; } }); // Memory Game const memoryBoard = document.getElementById('memory-board'); const startMemoryBtn = document.getElementById('start-memory'); const resetMemoryBtn = document.getElementById('reset-memory'); const memoryTimer = document.getElementById('memory-timer'); const memoryMoves = document.getElementById('memory-moves'); const memoryOverlay = document.getElementById('memory-overlay'); let memoryGameRunning = false; let cards = []; let flippedCards = []; let matchedPairs = 0; let moves = 0; let timer = 0; let timerInterval; const emojis = ['🐶', '🐱', '🐭', '🐹', '🐰', '🦊', '🐻', '🐼', '🐨', '🐯', '🦁', '🐮']; // Initialize game function initMemoryGame() { // Create pairs of cards let gameEmojis = [...emojis].slice(0, 8); // Use first 8 emojis for 16 cards (8 pairs) gameEmojis = [...gameEmojis, ...gameEmojis]; // Duplicate for pairs // Shuffle cards gameEmojis = gameEmojis.sort(() => Math.random() - 0.5); // Create card elements memoryBoard.innerHTML = ''; cards = []; flippedCards = []; matchedPairs = 0; moves = 0; timer = 0; memoryMoves.textContent = `Movimentos: ${moves}`; memoryTimer.textContent = `Tempo: ${timer}s`; gameEmojis.forEach((emoji, index) => { const card = document.createElement('div'); card.className = 'memory-card'; card.dataset.index = index; card.dataset.value = emoji; card.textContent = emoji; card.addEventListener('click', flipCard); memoryBoard.appendChild(card); cards.push(card); }); } // Flip card function flipCard() { if (!memoryGameRunning || flippedCards.length >= 2 || this.classList.contains('flipped')) return; this.classList.add('flipped'); flippedCards.push(this); if (flippedCards.length === 2) { moves++; memoryMoves.textContent = `Movimentos: ${moves}`; checkForMatch(); } } // Check for match function checkForMatch() { const [card1, card2] = flippedCards; if (card1.dataset.value === card2.dataset.value) { // Match found card1.classList.add('matched'); card2.classList.add('matched'); matchedPairs++; if (matchedPairs === 8) { gameWon(); } flippedCards = []; } else { // No match setTimeout(() => { card1.classList.remove('flipped'); card2.classList.remove('flipped'); flippedCards = []; }, 1000); } } // Game won function gameWon() { clearInterval(timerInterval); memoryGameRunning = false; memoryOverlay.style.display = 'flex'; memoryOverlay.innerHTML = ` <h3 class="text-2xl font-bold mb-4">Parabéns!</h3> <p class="mb-2">Você completou o jogo em ${timer} segundos</p> <p class="mb-6">com ${moves} movimentos</p> <button class="game-btn" id="restart-memory">Jogar Novamente</button> `; document.getElementById('restart-memory').addEventListener('click', startMemoryGame); } // Start timer function startTimer() { timer = 0; memoryTimer.textContent = `Tempo: ${timer}s`; timerInterval = setInterval(() => { timer++; memoryTimer.textContent = `Tempo: ${timer}s`; }, 1000); } // Start game function startMemoryGame() { memoryOverlay.style.display = 'none'; initMemoryGame(); memoryGameRunning = true; startTimer(); } // Reset game function resetMemoryGame() { clearInterval(timerInterval); memoryGameRunning = false; memoryOverlay.style.display = 'flex'; memoryOverlay.innerHTML = ` <h3 class="text-2xl font-bold mb-4">Jogo da Memória</h3> <p class="mb-6">Encontre todos os pares de cartas no menor tempo possível!</p> <button class="game-btn" id="start-memory">Iniciar Jogo</button> `; document.getElementById('start-memory').addEventListener('click', startMemoryGame); } // Event listeners startMemoryBtn.addEventListener('click', startMemoryGame); resetMemoryBtn.addEventListener('click', resetMemoryGame); // Flappy Bird Game const flappyCanvas = document.getElementById('flappy-canvas'); const flappyCtx = flappyCanvas.getContext('2d'); const startFlappyBtn = document.getElementById('start-flappy'); const resetFlappyBtn = document.getElementById('reset-flappy'); const flappyScore = document.getElementById('flappy-score'); const flappyOverlay = document.getElementById('flappy-overlay'); // Set canvas size flappyCanvas.width = flappyCanvas.parentElement.clientWidth; flappyCanvas.height = flappyCanvas.parentElement.clientHeight; // Game variables let flappyGameRunning = false; let bird = { x: 50, y: 150, width: 30, height: 30, velocity: 0, gravity: 0.5, jump: -10 }; let pipes = []; let pipeWidth = 60; let pipeGap = 150; let pipeFrequency = 120; let frameCount = 0; let scoreFlappy = 0; let flappyGameLoop; // Draw bird function drawBird() { flappyCtx.fillStyle = '#fbbf24'; flappyCtx.beginPath(); flappyCtx.arc( bird.x + bird.width / 2, bird.y + bird.height / 2, bird.width / 2, 0, Math.PI * 2 ); flappyCtx.fill(); // Draw eye flappyCtx.fillStyle = 'white'; flappyCtx.beginPath(); flappyCtx.arc( bird.x + bird.width / 2 + 5, bird.y + bird.height / 2 - 5, 3, 0, Math.PI * 2 ); flappyCtx.fill(); // Draw beak flappyCtx.fillStyle = '#f59e0b'; flappyCtx.beginPath(); flappyCtx.moveTo(bird.x + bird.width, bird.y + bird.height / 2); flappyCtx.lineTo(bird.x + bird.width + 10, bird.y + bird.height / 2 + 5); flappyCtx.lineTo(bird.x + bird.width + 10, bird.y + bird.height / 2 - 5); flappyCtx.closePath(); flappyCtx.fill(); } // Draw pipes function drawPipes() { flappyCtx.fillStyle = '#10b981'; pipes.forEach(pipe => { // Top pipe flappyCtx.fillRect(pipe.x, 0, pipeWidth, pipe.topHeight); // Bottom pipe flappyCtx.fillRect( pipe.x, pipe.topHeight + pipeGap, pipeWidth, flappyCanvas.height - pipe.topHeight - pipeGap ); }); } // Update game state function updateFlappy() { // Clear canvas flappyCtx.fillStyle = '#4b5563'; flappyCtx.fillRect(0, 0, flappyCanvas.width, flappyCanvas.height); // Update bird bird.velocity += bird.gravity; bird.y += bird.velocity; // Check for collisions with ground or ceiling if (bird.y + bird.height > flappyCanvas.height || bird.y < 0) { gameOverFlappy(); return; } // Generate new pipes if (frameCount % pipeFrequency === 0) { const topHeight = Math.floor(Math.random() * (flappyCanvas.height - pipeGap - 100)) + 50; pipes.push({ x: flappyCanvas.width, topHeight: topHeight, passed: false }); } // Update pipes for (let i = pipes.length - 1; i >= 0; i--) { pipes[i].x -= 2; // Check for collision with bird if ( bird.x < pipes[i].x + pipeWidth && bird.x + bird.width > pipes[i].x && (bird.y < pipes[i].topHeight || bird.y + bird.height > pipes[i].topHeight + pipeGap) ) { gameOverFlappy(); return; } // Check if bird passed the pipe if (!pipes[i].passed && bird.x > pipes[i].x + pipeWidth) { pipes[i].passed = true; scoreFlappy++; flappyScore.textContent = `Pontuação: ${scoreFlappy}`; } // Remove pipes that are off screen if (pipes[i].x < -pipeWidth) { pipes.splice(i, 1); } } // Draw everything drawPipes(); drawBird(); frameCount++; flappyGameLoop = requestAnimationFrame(updateFlappy); } // Game over function gameOverFlappy() { cancelAnimationFrame(flappyGameLoop); flappyGameRunning = false; flappyOverlay.style.display = 'flex'; flappyOverlay.innerHTML = ` <h3 class="text-2xl font-bold mb-4">Game Over</h3> <p class="mb-6">Sua pontuação: ${scoreFlappy}</p> <button class="game-btn" id="restart-flappy">Jogar Novamente</button> `; document.getElementById('restart-flappy').addEventListener('click', startFlappyGame); } // Start game function startFlappyGame() { flappyOverlay.style.display = 'none'; bird = { x: 50, y: 150, width: 30, height: 30, velocity: 0, gravity: 0.5, jump: -10 }; pipes = []; frameCount = 0; scoreFlappy = 0; flappyScore.textContent = `Pontuação: ${scoreFlappy}`; flappyGameRunning = true; flappyGameLoop = requestAnimationFrame(updateFlappy); } // Reset game function resetFlappyGame() { cancelAnimationFrame(flappyGameLoop); flappyGameRunning = false; flappyOverlay.style.display = 'flex'; flappyOverlay.innerHTML = ` <h3 class="text-2xl font-bold mb-4">Flappy Bird</h3> <p class="mb-6">Pressione qualquer tecla ou clique para fazer o pássaro voar e desviar dos obstáculos!</p> <button class="game-btn" id="start-flappy">Iniciar Jogo</button> `; document.getElementById('start-flappy').addEventListener('click', startFlappyGame); } // Event listeners startFlappyBtn.addEventListener('click', startFlappyGame); resetFlappyBtn.addEventListener('click', resetFlappyGame); // Jump on click or key press flappyCanvas.addEventListener('click', () => { if (flappyGameRunning) { bird.velocity = bird.jump; } }); document.addEventListener('keydown', (e) => { if (flappyGameRunning && (e.key === ' ' || e.key === 'ArrowUp')) { bird.velocity = bird.jump; } }); // Initialize all games in reset state resetSnakeGame(); resetMemoryGame(); resetFlappyGame(); </script> <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=les777/sim" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body> </html>
<!DOCTYPE html>
<html lang="pt-BR">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>GameHub - Jogue Online</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
.game-card:hover {
transform: translateY(-5px);
box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}
.hero {
background: linear-gradient(rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.7)), url('https://images.unsplash.com/photo-1542751375-ad40-4d01-87d7-b52b8a8a2acf?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1470&q=80');
background-size: cover;
background-position: center;
}
/* Estilos para os jogos */
.game-container {
position: relative;
width: 100%;
height: 400px;
background-color: #1f2937;
border-radius: 8px;
overflow: hidden;
}
#snake-game, #memory-game, #flappy-game {
width: 100%;
height: 100%;
}
.game-overlay {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.8);
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
color: white;
z-index: 10;
}
.game-controls {
position: absolute;
bottom: 20px;
left: 0;
width: 100%;
display: flex;
justify-content: center;
gap: 10px;
z-index: 5;
}
.game-btn {
background: rgba(124, 58, 237, 0.7);
color: white;
border: none;
padding: 8px 16px;
border-radius: 4px;
cursor: pointer;
transition: all 0.3s;
}
.game-btn:hover {
background: rgba(124, 58, 237, 1);
}
.game-tab {
display: none;
}
.game-tab.active {
display: block;
}
.game-nav {
display: flex;
justify-content: center;
margin-bottom: 20px;
gap: 10px;
}
.game-nav-btn {
background: #374151;
color: white;
border: none;
padding: 10px 20px;
border-radius: 4px;
cursor: pointer;
transition: all 0.3s;
}
.game-nav-btn.active {