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>