Spaces:
Running
Running
Update index.html
Browse files- index.html +75 -58
index.html
CHANGED
@@ -528,64 +528,81 @@
|
|
528 |
}
|
529 |
}
|
530 |
function checkRoundClear() {
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
589 |
}
|
590 |
|
591 |
function showShop() {
|
|
|
528 |
}
|
529 |
}
|
530 |
function checkRoundClear() {
|
531 |
+
if(enemies.length === 0) {
|
532 |
+
console.log(`Checking round clear: Current round ${currentRound}, Boss stage: ${isBossStage}`);
|
533 |
+
|
534 |
+
// νλμ λλ€ν μμ±λ§ μ¬μ
|
535 |
+
if (!isBossStage) {
|
536 |
+
// μ΄μ μμ±μ΄ μλ€λ©΄ μ μ§
|
537 |
+
if (currentVoice) {
|
538 |
+
currentVoice.pause();
|
539 |
+
currentVoice.currentTime = 0;
|
540 |
+
}
|
541 |
+
|
542 |
+
const voiceFiles = ['voice1.ogg', 'voice2.ogg', 'voice3.ogg', 'voice4.ogg', 'voice5.ogg', 'voice6.ogg'];
|
543 |
+
const randomIndex = Math.floor(Math.random() * voiceFiles.length);
|
544 |
+
currentVoice = new Audio(voiceFiles[randomIndex]);
|
545 |
+
currentVoice.volume = 1.0;
|
546 |
+
currentVoice.play();
|
547 |
+
}
|
548 |
+
|
549 |
+
if (currentStage === 3) {
|
550 |
+
if (currentRound === 10) {
|
551 |
+
// 10λΌμ΄λ λ³΄μ€ ν΄λ¦¬μ΄ ν λ€μ λΌμ΄λλ‘
|
552 |
+
nextRoundBtn.style.display = 'block';
|
553 |
+
showShop(); // μμ μ°½λ ν¨κ» νμ
|
554 |
+
} else if (currentRound === 20) {
|
555 |
+
// 20λΌμ΄λ λ³΄μ€ ν΄λ¦¬μ΄ ν κ²μ μΉλ¦¬
|
556 |
+
document.getElementById('winMessage').style.display = 'block';
|
557 |
+
restartBtn.style.display = 'block';
|
558 |
+
gameOver = true;
|
559 |
+
|
560 |
+
// λͺ¨λ μ€λμ€ μ μ§
|
561 |
+
bgm.pause();
|
562 |
+
bgm.currentTime = 0;
|
563 |
+
cannonSound.pause();
|
564 |
+
machinegunSound.pause();
|
565 |
+
enemyFireSound.pause();
|
566 |
+
countSound.pause();
|
567 |
+
deathSound.pause();
|
568 |
+
escapeSound.pause();
|
569 |
+
hitSounds.forEach(sound => { sound.pause(); sound.currentTime = 0; });
|
570 |
+
reloadSounds.forEach(sound => { sound.pause(); sound.currentTime = 0; });
|
571 |
+
|
572 |
+
// μΉλ¦¬ μ¬μ΄λ μ¬μ
|
573 |
+
const victorySound = new Audio('victory.ogg');
|
574 |
+
victorySound.volume = 1.0;
|
575 |
+
victorySound.play();
|
576 |
+
} else if (currentRound < 20) {
|
577 |
+
// μΌλ° λΌμ΄λ ν΄λ¦¬μ΄
|
578 |
+
nextRoundBtn.style.display = 'block';
|
579 |
+
showShop();
|
580 |
+
}
|
581 |
+
} else if (!isBossStage) {
|
582 |
+
if(currentRound < 10) {
|
583 |
+
console.log('Normal round clear - showing next round button and shop');
|
584 |
+
nextRoundBtn.style.display = 'block';
|
585 |
+
document.getElementById('bossButton').style.display = 'none';
|
586 |
+
showShop();
|
587 |
+
} else {
|
588 |
+
console.log('Final round clear - showing boss button');
|
589 |
+
nextRoundBtn.style.display = 'none';
|
590 |
+
document.getElementById('bossButton').style.display = 'block';
|
591 |
+
document.getElementById('shop').style.display = 'none';
|
592 |
+
}
|
593 |
+
} else {
|
594 |
+
console.log('Boss clear - showing victory message');
|
595 |
+
gameOver = true;
|
596 |
+
document.getElementById('winMessage').style.display = 'block';
|
597 |
+
document.getElementById('bossButton').style.display = 'none';
|
598 |
+
nextRoundBtn.style.display = 'none';
|
599 |
+
document.getElementById('shop').style.display = 'none';
|
600 |
+
restartBtn.style.display = 'block';
|
601 |
+
bgm.pause();
|
602 |
+
const victorySound = new Audio('victory.ogg');
|
603 |
+
victorySound.play();
|
604 |
+
}
|
605 |
+
}
|
606 |
}
|
607 |
|
608 |
function showShop() {
|