openfree commited on
Commit
13219b7
·
verified ·
1 Parent(s): e2cebf5

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +9 -1
index.html CHANGED
@@ -157,6 +157,8 @@
157
  </style>
158
  </head>
159
  <body>
 
 
160
  <div id="startScreen">
161
  <h1 id="gameTitle">ZOMBIE SURVIVAL</h1>
162
  <button id="startButton">START GAME</button>
@@ -176,6 +178,7 @@
176
  const scoreElement = document.getElementById('score');
177
  const healthElement = document.getElementById('health');
178
  const gameOverElement = document.getElementById('gameOver');
 
179
 
180
  let score = 0;
181
  let health = 100;
@@ -197,6 +200,9 @@
197
  healthElement.textContent = `Health: ${health}`;
198
  gameOverElement.style.display = 'none';
199
 
 
 
 
200
  zombies.forEach(zombie => zombie.element.remove());
201
  zombies = [];
202
  bullets.forEach(bullet => bullet.element.remove());
@@ -342,6 +348,8 @@
342
  gameRunning = false;
343
  gameOverElement.style.display = 'block';
344
  clearInterval(zombieSpawnInterval);
 
 
345
  setTimeout(() => {
346
  startScreen.style.display = 'flex';
347
  }, 2000);
@@ -360,4 +368,4 @@
360
  updatePlayer();
361
  </script>
362
  </body>
363
- </html><script async data-explicit-opt-in="true" data-cookie-opt-in="true" src="https://vercel.live/_next-live/feedback/feedback.js"></script>
 
157
  </style>
158
  </head>
159
  <body>
160
+ <audio id="bgMusic" src="soundz.wav" loop></audio>
161
+
162
  <div id="startScreen">
163
  <h1 id="gameTitle">ZOMBIE SURVIVAL</h1>
164
  <button id="startButton">START GAME</button>
 
178
  const scoreElement = document.getElementById('score');
179
  const healthElement = document.getElementById('health');
180
  const gameOverElement = document.getElementById('gameOver');
181
+ const bgMusic = document.getElementById('bgMusic');
182
 
183
  let score = 0;
184
  let health = 100;
 
200
  healthElement.textContent = `Health: ${health}`;
201
  gameOverElement.style.display = 'none';
202
 
203
+ // Start background music
204
+ bgMusic.play();
205
+
206
  zombies.forEach(zombie => zombie.element.remove());
207
  zombies = [];
208
  bullets.forEach(bullet => bullet.element.remove());
 
348
  gameRunning = false;
349
  gameOverElement.style.display = 'block';
350
  clearInterval(zombieSpawnInterval);
351
+ bgMusic.pause();
352
+ bgMusic.currentTime = 0;
353
  setTimeout(() => {
354
  startScreen.style.display = 'flex';
355
  }, 2000);
 
368
  updatePlayer();
369
  </script>
370
  </body>
371
+ </html>