cutechicken commited on
Commit
7dea432
Β·
verified Β·
1 Parent(s): 0030a47

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +45 -38
index.html CHANGED
@@ -224,6 +224,7 @@
224
  let warningLines = [];
225
  let spitfires = [];
226
  let lastSpitfireSpawn = 0;
 
227
 
228
  // Load assets
229
  const backgroundImg = new Image();
@@ -399,44 +400,50 @@
399
  }, 3000);
400
  }
401
  }
402
- function checkRoundClear() {
403
- if(enemies.length === 0) {
404
- console.log(`Checking round clear: Current round ${currentRound}, Boss stage: ${isBossStage}`);
405
-
406
- // ν•˜λ‚˜μ˜ λžœλ€ν•œ μŒμ„±λ§Œ μž¬μƒ
407
- if (!isBossStage) {
408
- const voiceFiles = ['voice1.ogg', 'voice2.ogg', 'voice3.ogg', 'voice4.ogg', 'voice5.ogg', 'voice6.ogg'];
409
- const randomIndex = Math.floor(Math.random() * voiceFiles.length);
410
- const randomVoice = new Audio(voiceFiles[randomIndex]);
411
- randomVoice.volume = 1.0;
412
- randomVoice.play();
413
- }
414
-
415
- if (!isBossStage) {
416
- if(currentRound < 10) {
417
- console.log('Normal round clear - showing next round button and shop');
418
- nextRoundBtn.style.display = 'block';
419
- document.getElementById('bossButton').style.display = 'none';
420
- showShop();
421
- } else {
422
- console.log('Final round clear - showing boss button');
423
- nextRoundBtn.style.display = 'none';
424
- document.getElementById('bossButton').style.display = 'block';
425
- document.getElementById('shop').style.display = 'none';
426
- }
427
- } else {
428
- console.log('Boss clear - showing victory message');
429
- gameOver = true;
430
- document.getElementById('winMessage').style.display = 'block';
431
- document.getElementById('bossButton').style.display = 'none';
432
- nextRoundBtn.style.display = 'none';
433
- document.getElementById('shop').style.display = 'none';
434
- restartBtn.style.display = 'block';
435
- bgm.pause();
436
- const victorySound = new Audio('victory.ogg');
437
- victorySound.play();
438
- }
439
- }
 
 
 
 
 
 
440
  }
441
 
442
  function showShop() {
 
224
  let warningLines = [];
225
  let spitfires = [];
226
  let lastSpitfireSpawn = 0;
227
+ let currentVoice = null;
228
 
229
  // Load assets
230
  const backgroundImg = new Image();
 
400
  }, 3000);
401
  }
402
  }
403
+ function checkRoundClear() {
404
+ if(enemies.length === 0) {
405
+ console.log(`Checking round clear: Current round ${currentRound}, Boss stage: ${isBossStage}`);
406
+
407
+ // ν•˜λ‚˜μ˜ λžœλ€ν•œ μŒμ„±λ§Œ μž¬μƒ
408
+ if (!isBossStage) {
409
+ // 이전 μŒμ„±μ΄ μžˆλ‹€λ©΄ μ •μ§€
410
+ if (currentVoice) {
411
+ currentVoice.pause();
412
+ currentVoice.currentTime = 0;
413
+ }
414
+
415
+ const voiceFiles = ['voice1.ogg', 'voice2.ogg', 'voice3.ogg', 'voice4.ogg', 'voice5.ogg', 'voice6.ogg'];
416
+ const randomIndex = Math.floor(Math.random() * voiceFiles.length);
417
+ currentVoice = new Audio(voiceFiles[randomIndex]);
418
+ currentVoice.volume = 1.0;
419
+ currentVoice.play();
420
+ }
421
+
422
+ if (!isBossStage) {
423
+ if(currentRound < 10) {
424
+ console.log('Normal round clear - showing next round button and shop');
425
+ nextRoundBtn.style.display = 'block';
426
+ document.getElementById('bossButton').style.display = 'none';
427
+ showShop();
428
+ } else {
429
+ console.log('Final round clear - showing boss button');
430
+ nextRoundBtn.style.display = 'none';
431
+ document.getElementById('bossButton').style.display = 'block';
432
+ document.getElementById('shop').style.display = 'none';
433
+ }
434
+ } else {
435
+ console.log('Boss clear - showing victory message');
436
+ gameOver = true;
437
+ document.getElementById('winMessage').style.display = 'block';
438
+ document.getElementById('bossButton').style.display = 'none';
439
+ nextRoundBtn.style.display = 'none';
440
+ document.getElementById('shop').style.display = 'none';
441
+ restartBtn.style.display = 'block';
442
+ bgm.pause();
443
+ const victorySound = new Audio('victory.ogg');
444
+ victorySound.play();
445
+ }
446
+ }
447
  }
448
 
449
  function showShop() {