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;