cutechicken commited on
Commit
192677c
Β·
verified Β·
1 Parent(s): c7c19ae

Update game.js

Browse files
Files changed (1) hide show
  1. game.js +34 -17
game.js CHANGED
@@ -231,7 +231,7 @@ class Fighter {
231
  }
232
 
233
  updateMouseInput(deltaX, deltaY) {
234
- const sensitivity = GAME_CONSTANTS.MOUSE_SENSITIVITY * 2.0;
235
 
236
  // 마우슀 XμΆ•: 순수 λ‘€(λ‚ κ°œ 기울이기)만 μ‘°μ •
237
  this.targetRoll += deltaX * sensitivity;
@@ -241,7 +241,7 @@ class Fighter {
241
 
242
  // 각도 μ œν•œ
243
  const maxPitchAngle = Math.PI / 3; // 60도
244
- const maxRollAngle = Math.PI; // 180도
245
 
246
  this.targetPitch = Math.max(-maxPitchAngle, Math.min(maxPitchAngle, this.targetPitch));
247
  this.targetRoll = Math.max(-maxRollAngle, Math.min(maxRollAngle, this.targetRoll));
@@ -269,7 +269,7 @@ class Fighter {
269
  if (!this.mesh) return;
270
 
271
  // λΆ€λ“œλŸ¬μš΄ νšŒμ „ 보간
272
- const rotationSpeed = deltaTime * 3.0;
273
  this.rotation.x = THREE.MathUtils.lerp(this.rotation.x, this.targetPitch, rotationSpeed);
274
  this.rotation.z = THREE.MathUtils.lerp(this.rotation.z, this.targetRoll, rotationSpeed);
275
 
@@ -278,7 +278,7 @@ class Fighter {
278
  if (Math.abs(this.rotation.z) > 0.1) {
279
  const bankAngle = this.rotation.z;
280
  // λ‚ κ°œκ°€ κΈ°μšΈμ–΄μ§ˆ λ•Œλ§Œ μ„ νšŒ (ν˜„μ‹€μ μΈ λΉ„ν–‰)
281
- bankTurnRate = Math.sin(bankAngle) * deltaTime * 0.5; // μ„ νšŒμœ¨ κ°μ†Œ
282
  this.targetYaw += bankTurnRate;
283
  }
284
 
@@ -295,16 +295,16 @@ class Fighter {
295
  const pitchDegrees = Math.abs(pitchAngle) * (180 / Math.PI);
296
 
297
  // κΈ°μˆ˜κ°€ μœ„λ₯Ό ν–₯ν•˜κ³  μžˆμ„ 경우 λΉ λ₯Έ 속도 κ°μ†Œ
298
- if (pitchAngle < -0.1) { // κΈ°μˆ˜κ°€ μœ„λ‘œ (μƒμŠΉ)
299
  const climbFactor = Math.abs(pitchAngle) / (Math.PI / 2); // 90도 κΈ°μ€€
300
  if (pitchDegrees > 30) { // 30도 이상일 λ•Œ κΈ‰κ²©ν•œ 감속
301
  targetSpeed *= Math.max(0, 1 - climbFactor * 1.5); // μ΅œλŒ€ 150% 감속 (0ktκΉŒμ§€)
302
  } else {
303
  targetSpeed *= (1 - climbFactor * 0.3); // 정상적인 감속
304
  }
305
- } else if (pitchAngle > 0.1) { // κΈ°μˆ˜κ°€ μ•„λž˜λ‘œ (ν•˜κ°•)
306
  const diveFactor = pitchAngle / (Math.PI / 3);
307
- targetSpeed *= (1 + diveFactor * 0.2); // μ΅œλŒ€ 20% 가속
308
  }
309
 
310
  // Over-G μƒνƒœ 처리
@@ -329,18 +329,35 @@ class Fighter {
329
  this.overGTimer = 0; // Over-G μƒνƒœκ°€ μ•„λ‹ˆλ©΄ 타이머 리셋
330
  }
331
 
332
- // 속도 λ³€ν™”λ₯Ό 천천히 적용 (μŠ€ν†¨ μƒνƒœμΌ λ•ŒλŠ” μ œμ™Έ)
 
 
 
 
 
 
 
 
 
 
 
 
 
333
  if (this.stallWarning) {
334
- // μŠ€ν†¨ μƒνƒœμ—μ„œλŠ” 속도가 λΉ λ₯΄κ²Œ κ°μ†Œ
335
- this.speed = Math.max(0, this.speed - deltaTime * 200);
 
 
 
 
 
 
 
336
  } else {
 
337
  this.speed = THREE.MathUtils.lerp(this.speed, targetSpeed, deltaTime * 0.5);
338
  }
339
 
340
- // μŠ€ν†¨ κ²½κ³ : 300kt μ΄ν•˜μ—μ„œ μŠ€ν†¨ μœ„ν—˜
341
- const speedKnots = this.speed * 1.94384; // m/s to knots
342
- this.stallWarning = speedKnots < GAME_CONSTANTS.STALL_SPEED;
343
-
344
  // μŠ€ν†¨ μƒνƒœμ—μ„œμ˜ 물리 효과
345
  if (this.stallWarning) {
346
  // λ°”λ‹₯으둜 μΆ”λ½ν•˜λ©° 가속도��� λΉ λ₯΄κ²Œ λΆ™μŒ
@@ -363,9 +380,9 @@ class Fighter {
363
  // 정상 λΉ„ν–‰ μ‹œ
364
  this.velocity = noseDirection.multiplyScalar(this.speed);
365
  } else {
366
- // μŠ€ν†¨ μ‹œμ—λŠ” 쀑λ ₯이 주도적
367
- this.velocity.x = noseDirection.x * this.speed * 0.3; // μ „λ°© 속도 κ°μ†Œ
368
- this.velocity.z = noseDirection.z * this.speed * 0.3;
369
  // y μ†λ„λŠ” μœ„μ—μ„œ 쀑λ ₯으둜 처리됨
370
  }
371
 
 
231
  }
232
 
233
  updateMouseInput(deltaX, deltaY) {
234
+ const sensitivity = GAME_CONSTANTS.MOUSE_SENSITIVITY * 1.0; // 감도 50% κ°μ†Œ (2.0 -> 1.0)
235
 
236
  // 마우슀 XμΆ•: 순수 λ‘€(λ‚ κ°œ 기울이기)만 μ‘°μ •
237
  this.targetRoll += deltaX * sensitivity;
 
241
 
242
  // 각도 μ œν•œ
243
  const maxPitchAngle = Math.PI / 3; // 60도
244
+ const maxRollAngle = Math.PI * 0.75; // 135λ„λ‘œ μ œν•œ
245
 
246
  this.targetPitch = Math.max(-maxPitchAngle, Math.min(maxPitchAngle, this.targetPitch));
247
  this.targetRoll = Math.max(-maxRollAngle, Math.min(maxRollAngle, this.targetRoll));
 
269
  if (!this.mesh) return;
270
 
271
  // λΆ€λ“œλŸ¬μš΄ νšŒμ „ 보간
272
+ const rotationSpeed = deltaTime * 2.0; // νšŒμ „ 속도도 κ°μ†Œ (3.0 -> 2.0)
273
  this.rotation.x = THREE.MathUtils.lerp(this.rotation.x, this.targetPitch, rotationSpeed);
274
  this.rotation.z = THREE.MathUtils.lerp(this.rotation.z, this.targetRoll, rotationSpeed);
275
 
 
278
  if (Math.abs(this.rotation.z) > 0.1) {
279
  const bankAngle = this.rotation.z;
280
  // λ‚ κ°œκ°€ κΈ°μšΈμ–΄μ§ˆ λ•Œλ§Œ μ„ νšŒ (ν˜„μ‹€μ μΈ λΉ„ν–‰)
281
+ bankTurnRate = Math.sin(bankAngle) * deltaTime * 0.3; // μ„ νšŒμœ¨ μΆ”κ°€ κ°μ†Œ (0.5 -> 0.3)
282
  this.targetYaw += bankTurnRate;
283
  }
284
 
 
295
  const pitchDegrees = Math.abs(pitchAngle) * (180 / Math.PI);
296
 
297
  // κΈ°μˆ˜κ°€ μœ„λ₯Ό ν–₯ν•˜κ³  μžˆμ„ 경우 λΉ λ₯Έ 속도 κ°μ†Œ
298
+ if (pitchAngle < -0.1 && !this.stallWarning) { // μŠ€ν†¨μ΄ 아닐 λ•Œλ§Œ μƒμŠΉμœΌλ‘œ μΈν•œ 감속
299
  const climbFactor = Math.abs(pitchAngle) / (Math.PI / 2); // 90도 κΈ°μ€€
300
  if (pitchDegrees > 30) { // 30도 이상일 λ•Œ κΈ‰κ²©ν•œ 감속
301
  targetSpeed *= Math.max(0, 1 - climbFactor * 1.5); // μ΅œλŒ€ 150% 감속 (0ktκΉŒμ§€)
302
  } else {
303
  targetSpeed *= (1 - climbFactor * 0.3); // 정상적인 감속
304
  }
305
+ } else if (pitchAngle > 0.1) { // κΈ°μˆ˜κ°€ μ•„λž˜λ‘œ (ν•˜κ°•) - μŠ€ν†¨ μƒνƒœμ—μ„œλ„ 적용
306
  const diveFactor = pitchAngle / (Math.PI / 3);
307
+ targetSpeed *= (1 + diveFactor * 0.4); // ν•˜κ°• μ‹œ 가속 증가 (0.2 -> 0.4)
308
  }
309
 
310
  // Over-G μƒνƒœ 처리
 
329
  this.overGTimer = 0; // Over-G μƒνƒœκ°€ μ•„λ‹ˆλ©΄ 타이머 리셋
330
  }
331
 
332
+ // μŠ€ν†¨ κ²½κ³ : 300kt μ΄ν•˜μ—μ„œ μŠ€ν†¨ μœ„ν—˜
333
+ const speedKnots = this.speed * 1.94384; // m/s to knots
334
+ const wasStalling = this.stallWarning;
335
+ this.stallWarning = speedKnots < GAME_CONSTANTS.STALL_SPEED;
336
+
337
+ // μŠ€ν†¨ νƒˆμΆœ 쑰건: Wν‚€λ₯Ό λˆ„λ₯΄κ³  있고, κΈ°μˆ˜κ°€ μ•„λž˜λ₯Ό ν–₯ν•˜κ³  μžˆμ„ λ•Œ
338
+ if (this.stallWarning && this.throttle > 0.8 && pitchAngle > 0.2) {
339
+ // 닀이빙 쀑에 속도가 회볡되면 μŠ€ν†¨ νƒˆμΆœ
340
+ if (speedKnots > GAME_CONSTANTS.STALL_SPEED + 50) { // 350kt 이상
341
+ this.stallWarning = false;
342
+ }
343
+ }
344
+
345
+ // 속도 λ³€ν™” 적용
346
  if (this.stallWarning) {
347
+ // μŠ€ν†¨ μƒνƒœμ—μ„œμ˜ 속도 λ³€ν™”
348
+ if (pitchAngle > 0.1) { // κΈ°μˆ˜κ°€ μ•„λž˜λ₯Ό ν–₯ν•  λ•Œ
349
+ // λ‹€μ΄λΉ™μœΌλ‘œ μΈν•œ 속도 증가
350
+ const diveSpeedGain = Math.min(pitchAngle * 300, 200); // μ΅œλŒ€ 200m/s 증가
351
+ this.speed = Math.min(maxSpeed, this.speed + diveSpeedGain * deltaTime);
352
+ } else {
353
+ // κΈ°μˆ˜κ°€ μœ„λ₯Ό ν–₯ν•˜κ±°λ‚˜ μˆ˜ν‰μΌ λ•ŒλŠ” 속도 κ°μ†Œ
354
+ this.speed = Math.max(0, this.speed - deltaTime * 100);
355
+ }
356
  } else {
357
+ // 정상 λΉ„ν–‰ μ‹œ 속도 λ³€ν™”
358
  this.speed = THREE.MathUtils.lerp(this.speed, targetSpeed, deltaTime * 0.5);
359
  }
360
 
 
 
 
 
361
  // μŠ€ν†¨ μƒνƒœμ—μ„œμ˜ 물리 효과
362
  if (this.stallWarning) {
363
  // λ°”λ‹₯으둜 μΆ”λ½ν•˜λ©° 가속도��� λΉ λ₯΄κ²Œ λΆ™μŒ
 
380
  // 정상 λΉ„ν–‰ μ‹œ
381
  this.velocity = noseDirection.multiplyScalar(this.speed);
382
  } else {
383
+ // μŠ€ν†¨ μ‹œμ—λŠ” 쀑λ ₯이 μ£Όλ„μ μ΄μ§€λ§Œ 닀이빙 속도도 반영
384
+ this.velocity.x = noseDirection.x * this.speed * 0.5; // μ „λ°© 속도 증가
385
+ this.velocity.z = noseDirection.z * this.speed * 0.5;
386
  // y μ†λ„λŠ” μœ„μ—μ„œ 쀑λ ₯으둜 처리됨
387
  }
388