Spaces:
Running
Running
cutechicken
commited on
Update index.html
Browse files- index.html +78 -90
index.html
CHANGED
@@ -210,35 +210,25 @@
|
|
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 |
-
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 |
-
|
240 |
-
}, 1000);
|
241 |
-
}
|
242 |
class Effect {
|
243 |
constructor(x, y, duration, type, angle = 0, parent = null) {
|
244 |
this.x = x;
|
@@ -265,59 +255,59 @@
|
|
265 |
return Date.now() - this.startTime > this.duration;
|
266 |
}
|
267 |
}
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
|
|
|
|
|
|
291 |
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
|
|
|
|
|
|
|
|
|
|
302 |
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
y: this.y + Math.sin(this.angle) * 30,
|
314 |
-
angle: this.angle,
|
315 |
-
speed: 10,
|
316 |
-
isEnemy: false,
|
317 |
-
damage: weapons.machinegun.damage,
|
318 |
-
size: weapons.machinegun.bulletSize
|
319 |
-
});
|
320 |
-
}
|
321 |
}
|
322 |
class JU87 {
|
323 |
constructor() {
|
@@ -348,7 +338,7 @@
|
|
348 |
// ์นด์ดํธ๋ค์ด ์ค์ด ์๋ ๋๋ง ์๋ฆฌ ์ฌ์
|
349 |
if (!this.hasPlayedMGSound && !isCountingDown) {
|
350 |
const mgSound = new Audio('ju87mg.ogg');
|
351 |
-
mgSound.volume =
|
352 |
mgSound.currentTime = 0;
|
353 |
mgSound.play().catch(error => console.error('Audio play failed:', error));
|
354 |
this.hasPlayedMGSound = true;
|
@@ -578,18 +568,16 @@ function buyTank(tankImg, cost, tankId) {
|
|
578 |
supportUnits = [];
|
579 |
lastSupportSpawn = 0;
|
580 |
|
|
|
581 |
startCountdown();
|
582 |
|
583 |
-
//
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
}
|
591 |
-
}, 100); // 100ms๋ง๋ค ์ฒดํฌ
|
592 |
-
}
|
593 |
}
|
594 |
function startBossStage() {
|
595 |
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 |
+
countSound.play();
|
220 |
+
const countInterval = setInterval(() => {
|
221 |
+
countdownTime--;
|
222 |
+
if(countdownTime <= 0) {
|
223 |
+
clearInterval(countInterval);
|
224 |
+
countdownEl.style.display = 'none';
|
225 |
+
isCountingDown = false;
|
226 |
+
bgm.play();
|
227 |
+
}
|
228 |
+
countdownEl.textContent = countdownTime > 0 ? countdownTime : 'GO!';
|
229 |
+
}, 1000);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
230 |
}
|
231 |
+
|
|
|
|
|
232 |
class Effect {
|
233 |
constructor(x, y, duration, type, angle = 0, parent = null) {
|
234 |
this.x = x;
|
|
|
255 |
return Date.now() - this.startTime > this.duration;
|
256 |
}
|
257 |
}
|
258 |
+
class SupportUnit {
|
259 |
+
constructor(yPosition) {
|
260 |
+
this.x = 0;
|
261 |
+
this.y = yPosition;
|
262 |
+
this.speed = 5;
|
263 |
+
this.lastShot = 0;
|
264 |
+
this.width = 100;
|
265 |
+
this.height = 100;
|
266 |
+
this.angle = 0; // ํญ์ ์ค๋ฅธ์ชฝ์ ํฅํจ
|
267 |
+
this.img = new Image();
|
268 |
+
this.img.src = 'bf109.png';
|
269 |
+
this.hasPlayedSound = false;
|
270 |
+
this.mgSound = null; // ์ค๋์ค ๊ฐ์ฒด๋ฅผ ์ ์ฅํ ์์ฑ ์ถ๊ฐ
|
271 |
+
}
|
272 |
+
|
273 |
+
update() {
|
274 |
+
// ์ด๋
|
275 |
+
this.x += this.speed;
|
276 |
+
// ๋ฐ์ฌ (1์ด์ 5๋ฐ)
|
277 |
+
const now = Date.now();
|
278 |
+
if (now - this.lastShot > 200) {
|
279 |
+
this.shoot();
|
280 |
+
this.lastShot = now;
|
281 |
+
}
|
282 |
+
return this.x < canvas.width;
|
283 |
+
}
|
284 |
|
285 |
+
shoot() {
|
286 |
+
// ์นด์ดํธ๋ค์ด์ด ์์๋๋ฉด ์ฌ์์ค์ธ ์๋ฆฌ๋ฅผ ์ ์ง
|
287 |
+
if (isCountingDown) {
|
288 |
+
if (this.mgSound) {
|
289 |
+
this.mgSound.pause();
|
290 |
+
this.mgSound.currentTime = 0;
|
291 |
+
}
|
292 |
+
this.hasPlayedSound = false; // ์๋ฆฌ ์ฌ์ ์ํ ์ด๊ธฐํ
|
293 |
+
}
|
294 |
+
// ์นด์ดํธ๋ค์ด ์ค์ด ์๋ ๋๋ง ์๋ฆฌ ์ฌ์
|
295 |
+
else if (!this.hasPlayedSound) {
|
296 |
+
this.mgSound = new Audio('bf109mg.ogg');
|
297 |
+
this.mgSound.play().catch(error => console.error('Audio play failed:', error));
|
298 |
+
this.hasPlayedSound = true;
|
299 |
+
}
|
300 |
|
301 |
+
bullets.push({
|
302 |
+
x: this.x + Math.cos(this.angle) * 30,
|
303 |
+
y: this.y + Math.sin(this.angle) * 30,
|
304 |
+
angle: this.angle,
|
305 |
+
speed: 10,
|
306 |
+
isEnemy: false,
|
307 |
+
damage: weapons.machinegun.damage,
|
308 |
+
size: weapons.machinegun.bulletSize
|
309 |
+
});
|
310 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
311 |
}
|
312 |
class JU87 {
|
313 |
constructor() {
|
|
|
338 |
// ์นด์ดํธ๋ค์ด ์ค์ด ์๋ ๋๋ง ์๋ฆฌ ์ฌ์
|
339 |
if (!this.hasPlayedMGSound && !isCountingDown) {
|
340 |
const mgSound = new Audio('ju87mg.ogg');
|
341 |
+
mgSound.volume = 1.0;
|
342 |
mgSound.currentTime = 0;
|
343 |
mgSound.play().catch(error => console.error('Audio play failed:', error));
|
344 |
this.hasPlayedMGSound = true;
|
|
|
568 |
supportUnits = [];
|
569 |
lastSupportSpawn = 0;
|
570 |
|
571 |
+
// ์นด์ดํธ๋ค์ด ์์
|
572 |
startCountdown();
|
573 |
|
574 |
+
// ์นด์ดํธ๋ค์ด์ด ๋๋๋ฉด JU87 ์คํฐ
|
575 |
+
setTimeout(() => {
|
576 |
+
if (hasJU87) {
|
577 |
+
supportUnits.push(new JU87());
|
578 |
+
lastJU87Spawn = Date.now();
|
579 |
+
}
|
580 |
+
}, 3000); // 3์ด ํ์ ์คํฐ
|
|
|
|
|
|
|
581 |
}
|
582 |
function startBossStage() {
|
583 |
isBossStage = true;
|