cutechicken commited on
Commit
9328e0c
ยท
verified ยท
1 Parent(s): 0837df4

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +36 -7
index.html CHANGED
@@ -887,18 +887,20 @@ document.addEventListener('DOMContentLoaded', () => {
887
  const instructions = document.getElementById('instructions');
888
  const weaponInfo = document.getElementById('weaponInfo');
889
  const gameCanvas = document.getElementById('gameCanvas');
890
-
 
 
891
  // ์ดˆ๊ธฐ ์ƒํƒœ
892
  instructions.style.display = 'none';
893
  weaponInfo.style.display = 'none';
894
  gameCanvas.style.display = 'none';
895
-
896
  // ๋””๋ฒ„๊น…์šฉ ํ™•์ธ ๋กœ๊ทธ
897
  console.log("DOM Loaded");
898
 
899
  // ํƒ€์ดํ‹€ ์Œ์•… ์žฌ์ƒ
900
  bgm.play().catch(err => console.error("Error playing title music:", err));
901
-
902
  // Start Button ํด๋ฆญ ์ด๋ฒคํŠธ
903
  startButton.addEventListener('click', () => {
904
  console.log("Start Button Clicked");
@@ -906,20 +908,47 @@ document.addEventListener('DOMContentLoaded', () => {
906
  console.error("DOM elements not found");
907
  return;
908
  }
909
-
910
  titleScreen.style.display = 'none';
911
  instructions.style.display = 'block';
912
  weaponInfo.style.display = 'block';
913
  gameCanvas.style.display = 'block';
914
-
915
  bgm.pause();
916
  bgm.src = 'BGM2.ogg';
917
  bgm.play().catch(err => console.error("Error playing game music:", err));
918
-
919
  initRound();
920
  gameLoop();
921
  });
922
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
923
  // ์ด๋ฏธ์ง€ ๋กœ๋“œ ํ™•์ธ
924
  Promise.all([
925
  new Promise(resolve => backgroundImg.onload = resolve),
@@ -928,7 +957,7 @@ document.addEventListener('DOMContentLoaded', () => {
928
  ]).then(() => {
929
  console.log("Assets loaded successfully");
930
  }).catch(err => console.error("Error loading assets:", err));
931
-
932
  // ์ฐฝ ํฌ๊ธฐ ๋ณ€๊ฒฝ ์‹œ ์บ”๋ฒ„์Šค ํฌ๊ธฐ ์—…๋ฐ์ดํŠธ
933
  window.addEventListener('resize', () => {
934
  canvas.width = window.innerWidth;
 
887
  const instructions = document.getElementById('instructions');
888
  const weaponInfo = document.getElementById('weaponInfo');
889
  const gameCanvas = document.getElementById('gameCanvas');
890
+ const nextRoundBtn = document.getElementById('nextRound'); // ๋‹ค์Œ ๋ผ์šด๋“œ ๋ฒ„ํŠผ ์ฐธ์กฐ ์ถ”๊ฐ€
891
+ const restartBtn = document.getElementById('restart'); // ์žฌ์‹œ์ž‘ ๋ฒ„ํŠผ ์ฐธ์กฐ ์ถ”๊ฐ€
892
+
893
  // ์ดˆ๊ธฐ ์ƒํƒœ
894
  instructions.style.display = 'none';
895
  weaponInfo.style.display = 'none';
896
  gameCanvas.style.display = 'none';
897
+
898
  // ๋””๋ฒ„๊น…์šฉ ํ™•์ธ ๋กœ๊ทธ
899
  console.log("DOM Loaded");
900
 
901
  // ํƒ€์ดํ‹€ ์Œ์•… ์žฌ์ƒ
902
  bgm.play().catch(err => console.error("Error playing title music:", err));
903
+
904
  // Start Button ํด๋ฆญ ์ด๋ฒคํŠธ
905
  startButton.addEventListener('click', () => {
906
  console.log("Start Button Clicked");
 
908
  console.error("DOM elements not found");
909
  return;
910
  }
911
+
912
  titleScreen.style.display = 'none';
913
  instructions.style.display = 'block';
914
  weaponInfo.style.display = 'block';
915
  gameCanvas.style.display = 'block';
916
+
917
  bgm.pause();
918
  bgm.src = 'BGM2.ogg';
919
  bgm.play().catch(err => console.error("Error playing game music:", err));
920
+
921
  initRound();
922
  gameLoop();
923
  });
924
 
925
+ // [์ถ”๊ฐ€] ๋‹ค์Œ ๋ผ์šด๋“œ ๋ฒ„ํŠผ ํด๋ฆญ ์ด๋ฒคํŠธ
926
+ nextRoundBtn.addEventListener('click', () => {
927
+ currentRound++;
928
+ nextRoundBtn.style.display = 'none';
929
+ document.getElementById('shop').style.display = 'none';
930
+ initRound();
931
+ console.log(`Starting Round ${currentRound}`); // ๋ผ์šด๋“œ ์ง„ํ–‰ ํ™•์ธ์šฉ ๋กœ๊ทธ
932
+ });
933
+
934
+ // [์ถ”๊ฐ€] ์žฌ์‹œ์ž‘ ๋ฒ„ํŠผ ํด๋ฆญ ์ด๋ฒคํŠธ
935
+ restartBtn.addEventListener('click', () => {
936
+ gameOver = false;
937
+ currentRound = 1;
938
+ isBossStage = false;
939
+ player.health = player.maxHealth;
940
+ gold = 0;
941
+ restartBtn.style.display = 'none';
942
+ document.getElementById('winMessage').style.display = 'none';
943
+ document.getElementById('shop').style.display = 'none';
944
+ initRound();
945
+ });
946
+
947
+ // [์ถ”๊ฐ€] ๋ณด์Šค ๋ฒ„ํŠผ ํด๋ฆญ ์ด๋ฒคํŠธ
948
+ document.getElementById('bossButton').addEventListener('click', () => {
949
+ startBossStage();
950
+ });
951
+
952
  // ์ด๋ฏธ์ง€ ๋กœ๋“œ ํ™•์ธ
953
  Promise.all([
954
  new Promise(resolve => backgroundImg.onload = resolve),
 
957
  ]).then(() => {
958
  console.log("Assets loaded successfully");
959
  }).catch(err => console.error("Error loading assets:", err));
960
+
961
  // ์ฐฝ ํฌ๊ธฐ ๋ณ€๊ฒฝ ์‹œ ์บ”๋ฒ„์Šค ํฌ๊ธฐ ์—…๋ฐ์ดํŠธ
962
  window.addEventListener('resize', () => {
963
  canvas.width = window.innerWidth;