cutechicken commited on
Commit
187db19
Β·
verified Β·
1 Parent(s): 6cf2fb1

Update game.js

Browse files
Files changed (1) hide show
  1. game.js +69 -3
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; // ν•˜λ‚˜μ˜ νƒ„ν™˜μ€ ν•˜λ‚˜μ˜ 적만 맞좜 수 있음