cutechicken commited on
Commit
18ca0cd
·
verified ·
1 Parent(s): 4bed589

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +5 -9
index.html CHANGED
@@ -470,15 +470,11 @@ const defaultPlayerStats = {
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() {
 
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() {