Rename some function params for clarity
This commit is contained in:
@@ -74,12 +74,12 @@
|
|||||||
</g>
|
</g>
|
||||||
|
|
||||||
<!-- <polygon class="wall" points="20,20 40,20 40,40 20,40" /> -->
|
<!-- <polygon class="wall" points="20,20 40,20 40,40 20,40" /> -->
|
||||||
<polygon class="wall" points="-10,-30 -10,-40 30,-50 60,-30 80,0 150,0 150,10 60,50 -10,40 -20,20 20,20 20,-20" />
|
<!-- <polygon class="wall" points="-10,-30 -10,-40 30,-50 60,-30 80,0 150,0 150,10 60,50 -10,40 -20,20 20,20 20,-20" /> -->
|
||||||
<!-- <polygon class="wall" points="-130,-80 -40,-70 -70,-10 -100,40 -120,100" /> -->
|
<!-- <polygon class="wall" points="-130,-80 -40,-70 -70,-10 -100,40 -120,100" /> -->
|
||||||
<!-- <g> -->
|
<g>
|
||||||
<!-- <polygon class="wall" points="-130,-80 -40,-70 -70,-10" /> -->
|
<polygon class="wall" points="-130,-80 -40,-70 -70,-10" />
|
||||||
<!-- <polygon class="wall" points="50,70 90,-10 130,70" /> -->
|
<polygon class="wall" points="50,70 90,-10 130,70" />
|
||||||
<!-- </g> -->
|
</g>
|
||||||
|
|
||||||
<g id="triangles"></g>
|
<g id="triangles"></g>
|
||||||
<g id="edges"></g>
|
<g id="edges"></g>
|
||||||
@@ -360,8 +360,8 @@
|
|||||||
return hc <= shipRadius;
|
return hc <= shipRadius;
|
||||||
}
|
}
|
||||||
|
|
||||||
function detectCornerCollision([xc, yc], pts) {
|
function detectCornerCollision([xc, yc], corners) {
|
||||||
return pts.some(([x, y]) => {
|
return corners.some(([x, y]) => {
|
||||||
cornerPt.x = x - xc;
|
cornerPt.x = x - xc;
|
||||||
cornerPt.y = y - yc;
|
cornerPt.y = y - yc;
|
||||||
|
|
||||||
@@ -369,9 +369,9 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function detectCollisions(position, corners, edges) {
|
function detectCollisions(position, walls, edges) {
|
||||||
return [
|
return [
|
||||||
[corners, corner => detectCornerCollision(position, corner)],
|
[walls, wall => detectCornerCollision(position, wall)],
|
||||||
[edges, edge => detectEdgeCollision(position, edge)]
|
[edges, edge => detectEdgeCollision(position, edge)]
|
||||||
].some(([t, f]) => t.some(f))
|
].some(([t, f]) => t.some(f))
|
||||||
}
|
}
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
Reference in New Issue
Block a user