Spaces:
Running
Running
Update index.html
Browse files- index.html +5 -9
index.html
CHANGED
@@ -470,15 +470,11 @@ const defaultPlayerStats = {
|
|
470 |
}
|
471 |
|
472 |
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
return true; // 충돌 발생
|
479 |
-
}
|
480 |
-
}
|
481 |
-
return false; // 충돌 없음
|
482 |
}
|
483 |
|
484 |
shoot() {
|
|
|
470 |
}
|
471 |
|
472 |
|
473 |
+
checkCollision() {
|
474 |
+
if (!this.target) return false;
|
475 |
+
|
476 |
+
const dist = Math.hypot(this.target.x - this.x, this.target.y - this.y);
|
477 |
+
return dist < (this.width + this.target.width) / 2;
|
|
|
|
|
|
|
|
|
478 |
}
|
479 |
|
480 |
shoot() {
|