cutechicken commited on
Commit
4154032
ยท
verified ยท
1 Parent(s): 187db19

Update game.js

Browse files
Files changed (1) hide show
  1. game.js +57 -58
game.js CHANGED
@@ -3249,39 +3249,39 @@ class Game {
3249
  }
3250
 
3251
  // ์ ์ด ๋ฏธ์‚ฌ์ผ์„ ๋ฐœ์‚ฌํ–ˆ์„ ๋•Œ
3252
- onEnemyMissileLaunch(enemy, missile) {
3253
- console.log('Warning: Missile launched!');
3254
-
3255
- // ํ”Œ๋ ˆ์ด์–ด์˜ incoming missiles ๋ชฉ๋ก์— ์ถ”๊ฐ€
3256
- this.fighter.incomingMissiles.push(missile);
3257
-
3258
- // ๋ฝ์˜จ ๋ชฉ๋ก์—์„œ ์ œ๊ฑฐ (๋ฏธ์‚ฌ์ผ ๋ฐœ์‚ฌ ํ›„ ๋ฝ์˜จ ํ•ด์ œ)
3259
- const index = this.fighter.beingLockedBy.indexOf(enemy);
3260
- if (index !== -1) {
3261
- this.fighter.beingLockedBy.splice(index, 1);
3262
- }
3263
-
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 = [];
@@ -4152,36 +4152,35 @@ if (ammoElement) {
4152
  this.scene.remove(bullet);
4153
  this.fighter.bullets.splice(i, 1);
4154
 
4155
- // ๋ฐ๋ฏธ์ง€ ์ ์šฉ ๋ฐ ํŒŒ๊ดด ํ™•์ธ
4156
  if (enemy.takeDamage(GAME_CONSTANTS.BULLET_DAMAGE)) {
4157
- // ๋””๋ฒ„๊น…์šฉ ๋กœ๊ทธ ์ถ”๊ฐ€
4158
- console.log('Enemy destroyed! Creating explosion at:', explosionPosition);
4159
-
4160
- // ์ ๊ธฐ ํŒŒ๊ดด ์‹œ ํญ๋ฐœ ํšจ๊ณผ ์ถ”๊ฐ€ - ์ €์žฅ๋œ ์œ„์น˜ ์‚ฌ์šฉ
4161
- this.createExplosionEffect(explosionPosition);
4162
-
4163
- // ์ ๊ธฐ ์ œ๊ฑฐ - ์ฒด๋ ฅ์ด 0 ์ดํ•˜์ผ ๋•Œ๋งŒ ์ œ๊ฑฐ
4164
- enemy.destroy();
4165
- this.enemies.splice(j, 1);
4166
- this.score += 100;
4167
-
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; // ํ•˜๋‚˜์˜ ํƒ„ํ™˜์€ ํ•˜๋‚˜์˜ ์ ๋งŒ ๋งž์ถœ ์ˆ˜ ์žˆ์Œ
 
3249
  }
3250
 
3251
  // ์ ์ด ๋ฏธ์‚ฌ์ผ์„ ๋ฐœ์‚ฌํ–ˆ์„ ๋•Œ
3252
+ onEnemyMissileLaunch(enemy, missile) {
3253
+ console.log('Warning: Missile launched!');
3254
+
3255
+ // ํ”Œ๋ ˆ์ด์–ด์˜ incoming missiles ๋ชฉ๋ก์— ์ถ”๊ฐ€
3256
+ this.fighter.incomingMissiles.push(missile);
3257
+
3258
+ // ๋ฝ์˜จ ๋ชฉ๋ก์—์„œ ์ œ๊ฑฐ (๋ฏธ์‚ฌ์ผ ๋ฐœ์‚ฌ ํ›„ ๋ฝ์˜จ ํ•ด์ œ)
3259
+ const index = this.fighter.beingLockedBy.indexOf(enemy);
3260
+ if (index !== -1) {
3261
+ this.fighter.beingLockedBy.splice(index, 1);
 
 
 
 
3262
  }
3263
+
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 = [];
 
4152
  this.scene.remove(bullet);
4153
  this.fighter.bullets.splice(i, 1);
4154
 
 
4155
  if (enemy.takeDamage(GAME_CONSTANTS.BULLET_DAMAGE)) {
4156
+ // ๋””๋ฒ„๊น…์šฉ ๋กœ๊ทธ ์ถ”๊ฐ€
4157
+ console.log('Enemy destroyed! Creating explosion at:', explosionPosition);
4158
+
4159
+ // ์ ๊ธฐ ํŒŒ๊ดด ์‹œ ํญ๋ฐœ ํšจ๊ณผ ์ถ”๊ฐ€ - ์ €์žฅ๋œ ์œ„์น˜ ์‚ฌ์šฉ
4160
+ this.createExplosionEffect(explosionPosition);
4161
+
4162
+ // ์ ๊ธฐ ์ œ๊ฑฐ - ์ฒด๋ ฅ์ด 0 ์ดํ•˜์ผ ๋•Œ๋งŒ ์ œ๊ฑฐ
4163
+ enemy.destroy();
4164
+ this.enemies.splice(j, 1);
4165
+ this.score += 100;
4166
+
4167
+ // ์ถ”๊ฐ€ ๋””๋ฒ„๊น…
4168
+ console.log('Enemies remaining:', this.enemies.length);
4169
+
4170
+ // ์  ์ฒ˜์น˜ ์Œ์„ฑ ์žฌ์ƒ (์ถ”๊ฐ€)
4171
+ try {
4172
+ const killVoice = new Audio('sounds/voice_kill_a.ogg');
4173
+ killVoice.volume = 0.8;
4174
+ killVoice.play().catch(e => {
4175
+ console.log('Kill voice failed to play:', e);
4176
+ });
4177
+ } catch (e) {
4178
+ console.log('Kill voice error:', e);
4179
+ }
4180
+
4181
+ // ์ž๋ง‰ ํ‘œ์‹œ
4182
+ this.showSubtitle('Nice work, one enemy down. Keep going.', 4000);
4183
+ }
4184
  // else ๋ธ”๋ก ์ œ๊ฑฐ - ์ ์ด ํŒŒ๊ดด๋˜์ง€ ์•Š์•˜์œผ๋ฉด ์•„๋ฌด๊ฒƒ๋„ ํ•˜์ง€ ์•Š์Œ
4185
 
4186
  break; // ํ•˜๋‚˜์˜ ํƒ„ํ™˜์€ ํ•˜๋‚˜์˜ ์ ๋งŒ ๋งž์ถœ ์ˆ˜ ์žˆ์Œ