Merge pull request #149 from UnBuiltTree/icon-remake

Icon Remake
This commit is contained in:
evanpelle
2025-03-06 18:49:19 -08:00
committed by GitHub
30 changed files with 21 additions and 12 deletions
+10 -1
View File
@@ -321,7 +321,16 @@ export function euclDistFN(
root: TileRef,
dist: number,
): (gm: GameMap, tile: TileRef) => boolean {
return (gm: GameMap, n: TileRef) => gm.euclideanDist(root, n) <= dist;
return (gm: GameMap, n: TileRef) => {
// shifts the root tiles coordinates by -0.5 so that its “center”
// center becomes the corner of four pixels rather than the middle of one pixel.
// just makes things based off even pixels instead of odd. Used to use 9x9 icons now 10x10 icons etc...
const rootX = gm.x(root) - 0.5;
const rootY = gm.y(root) - 0.5;
const dx = gm.x(n) - rootX;
const dy = gm.y(n) - rootY;
return Math.sqrt(dx * dx + dy * dy) <= dist;
};
}
export function manhattanDistFN(