Update index.html
Browse files- index.html +53 -39
index.html
CHANGED
@@ -210,33 +210,35 @@
|
|
210 |
health: 1000,
|
211 |
maxHealth: 1000
|
212 |
};
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
|
|
|
|
240 |
class Effect {
|
241 |
constructor(x, y, duration, type, angle = 0, parent = null) {
|
242 |
this.x = x;
|
@@ -263,7 +265,7 @@
|
|
263 |
return Date.now() - this.startTime > this.duration;
|
264 |
}
|
265 |
}
|
266 |
-
|
267 |
constructor(yPosition) {
|
268 |
this.x = 0;
|
269 |
this.y = yPosition;
|
@@ -274,10 +276,19 @@
|
|
274 |
this.angle = 0; // ํญ์ ์ค๋ฅธ์ชฝ์ ํฅํจ
|
275 |
this.img = new Image();
|
276 |
this.img.src = 'bf109.png';
|
277 |
-
this.hasPlayedSound = false;
|
|
|
278 |
}
|
279 |
|
280 |
update() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
281 |
// ์ด๋
|
282 |
this.x += this.speed;
|
283 |
// ๋ฐ์ฌ (1์ด์ 5๋ฐ)
|
@@ -290,9 +301,10 @@
|
|
290 |
}
|
291 |
|
292 |
shoot() {
|
293 |
-
// ์นด์ดํธ๋ค์ด ์ค์ด
|
294 |
if (!isCountingDown && !this.hasPlayedSound) {
|
295 |
-
new Audio('bf109mg.ogg')
|
|
|
296 |
this.hasPlayedSound = true;
|
297 |
}
|
298 |
|
@@ -566,16 +578,18 @@ function buyTank(tankImg, cost, tankId) {
|
|
566 |
supportUnits = [];
|
567 |
lastSupportSpawn = 0;
|
568 |
|
569 |
-
// ์นด์ดํธ๋ค์ด ์์
|
570 |
startCountdown();
|
571 |
|
572 |
-
//
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
|
|
|
|
|
|
579 |
}
|
580 |
function startBossStage() {
|
581 |
isBossStage = true;
|
|
|
210 |
health: 1000,
|
211 |
maxHealth: 1000
|
212 |
};
|
213 |
+
function startCountdown() {
|
214 |
+
isCountingDown = true;
|
215 |
+
countdownTime = 3;
|
216 |
+
countdownEl.style.display = 'block';
|
217 |
+
countdownEl.textContent = countdownTime;
|
218 |
+
bgm.pause();
|
219 |
+
|
220 |
+
// ๋ชจ๋ ์ง์ ์ ๋์ ์๋ฆฌ๋ฅผ ์ฆ์ ์ ์ง
|
221 |
+
supportUnits.forEach(unit => {
|
222 |
+
if (unit instanceof SupportUnit && unit.mgSound) {
|
223 |
+
unit.mgSound.pause();
|
224 |
+
unit.mgSound.currentTime = 0;
|
225 |
+
unit.mgSound = null;
|
226 |
+
unit.hasPlayedSound = false;
|
227 |
+
}
|
228 |
+
});
|
229 |
+
|
230 |
+
countSound.play();
|
231 |
+
const countInterval = setInterval(() => {
|
232 |
+
countdownTime--;
|
233 |
+
if(countdownTime <= 0) {
|
234 |
+
clearInterval(countInterval);
|
235 |
+
countdownEl.style.display = 'none';
|
236 |
+
isCountingDown = false;
|
237 |
+
bgm.play();
|
238 |
+
}
|
239 |
+
countdownEl.textContent = countdownTime > 0 ? countdownTime : 'GO!';
|
240 |
+
}, 1000);
|
241 |
+
}
|
242 |
class Effect {
|
243 |
constructor(x, y, duration, type, angle = 0, parent = null) {
|
244 |
this.x = x;
|
|
|
265 |
return Date.now() - this.startTime > this.duration;
|
266 |
}
|
267 |
}
|
268 |
+
class SupportUnit {
|
269 |
constructor(yPosition) {
|
270 |
this.x = 0;
|
271 |
this.y = yPosition;
|
|
|
276 |
this.angle = 0; // ํญ์ ์ค๋ฅธ์ชฝ์ ํฅํจ
|
277 |
this.img = new Image();
|
278 |
this.img.src = 'bf109.png';
|
279 |
+
this.hasPlayedSound = false;
|
280 |
+
this.mgSound = null; // ์ค๋์ค ๊ฐ์ฒด ์ ์ฅ
|
281 |
}
|
282 |
|
283 |
update() {
|
284 |
+
// ์นด์ดํธ๋ค์ด ์ํ๊ฐ ๋ณ๊ฒฝ๋๋ฉด ์๋ฆฌ ์ ์ง
|
285 |
+
if (isCountingDown && this.mgSound) {
|
286 |
+
this.mgSound.pause();
|
287 |
+
this.mgSound.currentTime = 0;
|
288 |
+
this.hasPlayedSound = false;
|
289 |
+
this.mgSound = null; // ๊ฐ์ฒด ์ ๊ฑฐ
|
290 |
+
}
|
291 |
+
|
292 |
// ์ด๋
|
293 |
this.x += this.speed;
|
294 |
// ๋ฐ์ฌ (1์ด์ 5๋ฐ)
|
|
|
301 |
}
|
302 |
|
303 |
shoot() {
|
304 |
+
// ์นด์ดํธ๋ค์ด ์ค์ด ์๋ ๋๋ง ์๋ฆฌ ์ฌ์
|
305 |
if (!isCountingDown && !this.hasPlayedSound) {
|
306 |
+
this.mgSound = new Audio('bf109mg.ogg');
|
307 |
+
this.mgSound.play();
|
308 |
this.hasPlayedSound = true;
|
309 |
}
|
310 |
|
|
|
578 |
supportUnits = [];
|
579 |
lastSupportSpawn = 0;
|
580 |
|
|
|
581 |
startCountdown();
|
582 |
|
583 |
+
// setTimeout ๋์ setInterval ์ฌ์ฉ
|
584 |
+
if (hasJU87) {
|
585 |
+
const spawnInterval = setInterval(() => {
|
586 |
+
if (!isCountingDown) {
|
587 |
+
supportUnits.push(new JU87());
|
588 |
+
lastJU87Spawn = Date.now();
|
589 |
+
clearInterval(spawnInterval);
|
590 |
+
}
|
591 |
+
}, 100); // 100ms๋ง๋ค ์ฒดํฌ
|
592 |
+
}
|
593 |
}
|
594 |
function startBossStage() {
|
595 |
isBossStage = true;
|