Spaces:
Running
Running
cutechicken
commited on
Update index.html
Browse files- index.html +36 -1
index.html
CHANGED
@@ -948,13 +948,48 @@ restartBtn.addEventListener('click', () => {
|
|
948 |
initRound();
|
949 |
});
|
950 |
Promise.all([
|
|
|
951 |
new Promise(resolve => backgroundImg.onload = resolve),
|
952 |
new Promise(resolve => playerImg.onload = resolve),
|
953 |
-
new Promise(resolve => enemyImg.onload = resolve)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
954 |
]).then(() => {
|
955 |
initRound();
|
956 |
gameLoop();
|
957 |
bgm.play();
|
|
|
|
|
958 |
});
|
959 |
|
960 |
window.addEventListener('resize', () => {
|
|
|
948 |
initRound();
|
949 |
});
|
950 |
Promise.all([
|
951 |
+
// 기본 이미지 로딩
|
952 |
new Promise(resolve => backgroundImg.onload = resolve),
|
953 |
new Promise(resolve => playerImg.onload = resolve),
|
954 |
+
new Promise(resolve => enemyImg.onload = resolve),
|
955 |
+
new Promise(resolve => bulletImg.onload = resolve), // APCR 총알 이미지
|
956 |
+
|
957 |
+
// Effect 클래스에서 사용하는 이미지
|
958 |
+
new Promise(resolve => {
|
959 |
+
const effectImg = new Image();
|
960 |
+
effectImg.src = 'fire2.png';
|
961 |
+
effectImg.onload = resolve;
|
962 |
+
}),
|
963 |
+
new Promise(resolve => {
|
964 |
+
const bangImg = new Image();
|
965 |
+
bangImg.src = 'bang.png';
|
966 |
+
bangImg.onload = resolve;
|
967 |
+
}),
|
968 |
+
|
969 |
+
// 지원 유닛 이미지
|
970 |
+
new Promise(resolve => {
|
971 |
+
const bf109Img = new Image();
|
972 |
+
bf109Img.src = 'bf109.png';
|
973 |
+
bf109Img.onload = resolve;
|
974 |
+
}),
|
975 |
+
new Promise(resolve => {
|
976 |
+
const ju87Img = new Image();
|
977 |
+
ju87Img.src = 'ju87.png';
|
978 |
+
ju87Img.onload = resolve;
|
979 |
+
}),
|
980 |
+
|
981 |
+
// 스테이지 2 배경 이미지 미리 로딩
|
982 |
+
new Promise(resolve => {
|
983 |
+
const stage2Bg = new Image();
|
984 |
+
stage2Bg.src = 'city2.png';
|
985 |
+
stage2Bg.onload = resolve;
|
986 |
+
})
|
987 |
]).then(() => {
|
988 |
initRound();
|
989 |
gameLoop();
|
990 |
bgm.play();
|
991 |
+
}).catch(error => {
|
992 |
+
console.error('이미지 로딩 중 에러 발생:', error);
|
993 |
});
|
994 |
|
995 |
window.addEventListener('resize', () => {
|