Add Zelda-like typewriter effect to the NPC dialog box - #2
Open
moufmouf wants to merge 3 commits into
Open
Conversation
The step text is now revealed character by character (25ms/char). Clicking the button while the text is typing reveals it instantly instead of advancing, like in classic RPG dialogs; only a click on a fully revealed text advances to the next step, so the main script's per-step hooks are unaffected by skip clicks. The not-yet-typed remainder stays in the DOM as an invisible span, so line-wrapping and layout never shift during the animation. Also adds the now-required `closable` property to the pre-existing "Plan & Aide" modal call, following an iframe-api-typings bump. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
A click anywhere on the box (text, avatar, background) now triggers the same action as the button: complete the typewriter reveal, else advance to the next step, else close. The click handler moved from the button to the box; button clicks bubble to it, so they keep working and fire once. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Space triggers the same reveal/next/close cascade as a click. Held-key repeats are ignored, and the keydown is default-prevented so a focused button's native space activation cannot fire the action twice. Keys reach the iframe once it has focus (after a first click on the box). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #1.
What
The dialog text is now revealed character by character (25 ms/char), Zelda-style:
dialogBoxEvent, so the main script's per-steponDisplayhooks (camera pans) are unaffected.The speed is one constant (
TYPEWRITER_INTERVAL_MSinsrc/dialog-box/iframe.ts) if 25 ms feels too fast/slow.Also
src/main.ts: the pre-existing "Plan & Aide"openModalcall now passes theclosableproperty, required after the@workadventure/iframe-api-typingsbump that came with the lockfile update in #1 — without ittsc(and thusnpm run buildmap) fails.Testing
Verified with the mock-WA harness in a browser: partial reveal visible, skip-click reveals instantly without emitting events, advance/close events unchanged,
tsc+npm run buildmappass.🤖 Generated with Claude Code