Spaces:
Running
Running
Update game.js
Browse files
game.js
CHANGED
@@ -3249,39 +3249,39 @@ class Game {
|
|
3249 |
}
|
3250 |
|
3251 |
// ์ ์ด ๋ฏธ์ฌ์ผ์ ๋ฐ์ฌํ์ ๋
|
3252 |
-
|
3253 |
-
|
3254 |
-
|
3255 |
-
|
3256 |
-
|
3257 |
-
|
3258 |
-
|
3259 |
-
|
3260 |
-
|
3261 |
-
|
3262 |
-
}
|
3263 |
-
|
3264 |
-
// ๊ฒฝ๊ณ ์ ์
๋ฐ์ดํธ
|
3265 |
-
this.fighter.updateWarningAudios();
|
3266 |
}
|
|
|
|
|
|
|
|
|
3267 |
// ์ฒซ ๋ฒ์งธ ๋ฏธ์ฌ์ผ ๋ฐ์ฌ ์์๋ง ์์ฑ ์ฌ์
|
3268 |
-
|
3269 |
-
|
3270 |
-
|
3271 |
-
|
3272 |
-
|
3273 |
-
|
3274 |
-
|
3275 |
-
|
3276 |
-
|
3277 |
-
|
3278 |
-
|
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 |
-
|
4159 |
-
|
4160 |
-
|
4161 |
-
|
4162 |
-
|
4163 |
-
|
4164 |
-
|
4165 |
-
|
4166 |
-
|
4167 |
-
|
4168 |
-
|
4169 |
-
|
4170 |
-
|
4171 |
-
|
4172 |
-
|
4173 |
-
|
4174 |
-
|
4175 |
-
|
4176 |
-
|
4177 |
-
|
4178 |
-
|
4179 |
-
|
4180 |
-
|
4181 |
-
|
4182 |
-
|
4183 |
-
|
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; // ํ๋์ ํํ์ ํ๋์ ์ ๋ง ๋ง์ถ ์ ์์
|