Cat game

Hehehehehe
mail@pastecode.io avatar
unknown
html
2 months ago
835 B
2
Indexable
Never
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Cat Game</title>
  <style>
    body {
      font-family: Arial, sans-serif;
      text-align: center;
    }
    #cat {
      width: 200px;
    }
  </style>
</head>
<body>
  <h1>Cat Clicker Game</h1>
  <img id="cat" src="cat.jpg" alt="Cat">
  <p>Clicks: <span id="clicks">0</span></p>
  <button onclick="handleClick()">Click me!</button>

  <script>
    let clicks = 0;

    function handleClick() {
      clicks++;
      document.getElementById('clicks').textContent = clicks;
      let catSound = Math.random() < 0.5 ? 'meow' : 'purr';
      let sound = new Audio(catSound + '.mp3'); // Assuming you have meow.mp3 and purr.mp3 files
      sound.play();
    }
  </script>
</body>
</html>
Leave a Comment