diff --git a/html/images/space.svg b/html/images/space.svg index 6090f26..e2dd591 100644 --- a/html/images/space.svg +++ b/html/images/space.svg @@ -360,18 +360,16 @@ return hc <= shipRadius; } - function detectCornerCollision([xc, yc], corners) { - return corners.some(([x, y]) => { - cornerPt.x = x - xc; - cornerPt.y = y - yc; + function detectCornerCollision([xc, yc], [x, y]) { + cornerPt.x = x - xc; + cornerPt.y = y - yc; - return shipBody.isPointInFill(cornerPt); - }); + return shipBody.isPointInFill(cornerPt); } function detectCollisions(position, walls, edges) { return [ - [walls, wall => detectCornerCollision(position, wall)], + [walls, wall => wall.some(corner => detectCornerCollision(position, corner))], [edges, edge => detectEdgeCollision(position, edge)] ].some(([t, f]) => t.some(f)) }