Skip to content

Add speech bubble functionality to Actor class#29

Merged
Null000 merged 2 commits intomainfrom
claude/add-actor-speech-bubble-PZBEv
Feb 21, 2026
Merged

Add speech bubble functionality to Actor class#29
Null000 merged 2 commits intomainfrom
claude/add-actor-speech-bubble-PZBEv

Conversation

@Null000
Copy link
Copy Markdown
Owner

@Null000 Null000 commented Feb 21, 2026

Summary

Added speech bubble display capability to the Actor class, allowing actors to show temporary or persistent text bubbles above their heads during gameplay.

Key Changes

  • Added imports for Graphics and Text from pixi.js to support speech bubble rendering
  • Added three new private properties to track speech bubble state:
    • speechBubble: Container holding the bubble graphics and text
    • speechBubbleTimeout: Timer reference for auto-hiding bubbles
    • resolveSpeechBubble: Promise resolver for async bubble display
  • Implemented showSpeechBubble(text, duration) method that:
    • Creates a rounded rectangle bubble with a tail pointing downward
    • Renders text with word wrapping (150px width, 14px font)
    • Supports both temporary bubbles (auto-hide after duration) and persistent bubbles (duration = -1)
    • Returns a Promise that resolves when the bubble is hidden
  • Implemented hideSpeechBubble() method that:
    • Clears any pending timeout
    • Removes and destroys the bubble from the display tree
    • Resolves the pending Promise if one exists
  • Updated update() method to position speech bubbles relative to the actor, accounting for sprite height and screen shake effects

Implementation Details

  • Speech bubbles are positioned above the actor's head using pivot point calculations
  • Bubbles feature a white background with dark gray border and rounded corners (8px radius)
  • The tail is centered and points downward (10px height, 8px width)
  • Text is rendered with Arial font and black color, with automatic word wrapping
  • Proper cleanup ensures no memory leaks from timeouts or display objects

https://claude.ai/code/session_01H51CcJUAJW28hdAUZT4Rdg

Adds showSpeechBubble(text, duration) async method that renders a
white rounded-rect bubble with tail above the actor. Duration is in
seconds; passing -1 keeps the bubble visible until hideSpeechBubble()
is called manually. The bubble follows the actor's bob and shake
animations.

https://claude.ai/code/session_01H51CcJUAJW28hdAUZT4Rdg
Adds text input, duration input, and three buttons (Show Bubble,
Show Bubble (-1), Hide Bubble) to the actors test page for
interactive testing of the new speech bubble feature.

https://claude.ai/code/session_01H51CcJUAJW28hdAUZT4Rdg
@Null000 Null000 merged commit 5709393 into main Feb 21, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants