cutechicken commited on
Commit
4bacd58
Β·
verified Β·
1 Parent(s): d7d5da4

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +52 -30
index.html CHANGED
@@ -605,11 +605,16 @@ function initRound() {
605
  lastSupportSpawn = 0;
606
 
607
  if (currentStage === 2) {
608
- backgroundImg.src = 'city2.png';
 
 
 
 
 
609
  bgm.src = 'BGM3.ogg';
 
610
  }
611
 
612
- // μΉ΄μš΄νŠΈλ‹€μš΄ μ‹œμž‘
613
  startCountdown();
614
 
615
  // μΉ΄μš΄νŠΈλ‹€μš΄μ΄ λλ‚˜λ©΄ JU87 슀폰
@@ -618,7 +623,7 @@ function initRound() {
618
  supportUnits.push(new JU87());
619
  lastJU87Spawn = Date.now();
620
  }
621
- }, 3000); // 3초 후에 슀폰
622
  }
623
  function startBossStage() {
624
  isBossStage = true;
@@ -899,37 +904,54 @@ bossButton.addEventListener('click', startBossStage);
899
 
900
  // λ‹€μŒ μŠ€ν…Œμ΄μ§€ λ²„νŠΌ 이벀트 λ¦¬μŠ€λ„ˆ
901
  document.getElementById('nextStage').addEventListener('click', () => {
902
- currentStage++;
903
- currentRound = 1;
904
- isBossStage = false;
905
- document.getElementById('nextStage').style.display = 'none';
906
- initRound();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
907
  });
908
 
909
  restartBtn.addEventListener('click', () => {
910
- currentStage = 1; // μΆ”κ°€
911
- currentRound = 1;
912
- gameOver = false;
913
- isBossStage = false;
914
- gold = 0;
915
- hasAPCR = false; // APCR μ΄ˆκΈ°ν™”
916
- hasBF109 = false; // BF109 μ΄ˆκΈ°ν™”
917
- hasJU87 = false;
918
- supportUnits = []; // 지원 μœ λ‹› λ°°μ—΄ μ΄ˆκΈ°ν™”
919
-
920
- restartBtn.style.display = 'none';
921
- document.getElementById('winMessage').style.display = 'none';
922
- document.getElementById('tank1').style.display = 'block';
923
- document.getElementById('tank2').style.display = 'block';
924
- document.getElementById('apcr').style.display = 'block';
925
- document.getElementById('bf109').style.display = 'block'; // BF109 상점 μ•„μ΄ν…œ λ‹€μ‹œ ν‘œμ‹œ
926
-
927
- playerImg.src = 'player.png';
928
- bgm.src = 'BGM2.ogg';
929
- bgm.play();
930
- initRound();
 
931
  });
932
-
933
  Promise.all([
934
  new Promise(resolve => backgroundImg.onload = resolve),
935
  new Promise(resolve => playerImg.onload = resolve),
 
605
  lastSupportSpawn = 0;
606
 
607
  if (currentStage === 2) {
608
+ const newBackgroundImg = new Image();
609
+ newBackgroundImg.src = 'city2.png';
610
+ newBackgroundImg.onload = () => {
611
+ backgroundImg.src = 'city2.png';
612
+ };
613
+ bgm.pause();
614
  bgm.src = 'BGM3.ogg';
615
+ bgm.play();
616
  }
617
 
 
618
  startCountdown();
619
 
620
  // μΉ΄μš΄νŠΈλ‹€μš΄μ΄ λλ‚˜λ©΄ JU87 슀폰
 
623
  supportUnits.push(new JU87());
624
  lastJU87Spawn = Date.now();
625
  }
626
+ }, 3000);
627
  }
628
  function startBossStage() {
629
  isBossStage = true;
 
904
 
905
  // λ‹€μŒ μŠ€ν…Œμ΄μ§€ λ²„νŠΌ 이벀트 λ¦¬μŠ€λ„ˆ
906
  document.getElementById('nextStage').addEventListener('click', () => {
907
+ currentStage++;
908
+ currentRound = 1;
909
+ isBossStage = false;
910
+ document.getElementById('nextStage').style.display = 'none';
911
+ // 상점 μ•„μ΄ν…œ μ΄ˆκΈ°ν™” μΆ”κ°€
912
+ document.getElementById('tank1').style.display = 'block';
913
+ document.getElementById('tank2').style.display = 'block';
914
+ document.getElementById('apcr').style.display = 'block';
915
+ document.getElementById('bf109').style.display = 'block';
916
+ document.getElementById('ju87').style.display = 'block';
917
+ // κΈ°μ‘΄ ꡬ맀 μƒνƒœ μ΄ˆκΈ°ν™”
918
+ hasAPCR = false;
919
+ hasBF109 = false;
920
+ hasJU87 = false;
921
+ supportUnits = [];
922
+ lastSupportSpawn = 0;
923
+ lastJU87Spawn = 0;
924
+ // ν”Œλ ˆμ΄μ–΄ μ΄ˆκΈ°ν™”
925
+ player.health = player.maxHealth;
926
+ playerImg.src = 'player.png';
927
+ gold = 0;
928
+ initRound();
929
  });
930
 
931
  restartBtn.addEventListener('click', () => {
932
+ currentStage = 1; // μΆ”κ°€
933
+ currentRound = 1;
934
+ gameOver = false;
935
+ isBossStage = false;
936
+ gold = 0;
937
+ hasAPCR = false; // APCR μ΄ˆκΈ°ν™”
938
+ hasBF109 = false; // BF109 μ΄ˆκΈ°ν™”
939
+ hasJU87 = false;
940
+ supportUnits = []; // 지원 μœ λ‹› λ°°μ—΄ μ΄ˆκΈ°ν™”
941
+
942
+ restartBtn.style.display = 'none';
943
+ document.getElementById('winMessage').style.display = 'none';
944
+ document.getElementById('tank1').style.display = 'block';
945
+ document.getElementById('tank2').style.display = 'block';
946
+ document.getElementById('apcr').style.display = 'block';
947
+ document.getElementById('bf109').style.display = 'block'; // BF109 상점 μ•„μ΄ν…œ λ‹€μ‹œ ν‘œμ‹œ
948
+ document.getElementById('ju87').style.display = 'block'; // JU87 상점 μ•„μ΄ν…œ λ‹€μ‹œ ν‘œμ‹œ
949
+
950
+ playerImg.src = 'player.png';
951
+ bgm.src = 'BGM2.ogg';
952
+ bgm.play();
953
+ initRound();
954
  });
 
955
  Promise.all([
956
  new Promise(resolve => backgroundImg.onload = resolve),
957
  new Promise(resolve => playerImg.onload = resolve),