cutechicken commited on
Commit
703ebee
ยท
verified ยท
1 Parent(s): 87ee926

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +78 -90
index.html CHANGED
@@ -210,35 +210,25 @@
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,59 +255,59 @@
265
  return Date.now() - this.startTime > this.duration;
266
  }
267
  }
268
- class SupportUnit {
269
- constructor(yPosition) {
270
- this.x = 0;
271
- this.y = yPosition;
272
- this.speed = 5;
273
- this.lastShot = 0;
274
- this.width = 100;
275
- this.height = 100;
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๋ฐœ)
295
- const now = Date.now();
296
- if (now - this.lastShot > 200) {
297
- this.shoot();
298
- this.lastShot = now;
299
- }
300
- return this.x < canvas.width;
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
-
311
- bullets.push({
312
- x: this.x + Math.cos(this.angle) * 30,
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 = 2.0;
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
- // 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;
 
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;