Skip to content

SpawnTilemapOptions

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

Options for spawnTilemap.

optional anchor?: "center" | "top-left"

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

Anchor for spawned tile sprites. 'top-left' (default) places the tile’s top-left corner at the grid-aligned position — no extra transform components are needed for H/V flips. 'center' centres the sprite on the tile cell so per-tile flip/rotate transforms pivot correctly (required when applying tileTransform in onTile).


atlas: string

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

Atlas registry key written into each spawned sprite’s RenderableDef.atlas. Must match a key previously registered via buildTilemapAtlas or directly on TextureAtlasRegistry.


map: TmxMap

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

Parsed TMX map whose visible tile layers supply the tile grid.


optional onTile?: (id, gid, flags, layerIndex) => void

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

Called for each spawned tile entity after the standard components are written. Consumers use this to add extra components — for example modules/transform!RotationDef + modules/transform!ScaleDef resolved from the full D4 dihedral group via tileTransform.

EntityId

The newly created entity.

number

The flag-masked global tile ID (0 = empty, skipped).

number

Per-tile flip bitfield (TMX_FLIP_H | V | D).

number

Zero-based layer index (bottom layer = 0).

void


world: EcsWorld

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

World to spawn tile entities into.