collisions

This commit is contained in:
Atsuyo-INSA 2023-12-05 15:18:25 +01:00
parent cfc0ac7c0d
commit 4b42336b06

View file

@ -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()