simple-visual-novel
    Preparing search index...

    Class Scene

    Represents a scene in the visual novel.

    A scene is a container for a sequence of actions (dialogue, character visibility, etc.) that occur in a specific location. Each scene can have a background image and contains characters that can interact within it.

    Scenes are added to a Script and played in the order they are added.

    Scene

    // Create a scene with a background
    const parkScene = new Scene("park", { background: "park.png" });

    // Add characters and dialogue
    const alice = new Character("Alice", "alice.png");
    parkScene.add(alice, { position: "center" });
    alice.say("What a beautiful day!");

    // Add to script
    script.addScene(parkScene);
    Index

    Constructors

    Accessors

    Methods

    Constructors

    • Creates a new Scene instance.

      Parameters

      • id: string

        Unique identifier for the scene

      • Optionaloptions: SceneOptions = {}

        Scene configuration options

        Options for scene configuration.

        • Optionalbackground?: string

          Background image URL

      Returns Scene

    Accessors

    • get id(): string

      Gets the scene's unique identifier.

      Returns string

      The scene ID

    Methods

    • Adds a character to the scene. The character will be shown automatically.

      Parameters

      • character: Character

        The character to add

      • Optionaloptions: { position?: Position; size?: Size }

        Optional add options

        • Optionalposition?: Position

          Position for the character

        • Optionalsize?: Size

          Size for the character

      Returns void

    • Adds an action to the scene's action queue.

      Actions are processed in the order they are added. This method is typically called internally by character methods like say(), show(), and hide(), but can be called directly for advanced use cases.

      Parameters

      Returns void

      // Manually add a dialogue action
      scene.addAction({
      type: "dialogue",
      character: alice,
      text: "Hello!",
      options: { effect: "typewriter" }
      });