mwg API
    Preparing search index...

    Class Sprite2D

    A plain, untinted sprite under an MWG-owned name - the neutral case TintedSprite is not: that class exists to add the per-sprite multiply-and-add colour transform, so it is the wrong reach for a sprite that needs no colour effect at all. Until this existed, that one ordinary case had no two-d-owned way to construct it, and a game reached for two-d/pixi-interop.ts's Sprite (or pixi.js directly) even for the single most common sprite there is.

    import { Sprite2D } from '@datamoc/mw_games/two-d/render';
    import type { Texture2D } from '@datamoc/mw_games/two-d/render';

    declare const heroTexture: Texture2D;

    const hero = new Sprite2D(heroTexture);
    hero.x = 40;
    hero.y = 60;

    Hierarchy

    • Sprite
      • Sprite2D
    Index
    • Parameters

      • Optionaloptions: Texture<TextureSource<any>> | SpriteOptions

        The options for creating the sprite.

      Returns Sprite2D