Implement positioning for revealables

This commit is contained in:
Dennis Schoepf 2021-08-01 09:47:35 +02:00
parent 4b26687724
commit 8ad126c8d8
5 changed files with 30 additions and 1 deletions

View file

@ -89,3 +89,18 @@ export function getRevealablesforSubproject(
type: RevealableTypes[revealable.type],
}));
}
export function generateRevealableCoords(): Coordinates[] {
const areaWidth = mp5.width / 3;
const rowHeight = mp5.height / 2;
// Max. 6 revealables one in each area
return [
{ x: mp5.random(25, areaWidth), y: mp5.random(25, rowHeight) },
{ x: mp5.random(areaWidth, areaWidth * 2), y: mp5.random(25, rowHeight) },
{ x: mp5.random(areaWidth * 2, areaWidth * 3), y: mp5.random(25, rowHeight) },
{ x: mp5.random(25, areaWidth), y: mp5.random(rowHeight, rowHeight * 2) },
{ x: mp5.random(areaWidth, areaWidth * 2), y: mp5.random(rowHeight, rowHeight * 2) },
{ x: mp5.random(areaWidth * 2, areaWidth * 3), y: mp5.random(rowHeight, rowHeight * 2) },
];
}