cutechicken commited on
Commit
46e5238
·
verified ·
1 Parent(s): 6c68e4b

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +7 -3
index.html CHANGED
@@ -341,7 +341,7 @@ function buyTank(tankImg, cost, tankId) {
341
  items = [];
342
  startCountdown();
343
  }
344
- function startBossStage() {
345
  isBossStage = true;
346
  enemies = [];
347
  enemies.push(new Enemy(true));
@@ -349,6 +349,7 @@ function buyTank(tankImg, cost, tankId) {
349
  bullets = [];
350
  items = [];
351
  document.getElementById('bossButton').style.display = 'none';
 
352
  startCountdown();
353
  }
354
  canvas.addEventListener('mousemove', (e) => {
@@ -456,7 +457,7 @@ function buyTank(tankImg, cost, tankId) {
456
  }
457
  return true;
458
  });
459
- if(enemies.length === 0) {
460
  if (!isBossStage) {
461
  if(currentRound < 10) {
462
  nextRoundBtn.style.display = 'block';
@@ -468,7 +469,9 @@ function buyTank(tankImg, cost, tankId) {
468
  gameOver = true;
469
  document.getElementById('winMessage').style.display = 'block';
470
  restartBtn.style.display = 'block';
471
- bgm.pause();
 
 
472
  }
473
  }
474
  }
@@ -577,6 +580,7 @@ restartBtn.addEventListener('click', () => {
577
  document.getElementById('tank1').style.display = 'block';
578
  document.getElementById('tank2').style.display = 'block';
579
  playerImg.src = 'player.png';
 
580
  bgm.play();
581
  initRound();
582
  });
 
341
  items = [];
342
  startCountdown();
343
  }
344
+ function startBossStage() {
345
  isBossStage = true;
346
  enemies = [];
347
  enemies.push(new Enemy(true));
 
349
  bullets = [];
350
  items = [];
351
  document.getElementById('bossButton').style.display = 'none';
352
+ bgm.src = 'BGM.ogg'; // 보스전 BGM으로 변경
353
  startCountdown();
354
  }
355
  canvas.addEventListener('mousemove', (e) => {
 
457
  }
458
  return true;
459
  });
460
+ if(enemies.length === 0) {
461
  if (!isBossStage) {
462
  if(currentRound < 10) {
463
  nextRoundBtn.style.display = 'block';
 
469
  gameOver = true;
470
  document.getElementById('winMessage').style.display = 'block';
471
  restartBtn.style.display = 'block';
472
+ bgm.pause(); // 현재 BGM 정지
473
+ const victorySound = new Audio('victory.ogg'); // 승리 사운드 생성
474
+ victorySound.play(); // 승리 사운드 재생
475
  }
476
  }
477
  }
 
580
  document.getElementById('tank1').style.display = 'block';
581
  document.getElementById('tank2').style.display = 'block';
582
  playerImg.src = 'player.png';
583
+ bgm.src = 'BGM2.ogg'; // 기본 BGM으로 복귀
584
  bgm.play();
585
  initRound();
586
  });