mwg API
    Preparing search index...

    Class Node2D

    A plain grouping container under an MWG-owned name, for the common "just group some children" need Scene2D.stage itself covers for the whole scene - a sub-layer inside it (a HUD strip, a creature layer, a popup stack) still needs its own constructible class. Container2D (Types2D.ts) is itself a value re-export of the same underlying class, so new Container2D() also works; Node2D exists as the name this module and its own doc comments actually use, so a game reads one name rather than two for the same thing.

    A bare re-export under this name, deliberately: Pixi's own Container already does everything this needs, so the point is not to add behaviour but to give a game a name it can import without naming pixi.js itself.

    import { Node2D, Shape2D } from '@datamoc/mw_games/two-d/render';

    const hud = new Node2D();
    hud.addChild(new Shape2D().rect(0, 0, 100, 20).fill(0x202020));
    hud.x = 12;
    hud.y = 12;

    Hierarchy (View Summary)

    Index
    • Parameters

      • Optionaloptions: ContainerOptions<ContainerChild>

      Returns Node2D