mwg API
    Preparing search index...

    Class TiledSprite

    A texture that repeats/scrolls to fill a shape, rather than stretching - a parallax background, a scrolling water or lava tile. TilingSprite's own tilePosition/tileScale already covers the "scrolling tile layer" need in full; this is a name, not new behaviour.

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

    declare const waterTexture: Texture2D;

    const water = new TiledSprite({ texture: waterTexture, width: 320, height: 96 });
    water.tilePosition.x -= 12; // scroll it a little each frame, from update(dt)

    Hierarchy

    • TilingSprite
      • TiledSprite
    Index
    • Parameters

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

        The options for creating the tiling sprite.

      Returns TiledSprite

    • Parameters

      • texture: Texture
      • width: number
      • height: number

      Returns TiledSprite

      since 8.0.0