A tile gains Collision scale: below 1 each blocking cell pulls in on the sides without a blocking neighbour and stays flush towards its neighbours, so a wall of bushes becomes a narrower wall without gaps and the inner corner of an L closes cleanly; above 1 the cell grows at its open sides; on several layers the largest value counts, and the merged rectangles work in fractions of a cell with exactly the old result at 1 (#140)
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4728f4fab5
commit
bffa508ee7
6 files changed
+366
-74
No files matched your search
@@ -735,6 +735,39 @@ export async function tilemap(t) {
|
||||
stopped && Math.abs(stopped.x - -170) < 0.01,
|
||||
`world x=${stopped?.x}`,
|
||||
);
|
||||
|
||||
// Collision scale (#140), typed into the tile's field: 0.5 draws the boxes in by a quarter cell on
|
||||
// their open sides only – the 3 × 3 block stays one rectangle – and lets the crate that much closer.
|
||||
await select({ kind: 'asset', assetId: 'at-grass' });
|
||||
await settle();
|
||||
const scaleRow = await json("__gm.inspectorField('Collision scale')");
|
||||
if (scaleRow) {
|
||||
await click(scaleRow.x, scaleRow.y);
|
||||
await press('a', { ctrl: true });
|
||||
await typeText('0.5');
|
||||
await press('Enter');
|
||||
}
|
||||
await settle();
|
||||
const drawnIn = await json(`__gm.tilemap.solids(${JSON.stringify(MAP_OBJECT)})`);
|
||||
check(
|
||||
'a tile has a Collision scale field; at 0.5 the outline is drawn in on the open sides, the block still one rectangle',
|
||||
(await t.asset('at-grass'))?.props.collisionScale === 0.5 &&
|
||||
JSON.stringify(drawnIn?.rects) ===
|
||||
JSON.stringify([
|
||||
{ x: 0.25, y: 0.25, w: 2.5, h: 2.5 },
|
||||
{ x: 4.25, y: 0.25, w: 0.5, h: 0.5 },
|
||||
]),
|
||||
JSON.stringify({ scaleRow, props: (await t.asset('at-grass'))?.props, drawnIn }),
|
||||
);
|
||||
await evaluate('__gm.state.select(null)');
|
||||
await settle();
|
||||
const closer = await playAgainstMap();
|
||||
check(
|
||||
'with the smaller box the crate comes a quarter cell closer before it stops',
|
||||
closer && Math.abs(closer.x - -158) < 0.01,
|
||||
`world x=${closer?.x}`,
|
||||
);
|
||||
await mutate("delete __gm.state.project.assets.find((a) => a.id === 'at-grass').props.collisionScale");
|
||||
await mutate("__gm.state.project.assets.find((a) => a.id === 'at-grass').props.solid = false");
|
||||
const passed = await playAgainstMap();
|
||||
check(
|
||||
|
||||
Reference in new issue
Block a user