cutechicken commited on
Commit
9c5e08a
Β·
verified Β·
1 Parent(s): 8be4b24

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +84 -0
index.html CHANGED
@@ -511,6 +511,90 @@
511
  }
512
  </script>
513
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
514
  <script src="game.js" type="module"></script>
515
  </body>
516
  </html>
 
511
  }
512
  </script>
513
 
514
+ <!-- ν”ΌμΉ˜ λž˜λ” 및 HUD μ—…λ°μ΄νŠΈ 슀크립트 -->
515
+ <script>
516
+ // μ „μ—­ λ³€μˆ˜
517
+ let gameStarted = false;
518
+
519
+ // κ²Œμž„ μ€€λΉ„ μ™„λ£Œ μ‹œ HUD μ—…λ°μ΄νŠΈ μ‹œμž‘
520
+ window.addEventListener('gameReady', function() {
521
+ // 쀑앙 HUD 정보 μ—…λ°μ΄νŠΈλ₯Ό μœ„ν•œ μΈν„°λ²Œ
522
+ setInterval(function() {
523
+ if (window.gameInstance && window.gameInstance.fighter && window.gameInstance.fighter.isLoaded) {
524
+ const fighter = window.gameInstance.fighter;
525
+
526
+ // λΉ„ν–‰ 정보 계산
527
+ const speedKnots = Math.round(fighter.speed * 1.94384);
528
+ const altitudeMeters = Math.round(fighter.altitude);
529
+ const throttlePercent = Math.round(fighter.throttle * 100);
530
+ const gForce = fighter.gForce.toFixed(1);
531
+ const headingDegrees = Math.round(((fighter.rotation.y * (180 / Math.PI)) + 360) % 360);
532
+
533
+ // 쀑앙 HUD 정보 μ—…λ°μ΄νŠΈ
534
+ const hudSpeedCentral = document.getElementById('hudSpeedCentral');
535
+ const hudAltitudeCentral = document.getElementById('hudAltitudeCentral');
536
+ const hudHeadingCentral = document.getElementById('hudHeadingCentral');
537
+ const hudGForceCentral = document.getElementById('hudGForceCentral');
538
+ const hudThrottleCentral = document.getElementById('hudThrottleCentral');
539
+
540
+ if (hudSpeedCentral) hudSpeedCentral.textContent = `SPD: ${speedKnots} KT`;
541
+ if (hudAltitudeCentral) hudAltitudeCentral.textContent = `ALT: ${altitudeMeters} M`;
542
+ if (hudHeadingCentral) hudHeadingCentral.textContent = `HDG: ${String(headingDegrees).padStart(3, '0')}Β°`;
543
+ if (hudGForceCentral) {
544
+ hudGForceCentral.textContent = `G: ${gForce}`;
545
+ // G-Force에 λ”°λ₯Έ 색상 λ³€κ²½
546
+ if (fighter.overG) {
547
+ hudGForceCentral.style.color = '#ff0000';
548
+ } else if (parseFloat(gForce) > 7) {
549
+ hudGForceCentral.style.color = '#ffff00';
550
+ } else {
551
+ hudGForceCentral.style.color = '#00ff00';
552
+ }
553
+ }
554
+ if (hudThrottleCentral) hudThrottleCentral.textContent = `THR: ${throttlePercent}%`;
555
+
556
+ // ν”ΌμΉ˜ λž˜λ” μ—…λ°μ΄νŠΈ - μ „νˆ¬κΈ°κ°€ μˆ˜ν‰μΌ λ•Œ 0도가 쀑앙에 μ˜€λ„λ‘
557
+ const pitchLadder = document.getElementById('pitchLadder');
558
+ if (pitchLadder) {
559
+ const pitchDegrees = fighter.rotation.x * (180 / Math.PI);
560
+ // 10도당 20ν”½μ…€, 음수둜 λ°˜λŒ€ λ°©ν–₯
561
+ const pitchOffset = -pitchDegrees * 2;
562
+ pitchLadder.style.transform = `translateY(${pitchOffset}px)`;
563
+ }
564
+
565
+ // HUD ν¬λ‘œμŠ€ν—€μ–΄ νšŒμ „ (λ‘€ 각도에 따라)
566
+ const hudCrosshair = document.getElementById('hudCrosshair');
567
+ if (hudCrosshair && fighter.rotation) {
568
+ const rollDegrees = fighter.rotation.z * (180 / Math.PI);
569
+ hudCrosshair.style.transform = `translate(-50%, -50%) rotate(${-rollDegrees}deg)`;
570
+ }
571
+ }
572
+ }, 16); // μ•½ 60fps
573
+ });
574
+
575
+ // startGame ν•¨μˆ˜ μ •μ˜
576
+ window.startGame = function() {
577
+ if (!window.gameInstance || !window.gameInstance.isLoaded || !window.gameInstance.isBGMReady) {
578
+ console.log('κ²Œμž„μ΄ 아직 μ€€λΉ„λ˜μ§€ μ•Šμ•˜μŠ΅λ‹ˆλ‹€...');
579
+ return;
580
+ }
581
+
582
+ gameStarted = true;
583
+ document.getElementById('startScreen').style.display = 'none';
584
+
585
+ // κ²Œμž„ 타이틀 숨기기
586
+ const gameTitle = document.getElementById('gameTitle');
587
+ if (gameTitle) {
588
+ gameTitle.style.display = 'none';
589
+ }
590
+
591
+ document.body.requestPointerLock();
592
+
593
+ window.gameInstance.startBGM();
594
+ window.gameInstance.startGame();
595
+ }
596
+ </script>
597
+
598
  <script src="game.js" type="module"></script>
599
  </body>
600
  </html>