mwg API
    Preparing search index...

    Class TerrainGraphicsLayer

    Draws the placements resolveTerrainGraphics resolves - the renderer half of [terrain_graphics] that the rule pass deliberately leaves to a caller.

    It is one Sprite2D per placement, added in layer order (a stable sort, so placements sharing a layer keep the order the rule pass emitted, which is its row-major walk). That is what makes a rule's multi-cell art one rule's images at their own offsets rather than something TileMap's one-sprite-per-cell grid would have to hold, and what lets a rotated or probabilistic rule vary how a transition looks without the layer knowing any of that.

    Z-order between this layer and the rest of a scene is the caller's, as it is for Halo: add the layer before a unit to sit terrain under it, or after to overlay.

    import { TerrainGraphicsLayer, resolveTerrainGraphics } from '@datamoc/mw_games/two-d/render';

    const placements = resolveTerrainGraphics(2, 1, [], () => new Set(['land']));
    const layer = new TerrainGraphicsLayer({
    placements,
    project: (x, y, dx, dy) => ({ x: (x + dx) * 32, y: (y + dy) * 32 }),
    });
    layer.setPlacements(placements);

    Hierarchy (View Summary)

    Index