harvest/game/scripts/dialogue_speaker.gd
Forrest c6daf3d217 #33: opening intro cutscene
OpeningIntro (game/scripts/opening_intro.gd) plays on every New vacation
(not Continue, not when hosting co-op): the farmers leave in their loaded
station wagon, "Later that night....", a bickering UFO crew drops a part
whose blue flash brings the scarecrow (hung on a post in its T-pose) to life,
the UFO zooms off, then the loading screen and the first morning's sign.
Hold Space / Enter / A (or E, or the mouse button) 1 s to skip from any
stage; Escape pauses it; Restart the night skips it; Save & quit clears it.
It ends with the farm exactly as new_campaign() leaves it.

Hooks: ReviewPanel keeps the sign down while the intro has the farm (and
only focuses Start when the sign is up); DialogueDirector holds its
conversations and the sign, then intro_over() plays night 1's morning
conversations before the sign; Tutorial hides; FarmAudio gets set_scene /
end_scene (ambience and music held by a cutscene) and stop_cue (the morning
stinger plays with the sign instead); Main wires new_vacation(intro),
blocked, resume's freeze, restart and to_menu.

Tests: test_intro (45 checks); test_flow skips the new intro. Tool:
game/tools/capture_intro.gd saves a frame per stage for the timing review.
Docs: README, RULES, LAYOUT (staging points), PLAYTEST.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 22:54:24 -04:00

52 lines
2.3 KiB
GDScript

class_name DialogueSpeaker
extends Resource
## Someone who talks in a conversation (Conversation, shown by DialogueBox): their name, their
## picture (the talking head, standing behind the box's top edge), the side of the box they stand
## on, and how their name and words look. Save one per character (game/resources/dialogue/
## speakers/) and use it in every line they say; a line (DialogueLine) can change the look of its
## own words, and its text takes BBCode ([i]...[/i], [color=red], ...).
enum HeadSide { LEFT, RIGHT }
## Where the words sit on the paper: on the speaker's side (as their name is), or set.
enum Align { SIDE, LEFT, CENTER, RIGHT }
@export var display_name := ""
## The talking head (a picture with a transparent background), scaled to portrait_height.
@export var portrait: Texture2D
## Optional mouth flaps: shown in turn with portrait while the words are being written.
@export var talk_frames: Array[Texture2D] = []
## Placeholder art while there's no portrait: one of Sketch.ICONS ("portrait" is the scarecrow,
## "thief" an alien, "breaker" a robot, "crow", "ufo", "farmer" the farmer in his straw hat,
## "farmers_wife" the farmer's wife).
@export var icon := ""
@export var side: HeadSide = HeadSide.LEFT
@export_group("Portrait")
@export_range(60.0, 800.0, 1.0, "suffix:px") var portrait_height := 360.0
## Nudges the head from its place (+x right, +y down).
@export var portrait_offset := Vector2.ZERO
## Mirrors the picture (to face the other way).
@export var flip := false
@export_group("Name")
@export var name_color := Sketch.PAPER_INK
@export_range(8, 120) var name_size := 50
@export_group("Words")
## Empty: the handwritten font of the morning sign (Sketch.font()).
@export var font: Font
@export var text_color := Sketch.PAPER_INK
@export_range(8, 120) var font_size := 36
@export var italic := false
@export var bold := false
@export var align: Align = Align.SIDE
## How fast the words are written; 0 shows each line at once.
@export_range(0.0, 200.0, 1.0, "suffix:letters/s") var letters_per_second := 45.0
@export_group("Voice")
## A short blip played as the words are written (none: silent).
@export var voice: AudioStream
@export_range(0.25, 4.0, 0.01) var voice_pitch := 1.0
@export_range(-40.0, 12.0, 0.5, "suffix:dB") var voice_volume_db := -10.0
## A blip every this many letters.
@export_range(1, 10) var voice_every := 2