Untitled

 avatar
unknown
plain_text
a year ago
1.7 kB
4
Indexable
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Loja me mace</title>
  <style>
    body {
      display: flex;
      align-items: center;
      justify-content: center;
      height: 100vh;
      margin: 0;
      background-color: #f0f0f0;
      font-family: 'Arial', sans-serif;
    }

    #game-container {
      position: relative;
    }

    .mole {
      position: absolute;
      width: 50px;
      height: 50px;
      background-color: #6c757d;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      user-select: none;
    }
  </style>
</head>
<body>

<div id="game-container">
  <h1>Loja me mace !</h1>
  <p>Piket: <span id="score">0</span></p>
</div>

<script>
  let score = 0;
  const gameContainer = document.getElementById('game-container');

  function createMole() {
    const mole = document.createElement('div');
    mole.classList.add('mole');
    mole.style.left = Math.random() * (gameContainer.clientWidth - 50) + 'px';
    mole.style.top = Math.random() * (gameContainer.clientHeight - 50) + 'px';
    mole.textContent = '🐹';

    mole.addEventListener('click', () => {
      score++;
      updateScore();
      mole.remove();
      createMole();
    });

    gameContainer.appendChild(mole);
  }

  function updateScore() {
    const scoreElement = document.getElementById('score');
    scoreElement.textContent = score;
  }

  setInterval(createMole, 5000); 
</script>

</body>
</html>
Leave a Comment