Jocaa91 commited on
Commit
e95ed5f
·
verified ·
1 Parent(s): 5eecde7

Add a sound to set the mood - Follow Up Deployment

Browse files
Files changed (1) hide show
  1. index.html +27 -2
index.html CHANGED
@@ -42,7 +42,8 @@
42
  </style>
43
  </head>
44
  <body class="bg-gradient-to-br from-blue-50 to-indigo-100 min-h-screen">
45
- <!-- Audio elements for sound effects -->
 
46
  <audio id="tickSound" src="https://assets.mixkit.co/sfx/preview/mixkit-clock-countdown-bleeps-916.mp3" preload="auto"></audio>
47
  <audio id="stopSound" src="https://assets.mixkit.co/sfx/preview/mixkit-game-show-suspense-waiting-668.mp3" preload="auto"></audio>
48
  <audio id="correctSound" src="https://assets.mixkit.co/sfx/preview/mixkit-correct-answer-tone-2870.mp3" preload="auto"></audio>
@@ -53,11 +54,17 @@
53
  <header class="text-center mb-8">
54
  <h1 class="text-4xl md:text-5xl font-bold text-indigo-800 mb-2">STOP!</h1>
55
  <p class="text-lg text-indigo-600">The Ultimate Word Challenge Game</p>
 
 
 
 
 
 
56
  </header>
57
 
58
  <!-- Game Setup Modal -->
59
  <div id="setupModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 px-4">
60
- <div class="bg-white rounded-xl shadow-2xl p-6 w-full max-w-md">
61
  <h2 class="text-2xl font-bold text-indigo-800 mb-4">Game Setup</h2>
62
 
63
  <div class="mb-6">
@@ -320,6 +327,18 @@
320
 
321
  // Initialize the game
322
  document.addEventListener('DOMContentLoaded', () => {
 
 
 
 
 
 
 
 
 
 
 
 
323
  // Set up event listeners for input fields
324
  document.querySelectorAll('.category-input').forEach(input => {
325
  input.addEventListener('keypress', function(e) {
@@ -396,6 +415,9 @@
396
  }
397
 
398
  function startGame() {
 
 
 
399
  // Get player names
400
  gameState.players = [];
401
  const playerNames = document.querySelectorAll('.player-name');
@@ -447,6 +469,9 @@
447
  }
448
 
449
  function resetGame() {
 
 
 
450
  winnerModal.classList.add('hidden');
451
  showSetupModal();
452
  }
 
42
  </style>
43
  </head>
44
  <body class="bg-gradient-to-br from-blue-50 to-indigo-100 min-h-screen">
45
+ <!-- Audio elements for sound effects and music -->
46
+ <audio id="bgMusic" loop src="https://assets.mixkit.co/music/preview/mixkit-game-show-suspense-waiting-668.mp3" preload="auto"></audio>
47
  <audio id="tickSound" src="https://assets.mixkit.co/sfx/preview/mixkit-clock-countdown-bleeps-916.mp3" preload="auto"></audio>
48
  <audio id="stopSound" src="https://assets.mixkit.co/sfx/preview/mixkit-game-show-suspense-waiting-668.mp3" preload="auto"></audio>
49
  <audio id="correctSound" src="https://assets.mixkit.co/sfx/preview/mixkit-correct-answer-tone-2870.mp3" preload="auto"></audio>
 
54
  <header class="text-center mb-8">
55
  <h1 class="text-4xl md:text-5xl font-bold text-indigo-800 mb-2">STOP!</h1>
56
  <p class="text-lg text-indigo-600">The Ultimate Word Challenge Game</p>
57
+ <a href="path/to/game.apk" class="mt-4 inline-block bg-green-600 hover:bg-green-700 text-white font-bold py-2 px-4 rounded-lg transition">
58
+ <i class="fas fa-download mr-2"></i> Download Android App
59
+ </a>
60
+ <button id="musicToggle" class="mt-4 ml-4 inline-block bg-purple-600 hover:bg-purple-700 text-white font-bold py-2 px-4 rounded-lg transition">
61
+ <i class="fas fa-music mr-2"></i> Toggle Music
62
+ </button>
63
  </header>
64
 
65
  <!-- Game Setup Modal -->
66
  <div id="setupModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 px-4">
67
+ <div class="bg-white rounded-xl shadow-2xl p-6 w-full max-w-md max-h-[80vh] overflow-y-auto">
68
  <h2 class="text-2xl font-bold text-indigo-800 mb-4">Game Setup</h2>
69
 
70
  <div class="mb-6">
 
327
 
328
  // Initialize the game
329
  document.addEventListener('DOMContentLoaded', () => {
330
+ // Set up music toggle
331
+ const musicToggle = document.getElementById('musicToggle');
332
+ const bgMusic = document.getElementById('bgMusic');
333
+ musicToggle.addEventListener('click', () => {
334
+ if (bgMusic.paused) {
335
+ bgMusic.play();
336
+ musicToggle.innerHTML = '<i class="fas fa-music mr-2"></i> Pause Music';
337
+ } else {
338
+ bgMusic.pause();
339
+ musicToggle.innerHTML = '<i class="fas fa-music mr-2"></i> Play Music';
340
+ }
341
+ });
342
  // Set up event listeners for input fields
343
  document.querySelectorAll('.category-input').forEach(input => {
344
  input.addEventListener('keypress', function(e) {
 
415
  }
416
 
417
  function startGame() {
418
+ // Start background music
419
+ document.getElementById('bgMusic').play();
420
+ document.getElementById('musicToggle').innerHTML = '<i class="fas fa-music mr-2"></i> Pause Music';
421
  // Get player names
422
  gameState.players = [];
423
  const playerNames = document.querySelectorAll('.player-name');
 
469
  }
470
 
471
  function resetGame() {
472
+ // Pause background music when resetting
473
+ document.getElementById('bgMusic').pause();
474
+ document.getElementById('musicToggle').innerHTML = '<i class="fas fa-music mr-2"></i> Play Music';
475
  winnerModal.classList.add('hidden');
476
  showSetupModal();
477
  }