Each tilemap layer has its own Z: an offset added to the Z of the placed tilemap, like a child's Z to its parent, default 0 keeps the previous order (layers right after their map, in list order), a negative Z sorts a layer below the map, on a tie layers keep their list order and follow the hierarchy against other objects; editor scene and game use the same order through the new pure function drawSlots, a tilemap draws into one container per layer, and the tilemap panel gains a Z field for the selected layer with one undo step per change (#174)
game-maker / gate (push) Successful in 1m58s
game-maker / suite (push) Successful in 6m50s

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
adminandClaude Opus 5 committed 2026-09-19 14:03:20 +02:00
1 parent 5385d9e152
commit 47eea2f6e4
13 files changed
+389 -38

No files matched your search

+33
View File
@@ -452,6 +452,39 @@ export async function tilemap(t) {
JSON.stringify({ layers, renamedRow, nameNow }),
);
// 40p. The Z field below the name gives the painted layer a z of its own, added to the map's
// (#174): at −5 the upper layer is sorted in below the map itself and below the lower layer.
const zField = await inPanel(t, '__gm.tilemap.layerZAt()');
if (zField) {
await click(zField.x, zField.y);
await press('a', { ctrl: true });
await typeText('-5');
await press('Enter');
}
await settle();
await shot('40-tilemap-layer-z');
const withZ = await json(`__gm.tilemap.layers(${JSON.stringify(made.id)})`);
const slot = (order, id) => order.indexOf(id);
const orderZ = await json('__gm.drawOrder()');
const upperSlot = `${MAP_OBJECT}#${withZ[1].id}`;
const lowerSlot = `${MAP_OBJECT}#${withZ[0].id}`;
await undo();
await settle();
const orderBack = await json('__gm.drawOrder()');
const zBack = (await json(`__gm.tilemap.layers(${JSON.stringify(made.id)})`))[1].z;
check(
'the Z field sorts the painted layer below the map and the other layer, and undo puts it back',
withZ[1].z === -5 &&
withZ[0].z === 0 &&
slot(orderZ, upperSlot) >= 0 &&
slot(orderZ, upperSlot) < slot(orderZ, MAP_OBJECT) &&
slot(orderZ, upperSlot) < slot(orderZ, lowerSlot) &&
zBack === 0 &&
slot(orderBack, MAP_OBJECT) < slot(orderBack, lowerSlot) &&
slot(orderBack, lowerSlot) < slot(orderBack, upperSlot),
JSON.stringify({ withZ, orderZ, orderBack, zBack }),
);
// Pixels again, so the animation is cut down to one step for the reading, as in 40e.
await mutate("__gm.state.project.assets.find((a) => a.id === 'at-grass').pictures = ['at-floor-1']");
await settle();