Spaces:
Running
Running
cutechicken
commited on
Update index.html
Browse files- 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;
|