diff --git a/js/class.js b/js/class.js index c73dd75..5f1b4ab 100644 --- a/js/class.js +++ b/js/class.js @@ -103,20 +103,16 @@ class Player } } -function dist(A,B) -{ - return Math.sqrt((A.x-B.x)**2+(A.y-B.y)**2); -} - class Bullet { - constructor (x,y,dx,dy) + constructor (x,y,dx,dy,id) { this.x=x; this.y=y; this.dx=dx; this.dy=dy; this.deleted=false; + this.parentId=id; } update(dt) @@ -132,7 +128,7 @@ class Bullet { if(!this.deleted) { - if(player!=null && dist(player,this)