Skip to content

1681-engine / index / tileBodies

Function: tileBodies() ​

ts
function tileBodies(
   width, 
   height, 
   tileSize, 
   solid, 
   options?
): Body[];

Defined in: src/physics/tileBodies.ts:66

Static boxes for the solid tiles of a grid, ready for PhysicsWorld.add. Each box marks the faces that lie wholly against more solid tiles as internal, so a body is never pushed out through a face that is inside the ground (the seam between a floor and the wall standing on it).

Outside the grid counts as open, so the edges of the map collide like any other face.

Parameters ​

ParameterType
widthnumber
heightnumber
tileSizenumber
solid(tx, ty) => boolean
optionsTileBodiesOptions

Returns ​

Body[]

Released under the MIT License.