1681-engine / index / mergeTileRects
Function: mergeTileRects() ​
ts
function mergeTileRects(
width,
height,
solid
): TileRect[];Defined in: src/physics/tileBodies.ts:29
Covers the solid cells of a tile grid with as few rectangles as a cheap greedy pass finds: runs along each row, then a run is grown downwards while the row below has exactly the same run. A floor becomes one box and a wall one tall box, so a body sliding along either crosses no seam to snag on.
Parameters ​
| Parameter | Type |
|---|---|
width | number |
height | number |
solid | (tx, ty) => boolean |
Returns ​
TileRect[]