cutechicken commited on
Commit
1e528a4
Β·
verified Β·
1 Parent(s): bc74592

Update game.js

Browse files
Files changed (1) hide show
  1. game.js +20 -9
game.js CHANGED
@@ -58,7 +58,7 @@ class Fighter {
58
  this.lastShootTime = 0;
59
 
60
  // 카메라 μ„€μ •
61
- this.cameraDistance = 250;
62
  this.cameraHeight = 45;
63
  this.cameraLag = 0.1;
64
  }
@@ -542,8 +542,8 @@ class Game {
542
  // BGM 사전 λ‘œλ”©
543
  await this.preloadBGM();
544
 
545
- // λͺ¨λ“  λ¦¬μ†ŒμŠ€ λ‘œλ”© μ™„λ£Œ ν›„ λ‘œλ”© ν™”λ©΄ 숨기기
546
- this.checkAllResourcesReady();
547
 
548
  this.animate();
549
 
@@ -554,17 +554,28 @@ class Game {
554
  }
555
  }
556
 
557
- checkAllResourcesReady() {
558
  if (this.isLoaded && this.isBGMReady) {
559
- document.getElementById('loading').style.display = 'none';
560
- console.log('λͺ¨λ“  λ¦¬μ†ŒμŠ€ μ€€λΉ„ μ™„λ£Œ - κ²Œμž„ μ‹œμž‘ κ°€λŠ₯');
 
 
 
 
 
 
 
 
 
 
 
561
  }
562
  }
563
 
564
  async preloadBGM() {
565
  console.log('BGM 사전 λ‘œλ”©...');
566
 
567
- return new Promise((resolve, reject) => {
568
  try {
569
  this.bgm = new Audio('sounds/main.ogg');
570
  this.bgm.volume = 0.5;
@@ -586,14 +597,14 @@ class Game {
586
  // 파일 사전 λ‘œλ”©
587
  this.bgm.load();
588
 
589
- // νƒ€μž„μ•„μ›ƒ μ„€μ • (5초 후에도 λ‘œλ”©μ΄ μ•ˆλ˜λ©΄ κ°•μ œλ‘œ μ™„λ£Œ)
590
  setTimeout(() => {
591
  if (!this.isBGMReady) {
592
  console.log('BGM λ‘œλ”© νƒ€μž„μ•„μ›ƒ - κ²Œμž„ μ§„ν–‰');
593
  this.isBGMReady = true;
594
  resolve();
595
  }
596
- }, 5000);
597
 
598
  } catch (error) {
599
  console.log('BGM 사전 λ‘œλ”© μ‹€νŒ¨:', error);
 
58
  this.lastShootTime = 0;
59
 
60
  // 카메라 μ„€μ •
61
+ this.cameraDistance = 260;
62
  this.cameraHeight = 45;
63
  this.cameraLag = 0.1;
64
  }
 
542
  // BGM 사전 λ‘œλ”©
543
  await this.preloadBGM();
544
 
545
+ // λͺ¨λ“  λ¦¬μ†ŒμŠ€ λ‘œλ”© μ™„λ£Œ ν›„ UI μ—…λ°μ΄νŠΈ
546
+ this.showStartScreen();
547
 
548
  this.animate();
549
 
 
554
  }
555
  }
556
 
557
+ showStartScreen() {
558
  if (this.isLoaded && this.isBGMReady) {
559
+ // λ‘œλ”© ν™”λ©΄ 숨기기
560
+ const loadingElement = document.getElementById('loading');
561
+ if (loadingElement) {
562
+ loadingElement.style.display = 'none';
563
+ }
564
+
565
+ // Start Game ν™”λ©΄ ν‘œμ‹œ
566
+ const startScreen = document.getElementById('startScreen');
567
+ if (startScreen) {
568
+ startScreen.style.display = 'flex';
569
+ }
570
+
571
+ console.log('λͺ¨λ“  λ¦¬μ†ŒμŠ€ μ€€λΉ„ μ™„λ£Œ - Start Game λ²„νŠΌ ν‘œμ‹œ');
572
  }
573
  }
574
 
575
  async preloadBGM() {
576
  console.log('BGM 사전 λ‘œλ”©...');
577
 
578
+ return new Promise((resolve) => {
579
  try {
580
  this.bgm = new Audio('sounds/main.ogg');
581
  this.bgm.volume = 0.5;
 
597
  // 파일 사전 λ‘œλ”©
598
  this.bgm.load();
599
 
600
+ // νƒ€μž„μ•„μ›ƒ μ„€μ • (3초 후에도 λ‘œλ”©μ΄ μ•ˆλ˜λ©΄ κ°•μ œλ‘œ μ™„λ£Œ)
601
  setTimeout(() => {
602
  if (!this.isBGMReady) {
603
  console.log('BGM λ‘œλ”© νƒ€μž„μ•„μ›ƒ - κ²Œμž„ μ§„ν–‰');
604
  this.isBGMReady = true;
605
  resolve();
606
  }
607
+ }, 3000);
608
 
609
  } catch (error) {
610
  console.log('BGM 사전 λ‘œλ”© μ‹€νŒ¨:', error);