The tile list in the tilemap section is a palette of pictures: each tile shows its lone tile (the four convex corners for floor and wall, the picture itself for none) with its name below, laid out with the image-picker grid (#139)
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4c411c1ff3
commit
bfbcbe604c
9 files changed
+331
-28
No files matched your search
@@ -112,6 +112,33 @@ export async function tilemap(t) {
|
||||
section.tools && section.grass && Boolean(section.layers),
|
||||
JSON.stringify(section),
|
||||
);
|
||||
// The tiles are a grid of pictures (#139), and each shows its block's lone tile: the four convex
|
||||
// corners, read off the palette in one call like a cell of the map.
|
||||
await inInspector(t, '__gm.tilemap.tileButtonAt("at-grass")');
|
||||
const swatch = await json(`(() => {
|
||||
const s = __gm.tilemap.tileSwatch("at-grass");
|
||||
if (!s) return null;
|
||||
const q = s.picture.w / 4;
|
||||
const points = [[q, q], [3 * q, q], [q, 3 * q], [3 * q, 3 * q]]
|
||||
.map(([x, y]) => [Math.round(s.picture.x + x), Math.round(s.picture.y + y)]);
|
||||
return { columns: s.columns, read: points.map(([x, y]) => __gm.pixelAt(x, y)) };
|
||||
})()`);
|
||||
const lone = [
|
||||
[0, 2],
|
||||
[3, 2],
|
||||
[0, 5],
|
||||
[3, 5],
|
||||
].map(([qx, qy]) => quadColour('floor', qx, qy));
|
||||
check(
|
||||
'the palette shows a tile as its picture, the lone tile of the block',
|
||||
swatch !== null && swatch.read.every((colour, i) => colourDistance(colour, lone[i]) <= 12),
|
||||
JSON.stringify({ swatch, want: lone }),
|
||||
);
|
||||
check(
|
||||
'and puts several tiles side by side in the inspector',
|
||||
swatch !== null && swatch.columns >= 3,
|
||||
JSON.stringify(swatch),
|
||||
);
|
||||
// Clicked through the hook rather than by its text: the tile's own row in the asset panel
|
||||
// reads "Grass" as well, and a click there would only select the tile.
|
||||
check(
|
||||
|
||||
Reference in new issue
Block a user