mwg API
    Preparing search index...

    Class DialogueStage

    A dialogue scene: a backdrop, characters standing in front of it, and whoever is speaking picked out from the rest.

    This is the presentation the tile map is not: a still image with figures on it, the mode nearly every RPG drops into for a conversation that matters, and the whole of how a visual novel looks.

    It draws only the scene. The words go in a MessageBox from mwg/ui, so a game gets the same dialogue box whether it is talking to a shopkeeper on a tile map or running a scripted scene here.

    import { DialogueStage } from '@datamoc/mw_games/two-d';
    import type { Texture } from 'pixi.js';
    import type { SpriteSheet } from '@datamoc/mw_games/two-d/render';

    declare const backdropTexture: Texture;
    declare const heroSheet: SpriteSheet;

    const stage = new DialogueStage(1280, 720);
    stage.defineCharacter('hero', { sheet: heroSheet, expressions: { neutral: 0, happy: 1 } });

    await stage.setBackdrop(backdropTexture);
    await stage.show('hero', { at: 'center', expression: 'happy' });

    Hierarchy

    • Container
      • DialogueStage
    Index
    dimAmount: number = 0.45

    how far a character is darkened while someone else is speaking, 0 to 1

    • Picks out whoever is speaking by dimming everyone else.

      A multiply tint is exactly right here: it darkens without changing hue, so a dimmed character reads as standing back rather than as being a different colour.

      Parameters

      • id: string | null

      Returns void

    • Changes the backdrop.

      The old one stays underneath while the new one fades in over it, so the scene never flashes through to an empty stage mid-transition.

      Parameters

      • texture: Texture
      • fade: number = 0.4

      Returns Promise<void>