diff --git a/js/class.js b/js/class.js index 1b0abd7..cfd02a3 100644 --- a/js/class.js +++ b/js/class.js @@ -75,26 +75,25 @@ class Player this.x += dx*dt; this.y += dy*dt; - for(let square in squares) - { + squares.forEach(square => { if(square.collide(this)) { - this.x-=dx; - this.y-=dy; + this.x-=dx*dt; + this.y-=dy*dt; this.dir=0; return; } - } - for(let circle in circles) - { + }); + + circles.forEach(circle => { if(circle.collide(this)) { - this.x-=dx; - this.y-=dy; + this.x-=dx*dt; + this.y-=dy*dt; this.dir=0; return; } - } + }); } get angle()