Spaces:
Running
Running
Update game.js
Browse files
game.js
CHANGED
@@ -1032,6 +1032,24 @@ class Fighter {
|
|
1032 |
window.gameInstance.notifyMissilesOfFlare(flare);
|
1033 |
}
|
1034 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1035 |
|
1036 |
// νλ μ΄ λ°μ¬μ
|
1037 |
try {
|
@@ -1648,12 +1666,25 @@ class AIM9Missile {
|
|
1648 |
this.target.destroy();
|
1649 |
window.gameInstance.enemies.splice(enemyIndex, 1);
|
1650 |
window.gameInstance.score += 100;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1651 |
}
|
1652 |
}
|
|
|
|
|
1653 |
}
|
1654 |
-
|
1655 |
-
this.destroy();
|
1656 |
-
}
|
1657 |
|
1658 |
destroy() {
|
1659 |
if (this.mesh) {
|
@@ -2744,6 +2775,9 @@ class Game {
|
|
2744 |
|
2745 |
this.keys = { w: false, a: false, s: false, d: false, f: false, r: false };
|
2746 |
this.isStarted = false;
|
|
|
|
|
|
|
2747 |
|
2748 |
window.gameInstance = this;
|
2749 |
|
@@ -3230,6 +3264,24 @@ class Game {
|
|
3230 |
// κ²½κ³ μ μ
λ°μ΄νΈ
|
3231 |
this.fighter.updateWarningAudios();
|
3232 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3233 |
notifyMissilesOfFlare(flare) {
|
3234 |
// λͺ¨λ νμ± λ―Έμ¬μΌμκ² νλ μ΄ μ‘΄μ¬ μλ¦Ό
|
3235 |
const allMissiles = [];
|
@@ -4116,6 +4168,20 @@ if (ammoElement) {
|
|
4116 |
// μΆκ° λλ²κΉ
|
4117 |
console.log('Enemies remaining:', this.enemies.length);
|
4118 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4119 |
// else λΈλ‘ μ κ±° - μ μ΄ νκ΄΄λμ§ μμμΌλ©΄ μ무κ²λ νμ§ μμ
|
4120 |
|
4121 |
break; // νλμ ννμ νλμ μ λ§ λ§μΆ μ μμ
|
|
|
1032 |
window.gameInstance.notifyMissilesOfFlare(flare);
|
1033 |
}
|
1034 |
}
|
1035 |
+
console.log('Enemy deployed flares!');
|
1036 |
+
|
1037 |
+
// μ μ΄ νλ μ΄λ₯Ό μ¬μ©νμ λ μμ± μ¬μ (μΆκ°)
|
1038 |
+
if (window.gameInstance) {
|
1039 |
+
try {
|
1040 |
+
const flareVoice = new Audio('sounds/voice_flare_a.ogg');
|
1041 |
+
flareVoice.volume = 0.8;
|
1042 |
+
flareVoice.play().catch(e => {
|
1043 |
+
console.log('Flare voice failed to play:', e);
|
1044 |
+
});
|
1045 |
+
} catch (e) {
|
1046 |
+
console.log('Flare voice error:', e);
|
1047 |
+
}
|
1048 |
+
|
1049 |
+
// μλ§ νμ
|
1050 |
+
window.gameInstance.showSubtitle('The enemy evaded the missile using flares!', 4000);
|
1051 |
+
}
|
1052 |
+
}
|
1053 |
|
1054 |
// νλ μ΄ λ°μ¬μ
|
1055 |
try {
|
|
|
1666 |
this.target.destroy();
|
1667 |
window.gameInstance.enemies.splice(enemyIndex, 1);
|
1668 |
window.gameInstance.score += 100;
|
1669 |
+
// μ μ²μΉ μμ± μ¬μ (μΆκ°)
|
1670 |
+
try {
|
1671 |
+
const killVoice = new Audio('sounds/voice_kill_a.ogg');
|
1672 |
+
killVoice.volume = 0.8;
|
1673 |
+
killVoice.play().catch(e => {
|
1674 |
+
console.log('Kill voice failed to play:', e);
|
1675 |
+
});
|
1676 |
+
} catch (e) {
|
1677 |
+
console.log('Kill voice error:', e);
|
1678 |
+
}
|
1679 |
+
|
1680 |
+
// μλ§ νμ
|
1681 |
+
window.gameInstance.showSubtitle('Nice work, one enemy down. Keep going.', 4000);
|
1682 |
+
}
|
1683 |
}
|
1684 |
}
|
1685 |
+
|
1686 |
+
this.destroy();
|
1687 |
}
|
|
|
|
|
|
|
1688 |
|
1689 |
destroy() {
|
1690 |
if (this.mesh) {
|
|
|
2775 |
|
2776 |
this.keys = { w: false, a: false, s: false, d: false, f: false, r: false };
|
2777 |
this.isStarted = false;
|
2778 |
+
|
2779 |
+
// μμ± μ¬μ νλκ·Έ μΆκ°
|
2780 |
+
this.firstMissileVoicePlayed = false;
|
2781 |
|
2782 |
window.gameInstance = this;
|
2783 |
|
|
|
3264 |
// κ²½κ³ μ μ
λ°μ΄νΈ
|
3265 |
this.fighter.updateWarningAudios();
|
3266 |
}
|
3267 |
+
// 첫 λ²μ§Έ λ―Έμ¬μΌ λ°μ¬ μμλ§ μμ± μ¬μ
|
3268 |
+
if (!this.firstMissileVoicePlayed) {
|
3269 |
+
this.firstMissileVoicePlayed = true;
|
3270 |
+
|
3271 |
+
try {
|
3272 |
+
const missileVoice = new Audio('sounds/voice_missile_a.ogg');
|
3273 |
+
missileVoice.volume = 0.8;
|
3274 |
+
missileVoice.play().catch(e => {
|
3275 |
+
console.log('Missile voice failed to play:', e);
|
3276 |
+
});
|
3277 |
+
} catch (e) {
|
3278 |
+
console.log('Missile voice error:', e);
|
3279 |
+
}
|
3280 |
+
|
3281 |
+
// μλ§ νμ
|
3282 |
+
this.showSubtitle('Watch out the enemy missile.', 4000);
|
3283 |
+
}
|
3284 |
+
}
|
3285 |
notifyMissilesOfFlare(flare) {
|
3286 |
// λͺ¨λ νμ± λ―Έμ¬μΌμκ² νλ μ΄ μ‘΄μ¬ μλ¦Ό
|
3287 |
const allMissiles = [];
|
|
|
4168 |
// μΆκ° λλ²κΉ
|
4169 |
console.log('Enemies remaining:', this.enemies.length);
|
4170 |
}
|
4171 |
+
// μ μ²μΉ μμ± μ¬μ (μΆκ°)
|
4172 |
+
try {
|
4173 |
+
const killVoice = new Audio('sounds/voice_kill_a.ogg');
|
4174 |
+
killVoice.volume = 0.8;
|
4175 |
+
killVoice.play().catch(e => {
|
4176 |
+
console.log('Kill voice failed to play:', e);
|
4177 |
+
});
|
4178 |
+
} catch (e) {
|
4179 |
+
console.log('Kill voice error:', e);
|
4180 |
+
}
|
4181 |
+
|
4182 |
+
// μλ§ νμ
|
4183 |
+
this.showSubtitle('Nice work, one enemy down. Keep going.', 4000);
|
4184 |
+
}
|
4185 |
// else λΈλ‘ μ κ±° - μ μ΄ νκ΄΄λμ§ μμμΌλ©΄ μ무κ²λ νμ§ μμ
|
4186 |
|
4187 |
break; // νλμ ννμ νλμ μ λ§ λ§μΆ μ μμ
|