Basic reveal mechanic

This commit is contained in:
Dennis Schoepf 2021-07-26 17:53:03 +02:00
parent 7e634917bf
commit 4639c22025
8 changed files with 71 additions and 8 deletions

View file

@ -30,6 +30,13 @@ export function isColliding(
);
}
export function shapeCollision(
firstShape: { x: number; y: number; w: number },
secondShape: { x: number; y: number; w: number }
) {
return mp5.dist(firstShape.x, firstShape.y, secondShape.x, secondShape.y) < secondShape.w - 150;
}
export function generateEdgeCoords(existingEdges: Edge[]): Coordinates {
let newCoords: Coordinates;
const existingCoordinates = existingEdges.map(({ x, y }) => ({ x, y }));