cutechicken commited on
Commit
b8c5883
ยท
verified ยท
1 Parent(s): a2c3712

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +16 -29
index.html CHANGED
@@ -246,15 +246,15 @@
246
  return Date.now() - this.startTime > this.duration;
247
  }
248
  }
249
- class SupportUnit {
250
  constructor(yPosition) {
251
  this.x = 0;
252
  this.y = yPosition;
253
- this.speed = 5; // ๊ธฐ๋ณธ ์ด๋™ ์†๋„
254
  this.lastShot = 0;
255
  this.width = 100;
256
  this.height = 100;
257
- this.angle = 0;
258
  this.img = new Image();
259
  this.img.src = 'bf109.png';
260
  }
@@ -265,27 +265,12 @@
265
 
266
  // ๋ฐœ์‚ฌ (1์ดˆ์— 5๋ฐœ)
267
  const now = Date.now();
268
- if (now - this.lastShot > 200) { // 200ms = 1์ดˆ์— 5๋ฐœ
269
  this.shoot();
270
  this.lastShot = now;
271
  }
272
 
273
- // ๊ฐ€์žฅ ๊ฐ€๊นŒ์šด ์ ์„ ํ–ฅํ•ด ๊ฐ๋„ ์กฐ์ •
274
- let nearestEnemy = null;
275
- let minDist = Infinity;
276
- enemies.forEach(enemy => {
277
- const dist = Math.hypot(enemy.x - this.x, enemy.y - this.y);
278
- if (dist < minDist) {
279
- minDist = dist;
280
- nearestEnemy = enemy;
281
- }
282
- });
283
-
284
- if (nearestEnemy) {
285
- this.angle = Math.atan2(nearestEnemy.y - this.y, nearestEnemy.x - this.x);
286
- }
287
-
288
- return this.x < canvas.width; // ํ™”๋ฉด ๋‚ด์— ์žˆ์œผ๋ฉด true ๋ฐ˜ํ™˜
289
  }
290
 
291
  shoot() {
@@ -422,16 +407,18 @@ function buyTank(tankImg, cost, tankId) {
422
  document.getElementById('shop').style.display = 'none';
423
  }
424
  }
425
- function initRound() {
426
- enemies = [];
427
- for(let i = 0; i < 1 * currentRound; i++) {
428
- enemies.push(new Enemy());
429
- }
430
- player.health = player.maxHealth;
431
- bullets = [];
432
- items = [];
433
- startCountdown();
434
  }
 
 
 
 
 
 
 
435
  function startBossStage() {
436
  isBossStage = true;
437
  enemies = [];
 
246
  return Date.now() - this.startTime > this.duration;
247
  }
248
  }
249
+ class SupportUnit {
250
  constructor(yPosition) {
251
  this.x = 0;
252
  this.y = yPosition;
253
+ this.speed = 5;
254
  this.lastShot = 0;
255
  this.width = 100;
256
  this.height = 100;
257
+ this.angle = 0; // ํ•ญ์ƒ ์˜ค๋ฅธ์ชฝ์„ ํ–ฅํ•จ
258
  this.img = new Image();
259
  this.img.src = 'bf109.png';
260
  }
 
265
 
266
  // ๋ฐœ์‚ฌ (1์ดˆ์— 5๋ฐœ)
267
  const now = Date.now();
268
+ if (now - this.lastShot > 200) {
269
  this.shoot();
270
  this.lastShot = now;
271
  }
272
 
273
+ return this.x < canvas.width;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
274
  }
275
 
276
  shoot() {
 
407
  document.getElementById('shop').style.display = 'none';
408
  }
409
  }
410
+ function initRound() {
411
+ enemies = [];
412
+ for(let i = 0; i < 1 * currentRound; i++) {
413
+ enemies.push(new Enemy());
 
 
 
 
 
414
  }
415
+ player.health = player.maxHealth;
416
+ bullets = [];
417
+ items = [];
418
+ supportUnits = []; // ์ง€์› ์œ ๋‹› ์ดˆ๊ธฐํ™”
419
+ lastSupportSpawn = 0; // ์Šคํฐ ํƒ€์ด๋จธ ์ดˆ๊ธฐํ™”
420
+ startCountdown();
421
+ }
422
  function startBossStage() {
423
  isBossStage = true;
424
  enemies = [];