Skip to content

spawnTilemap

spawnTilemap(opts): number

Defined in: src/modules/tilemap/spawn.ts:56

Spawns one sprite entity per non-empty tile across every visible layer of the map. Each entity receives PositionDef (grid-aligned), RenderableDef (sprite, with flipH / flipV resolved from H/V flags), and RenderOrderDef (layer index so upper layers draw on top).

Diagonal flips (TMX_FLIP_D) are not resolved automatically — they cannot be expressed as flipH + flipV alone. Consumers needing the full 8-orientation D4 dihedral group should set anchor: 'center', register RotationDef + ScaleDef, and apply tileTransform inside the SpawnTilemapOptions#onTile callback.

SpawnTilemapOptions

number

The number of tile entities spawned.