Update index.html
Browse files- index.html +9 -5
index.html
CHANGED
@@ -470,11 +470,15 @@ const defaultPlayerStats = {
|
|
470 |
}
|
471 |
|
472 |
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
|
|
|
|
|
|
|
|
478 |
}
|
479 |
|
480 |
shoot() {
|
|
|
470 |
}
|
471 |
|
472 |
|
473 |
+
checkCollision() {
|
474 |
+
// 모든 적과의 충돌을 체크 (보스 포함)
|
475 |
+
for (let enemy of enemies) {
|
476 |
+
const dist = Math.hypot(enemy.x - this.x, enemy.y - this.y);
|
477 |
+
if (dist < (this.width + enemy.width) / 2) {
|
478 |
+
return true; // 충돌 발생
|
479 |
+
}
|
480 |
+
}
|
481 |
+
return false; // 충돌 없음
|
482 |
}
|
483 |
|
484 |
shoot() {
|