Land on legs
This commit is contained in:
@@ -524,9 +524,10 @@
|
|||||||
|
|
||||||
const edge = z.find(({ edge: pts, node: ee }) => {
|
const edge = z.find(({ edge: pts, node: ee }) => {
|
||||||
const str = `${pts.xa},${pts.ya} ${pts.xb},${pts.yb}`;
|
const str = `${pts.xa},${pts.ya} ${pts.xb},${pts.yb}`;
|
||||||
return detectEdgeCollision(position, pts, shipRadius);
|
const r = Object.is(slope(pts), 0) && s.gearDown ? shipRadius + 1 : shipRadius;
|
||||||
}
|
|
||||||
);
|
return detectEdgeCollision(position, pts, r);
|
||||||
|
});
|
||||||
|
|
||||||
return edge || actualCorner;
|
return edge || actualCorner;
|
||||||
}
|
}
|
||||||
@@ -617,7 +618,7 @@
|
|||||||
if (!current && s.collision) {
|
if (!current && s.collision) {
|
||||||
const baseSlope = slope(s.collision.edge);
|
const baseSlope = slope(s.collision.edge);
|
||||||
if (Object.is(baseSlope, 0) && s.gearDown) s.isLanded = true;
|
if (Object.is(baseSlope, 0) && s.gearDown) s.isLanded = true;
|
||||||
const clPos = collisionPosition(s.collision.edge, s.position, s.velocity, shipRadius);
|
const clPos = collisionPosition(s.collision.edge, s.position, s.velocity, s.gearDown && Object.is(baseSlope, 0) ? shipRadius + 1 : shipRadius);
|
||||||
s.velocity = { x: 0, y: 0 };
|
s.velocity = { x: 0, y: 0 };
|
||||||
s.position = { x: clPos.x, y: clPos.y }
|
s.position = { x: clPos.x, y: clPos.y }
|
||||||
s.node.style.transform = `translate(${s.position.x}px, ${s.position.y}px)`;
|
s.node.style.transform = `translate(${s.position.x}px, ${s.position.y}px)`;
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 30 KiB |
Reference in New Issue
Block a user