Spaces:
Running
Running
Update game.js
Browse files
game.js
CHANGED
|
@@ -1166,6 +1166,7 @@ update(deltaTime, playerPosition) {
|
|
| 1166 |
// ๋ช
์ค ์ฒดํฌ - ๋ฒ์ ์ฆ๊ฐ
|
| 1167 |
if (distance < 50) {
|
| 1168 |
// ๋ช
์ค!
|
|
|
|
| 1169 |
this.onHit();
|
| 1170 |
return 'hit';
|
| 1171 |
}
|
|
@@ -1234,12 +1235,10 @@ update(deltaTime, playerPosition) {
|
|
| 1234 |
// ํ๊ฒ์ด ์ง๋ฉด์ ์์ผ๋ฉด ๋ฏธ์ฌ์ผ๋ ๋ฐ๋ผ๊ฐ
|
| 1235 |
if (this.target.position.y <= 50 && distance < 200) {
|
| 1236 |
// ํ๊ฒ์ด ์ง๋ฉด ๊ทผ์ฒ์ ์๊ณ ๊ฑฐ๋ฆฌ๊ฐ ๊ฐ๊น์ฐ๋ฉด ์ฆ์ ๋ช
์ค
|
|
|
|
| 1237 |
this.onHit();
|
| 1238 |
return 'hit';
|
| 1239 |
}
|
| 1240 |
-
|
| 1241 |
-
return 'flying';
|
| 1242 |
-
}
|
| 1243 |
|
| 1244 |
createSmokeParticle() {
|
| 1245 |
// ๋ฏธ์ฌ์ผ ๋ค์ชฝ ์์น ๊ณ์ฐ
|
|
@@ -1281,27 +1280,41 @@ update(deltaTime, playerPosition) {
|
|
| 1281 |
}
|
| 1282 |
|
| 1283 |
onHit() {
|
| 1284 |
-
|
| 1285 |
-
|
| 1286 |
-
|
| 1287 |
-
|
| 1288 |
-
|
| 1289 |
-
|
| 1290 |
-
|
| 1291 |
-
|
| 1292 |
-
|
| 1293 |
-
|
| 1294 |
-
|
| 1295 |
-
|
| 1296 |
-
|
| 1297 |
-
|
| 1298 |
-
|
| 1299 |
-
|
| 1300 |
-
|
| 1301 |
-
|
| 1302 |
-
|
| 1303 |
-
|
| 1304 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1305 |
|
| 1306 |
destroy() {
|
| 1307 |
if (this.mesh) {
|
|
|
|
| 1166 |
// ๋ช
์ค ์ฒดํฌ - ๋ฒ์ ์ฆ๊ฐ
|
| 1167 |
if (distance < 50) {
|
| 1168 |
// ๋ช
์ค!
|
| 1169 |
+
console.log('AIM-9 missile hit! Distance:', distance);
|
| 1170 |
this.onHit();
|
| 1171 |
return 'hit';
|
| 1172 |
}
|
|
|
|
| 1235 |
// ํ๊ฒ์ด ์ง๋ฉด์ ์์ผ๋ฉด ๋ฏธ์ฌ์ผ๋ ๋ฐ๋ผ๊ฐ
|
| 1236 |
if (this.target.position.y <= 50 && distance < 200) {
|
| 1237 |
// ํ๊ฒ์ด ์ง๋ฉด ๊ทผ์ฒ์ ์๊ณ ๊ฑฐ๋ฆฌ๊ฐ ๊ฐ๊น์ฐ๋ฉด ์ฆ์ ๋ช
์ค
|
| 1238 |
+
console.log('AIM-9 missile ground proximity hit!');
|
| 1239 |
this.onHit();
|
| 1240 |
return 'hit';
|
| 1241 |
}
|
|
|
|
|
|
|
|
|
|
| 1242 |
|
| 1243 |
createSmokeParticle() {
|
| 1244 |
// ๋ฏธ์ฌ์ผ ๋ค์ชฝ ์์น ๊ณ์ฐ
|
|
|
|
| 1280 |
}
|
| 1281 |
|
| 1282 |
onHit() {
|
| 1283 |
+
// ๋ช
์ค ํจ๊ณผ
|
| 1284 |
+
if (window.gameInstance) {
|
| 1285 |
+
window.gameInstance.createExplosionEffect(this.position);
|
| 1286 |
+
}
|
| 1287 |
+
|
| 1288 |
+
// ๋ช
์ค์
|
| 1289 |
+
try {
|
| 1290 |
+
const hitSound = new Audio('sounds/missilehit.ogg');
|
| 1291 |
+
hitSound.volume = 0.8;
|
| 1292 |
+
hitSound.play().catch(e => {});
|
| 1293 |
+
} catch (e) {
|
| 1294 |
+
console.log('Missile hit sound failed:', e);
|
| 1295 |
+
}
|
| 1296 |
+
|
| 1297 |
+
// ํ๊ฒ์๊ฒ ํผํด - ํ์คํ๊ฒ ํผํด๋ฅผ ์
ํ๊ณ ํ๊ดด ์ฒ๋ฆฌ
|
| 1298 |
+
if (this.target && this.target.takeDamage) {
|
| 1299 |
+
console.log('AIM-9 hitting target, damage:', GAME_CONSTANTS.AIM9_DAMAGE);
|
| 1300 |
+
const isDead = this.target.takeDamage(GAME_CONSTANTS.AIM9_DAMAGE);
|
| 1301 |
+
console.log('Target destroyed:', isDead);
|
| 1302 |
+
|
| 1303 |
+
// ํ๊ฒ์ด ํ๊ดด๋์๋ค๋ฉด ๊ฒ์์์ ์ ๊ฑฐ
|
| 1304 |
+
if (isDead && window.gameInstance) {
|
| 1305 |
+
// ์ ๋ฐฐ์ด์์ ์ฐพ์์ ์ ๊ฑฐ
|
| 1306 |
+
const enemyIndex = window.gameInstance.enemies.indexOf(this.target);
|
| 1307 |
+
if (enemyIndex !== -1) {
|
| 1308 |
+
console.log('Removing destroyed enemy from game');
|
| 1309 |
+
this.target.destroy();
|
| 1310 |
+
window.gameInstance.enemies.splice(enemyIndex, 1);
|
| 1311 |
+
window.gameInstance.score += 100;
|
| 1312 |
+
}
|
| 1313 |
+
}
|
| 1314 |
+
}
|
| 1315 |
+
|
| 1316 |
+
this.destroy();
|
| 1317 |
+
}
|
| 1318 |
|
| 1319 |
destroy() {
|
| 1320 |
if (this.mesh) {
|