cutechicken commited on
Commit
9179d15
ยท
verified ยท
1 Parent(s): d06efcc

Update game.js

Browse files
Files changed (1) hide show
  1. game.js +9 -58
game.js CHANGED
@@ -76,7 +76,6 @@ class Fighter {
76
  // ๊ฒฝ๊ณ  ์‹œ์Šคํ…œ
77
  this.altitudeWarning = false;
78
  this.stallWarning = false;
79
- this.terrainWarning = false; // ์ง€ํ˜• ์ถฉ๋Œ ๊ฒฝ๊ณ  ์ถ”๊ฐ€
80
  this.warningBlinkTimer = 0;
81
  this.warningBlinkState = false;
82
 
@@ -91,7 +90,6 @@ class Fighter {
91
  pullup: null,
92
  overg: null,
93
  stall: null,
94
- terrain: null, // ์ง€ํ˜• ์ถฉ๋Œ ๊ฒฝ๊ณ ์Œ ์ถ”๊ฐ€
95
  normal: null // ์—”์ง„ ์†Œ๋ฆฌ
96
  };
97
  this.initializeWarningAudios();
@@ -111,10 +109,6 @@ class Fighter {
111
  this.warningAudios.stall = new Audio('sounds/alert.ogg');
112
  this.warningAudios.stall.volume = 0.75;
113
 
114
- // ์ง€ํ˜• ์ถฉ๋Œ ๊ฒฝ๊ณ ์Œ
115
- this.warningAudios.terrain = new Audio('sounds/alert.ogg');
116
- this.warningAudios.terrain.volume = 0.8;
117
-
118
  // ์—”์ง„ ์†Œ๋ฆฌ ์„ค์ •
119
  this.warningAudios.normal = new Audio('sounds/normal.ogg');
120
  this.warningAudios.normal.volume = 0.5;
@@ -151,9 +145,6 @@ class Fighter {
151
  else if (this.altitude < 500) {
152
  currentWarning = 'altitude';
153
  }
154
- else if (this.terrainWarning) {
155
- currentWarning = 'terrain';
156
- }
157
  else if (this.overG) {
158
  currentWarning = 'overg';
159
  }
@@ -1306,12 +1297,6 @@ class Game {
1306
  this.keys = { w: false, a: false, s: false, d: false, f: false };
1307
  this.isStarted = false;
1308
 
1309
- // ์ง€ํ˜• ๊ด€๋ จ ์ดˆ๊ธฐํ™”
1310
- this.terrain = null;
1311
- this.terrainGeometry = null;
1312
- this.heightMap = null;
1313
- this.terrainSegments = 100;
1314
-
1315
  this.setupScene();
1316
  this.setupEventListeners();
1317
  this.preloadGame();
@@ -1442,17 +1427,18 @@ class Game {
1442
  directionalLight.shadow.camera.bottom = -8000;
1443
  this.scene.add(directionalLight);
1444
 
1445
- // ํ”„๋กœ์‹œ์ €๋Ÿด ์ง€ํ˜• ์ƒ์„ฑ
1446
- this.createProceduralTerrain();
1447
-
1448
- // ์ดˆ๋ชฉ ๋ฐฐ์น˜
1449
- this.addVegetation();
 
 
 
 
1450
 
1451
  // ๊ฐœ์„ ๋œ ๊ตฌ๋ฆ„ ์ถ”๊ฐ€
1452
  this.addClouds();
1453
-
1454
- // ๋Œ€๊ธฐ ํšจ๊ณผ ์ถ”๊ฐ€
1455
- this.addAtmosphericEffects();
1456
  }
1457
 
1458
  createProceduralTerrain() {
@@ -2279,10 +2265,6 @@ class Game {
2279
  warningText += 'OVER-G! OVER-G!\n';
2280
  }
2281
 
2282
- if (this.fighter.terrainWarning) {
2283
- warningText += 'TERRAIN! TERRAIN!\n';
2284
- }
2285
-
2286
  if (warningText) {
2287
  warningContainer.innerHTML = warningText.replace(/\n/g, '<br>');
2288
  document.body.appendChild(warningContainer);
@@ -2448,34 +2430,6 @@ class Game {
2448
  });
2449
  }
2450
 
2451
- checkTerrainCollision() {
2452
- if (!this.fighter || !this.terrain || !this.heightMap) return;
2453
-
2454
- // ํ˜„์žฌ ์ „ํˆฌ๊ธฐ ์œ„์น˜์—์„œ์˜ ์ง€ํ˜• ๋†’์ด ๊ณ„์‚ฐ
2455
- const terrainHeight = this.getTerrainHeightAt(this.fighter.position.x, this.fighter.position.z);
2456
-
2457
- // ์ง€ํ˜•๊ณผ์˜ ๊ฑฐ๋ฆฌ ๊ณ„์‚ฐ
2458
- const clearanceHeight = this.fighter.position.y - terrainHeight;
2459
-
2460
- // ์ถฉ๋Œ ๊ฒฝ๊ณ  ๊ฑฐ๋ฆฌ ์„ค์ • (์†๋„์— ๋”ฐ๋ผ ๋™์ ์œผ๋กœ ์กฐ์ •)
2461
- const warningDistance = 150 + this.fighter.speed * 0.1; // ๊ธฐ๋ณธ 150m + ์†๋„ ๋ณด์ •
2462
- const criticalDistance = 50;
2463
-
2464
- // ์ง€ํ˜• ์ถฉ๋Œ ๊ฒฝ๊ณ  ํŒ์ •
2465
- if (clearanceHeight < warningDistance) {
2466
- this.fighter.terrainWarning = true;
2467
-
2468
- // ์‹ค์ œ ์ถฉ๋Œ ํŒ์ •
2469
- if (clearanceHeight < criticalDistance) {
2470
- // ์ถฉ๋Œ ๋ฐœ์ƒ
2471
- this.fighter.health = 0;
2472
- this.endGame(false, "TERRAIN COLLISION");
2473
- }
2474
- } else {
2475
- this.fighter.terrainWarning = false;
2476
- }
2477
- }
2478
-
2479
  checkCollisions() {
2480
  // ํ”Œ๋ ˆ์ด์–ด ํƒ„ํ™˜ vs ์ ๊ธฐ ์ถฉ๋Œ
2481
  for (let i = this.fighter.bullets.length - 1; i >= 0; i--) {
@@ -2685,9 +2639,6 @@ class Game {
2685
  this.fighter.updatePhysics(deltaTime);
2686
  this.fighter.updateBullets(this.scene, deltaTime);
2687
 
2688
- // ์ง€ํ˜• ์ถฉ๋Œ ๊ฐ์ง€
2689
- this.checkTerrainCollision();
2690
-
2691
  // ๋งˆ์šฐ์Šค ๋ˆ„๋ฆ„ ์ƒํƒœ์ผ ๋•Œ ์—ฐ์† ๋ฐœ์‚ฌ
2692
  if (this.fighter.isMouseDown && this.isStarted) {
2693
  const currentShootTime = Date.now();
 
76
  // ๊ฒฝ๊ณ  ์‹œ์Šคํ…œ
77
  this.altitudeWarning = false;
78
  this.stallWarning = false;
 
79
  this.warningBlinkTimer = 0;
80
  this.warningBlinkState = false;
81
 
 
90
  pullup: null,
91
  overg: null,
92
  stall: null,
 
93
  normal: null // ์—”์ง„ ์†Œ๋ฆฌ
94
  };
95
  this.initializeWarningAudios();
 
109
  this.warningAudios.stall = new Audio('sounds/alert.ogg');
110
  this.warningAudios.stall.volume = 0.75;
111
 
 
 
 
 
112
  // ์—”์ง„ ์†Œ๋ฆฌ ์„ค์ •
113
  this.warningAudios.normal = new Audio('sounds/normal.ogg');
114
  this.warningAudios.normal.volume = 0.5;
 
145
  else if (this.altitude < 500) {
146
  currentWarning = 'altitude';
147
  }
 
 
 
148
  else if (this.overG) {
149
  currentWarning = 'overg';
150
  }
 
1297
  this.keys = { w: false, a: false, s: false, d: false, f: false };
1298
  this.isStarted = false;
1299
 
 
 
 
 
 
 
1300
  this.setupScene();
1301
  this.setupEventListeners();
1302
  this.preloadGame();
 
1427
  directionalLight.shadow.camera.bottom = -8000;
1428
  this.scene.add(directionalLight);
1429
 
1430
+ // ๋‹จ์ˆœํ•œ ํ‰ํ‰ํ•œ ๋ฐ”๋‹ฅ
1431
+ const groundGeometry = new THREE.PlaneGeometry(GAME_CONSTANTS.MAP_SIZE, GAME_CONSTANTS.MAP_SIZE);
1432
+ const groundMaterial = new THREE.MeshLambertMaterial({
1433
+ color: 0x8FBC8F
1434
+ });
1435
+ const ground = new THREE.Mesh(groundGeometry, groundMaterial);
1436
+ ground.rotation.x = -Math.PI / 2;
1437
+ ground.receiveShadow = true;
1438
+ this.scene.add(ground);
1439
 
1440
  // ๊ฐœ์„ ๋œ ๊ตฌ๋ฆ„ ์ถ”๊ฐ€
1441
  this.addClouds();
 
 
 
1442
  }
1443
 
1444
  createProceduralTerrain() {
 
2265
  warningText += 'OVER-G! OVER-G!\n';
2266
  }
2267
 
 
 
 
 
2268
  if (warningText) {
2269
  warningContainer.innerHTML = warningText.replace(/\n/g, '<br>');
2270
  document.body.appendChild(warningContainer);
 
2430
  });
2431
  }
2432
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2433
  checkCollisions() {
2434
  // ํ”Œ๋ ˆ์ด์–ด ํƒ„ํ™˜ vs ์ ๊ธฐ ์ถฉ๋Œ
2435
  for (let i = this.fighter.bullets.length - 1; i >= 0; i--) {
 
2639
  this.fighter.updatePhysics(deltaTime);
2640
  this.fighter.updateBullets(this.scene, deltaTime);
2641
 
 
 
 
2642
  // ๋งˆ์šฐ์Šค ๋ˆ„๋ฆ„ ์ƒํƒœ์ผ ๋•Œ ์—ฐ์† ๋ฐœ์‚ฌ
2643
  if (this.fighter.isMouseDown && this.isStarted) {
2644
  const currentShootTime = Date.now();