Spaces:
Running
Running
Update index.html
Browse files- index.html +30 -12
index.html
CHANGED
@@ -315,6 +315,7 @@
|
|
315 |
this.hasPlayedSound = false;
|
316 |
this.hasPlayedMGSound = false;
|
317 |
this.isReturning = false;
|
|
|
318 |
}
|
319 |
|
320 |
selectTarget() {
|
@@ -360,7 +361,6 @@
|
|
360 |
if (!this.isReturning) {
|
361 |
this.isReturning = true;
|
362 |
this.target = null;
|
363 |
-
// ์ค์์ผ๋ก ์ด๋
|
364 |
this.angle = Math.atan2(canvas.height/2 - this.y, canvas.width/2 - this.x);
|
365 |
} else {
|
366 |
this.angle = Math.PI;
|
@@ -380,6 +380,17 @@
|
|
380 |
if (this.target) {
|
381 |
this.angle = Math.atan2(this.target.y - this.y, this.target.x - this.x);
|
382 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
383 |
}
|
384 |
}
|
385 |
|
@@ -529,18 +540,25 @@ function buyTank(tankImg, cost, tankId) {
|
|
529 |
lastJU87Spawn = Date.now(); // ๊ตฌ๋งค ์ฆ์ ์คํฐ ํ์ด๋จธ ์ด๊ธฐํ
|
530 |
}
|
531 |
}
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
}
|
537 |
-
player.health = player.maxHealth;
|
538 |
-
bullets = [];
|
539 |
-
items = [];
|
540 |
-
supportUnits = []; // ์ง์ ์ ๋ ์ด๊ธฐํ
|
541 |
-
lastSupportSpawn = 0; // ์คํฐ ํ์ด๋จธ ์ด๊ธฐํ
|
542 |
-
startCountdown();
|
543 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
544 |
function startBossStage() {
|
545 |
isBossStage = true;
|
546 |
enemies = [];
|
|
|
315 |
this.hasPlayedSound = false;
|
316 |
this.hasPlayedMGSound = false;
|
317 |
this.isReturning = false;
|
318 |
+
this.circleAngle = 0; // ์ํ ๋นํ์ ์ํ ๊ฐ๋ ์ถ๊ฐ
|
319 |
}
|
320 |
|
321 |
selectTarget() {
|
|
|
361 |
if (!this.isReturning) {
|
362 |
this.isReturning = true;
|
363 |
this.target = null;
|
|
|
364 |
this.angle = Math.atan2(canvas.height/2 - this.y, canvas.width/2 - this.x);
|
365 |
} else {
|
366 |
this.angle = Math.PI;
|
|
|
380 |
if (this.target) {
|
381 |
this.angle = Math.atan2(this.target.y - this.y, this.target.x - this.x);
|
382 |
}
|
383 |
+
} else {
|
384 |
+
// ์ ์ด ์์ ๋ ์ํ ๋นํ
|
385 |
+
const centerX = canvas.width / 2;
|
386 |
+
const centerY = canvas.height / 2;
|
387 |
+
const radius = Math.min(canvas.width, canvas.height) / 4; // ์์ ๋ฐ์ง๋ฆ
|
388 |
+
|
389 |
+
this.circleAngle += 0.02; // ์์ด๋ ์๋
|
390 |
+
const targetX = centerX + Math.cos(this.circleAngle) * radius;
|
391 |
+
const targetY = centerY + Math.sin(this.circleAngle) * radius;
|
392 |
+
|
393 |
+
this.angle = Math.atan2(targetY - this.y, targetX - this.x);
|
394 |
}
|
395 |
}
|
396 |
|
|
|
540 |
lastJU87Spawn = Date.now(); // ๊ตฌ๋งค ์ฆ์ ์คํฐ ํ์ด๋จธ ์ด๊ธฐํ
|
541 |
}
|
542 |
}
|
543 |
+
function initRound() {
|
544 |
+
enemies = [];
|
545 |
+
for(let i = 0; i < 1 * currentRound; i++) {
|
546 |
+
enemies.push(new Enemy());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
547 |
}
|
548 |
+
player.health = player.maxHealth;
|
549 |
+
bullets = [];
|
550 |
+
items = [];
|
551 |
+
supportUnits = []; // ์ง์ ์ ๋ ์ด๊ธฐํ
|
552 |
+
lastSupportSpawn = 0; // ์คํฐ ํ์ด๋จธ ์ด๊ธฐํ
|
553 |
+
|
554 |
+
// JU87 ์ด๊ธฐ ์คํฐ ์ถ๊ฐ
|
555 |
+
if (hasJU87) {
|
556 |
+
supportUnits.push(new JU87());
|
557 |
+
lastJU87Spawn = Date.now();
|
558 |
+
}
|
559 |
+
|
560 |
+
startCountdown();
|
561 |
+
}
|
562 |
function startBossStage() {
|
563 |
isBossStage = true;
|
564 |
enemies = [];
|