marble3 / SpeechBubble
Class: SpeechBubble
Defined in: src/bubble.ts:24
A speech bubble anchored to a point in the world, usually above an entity: HTML drawn over the canvas, so it follows the entity and always faces the viewer.
The game's label layer puts it on the page (BaseGame.labelRenderer), so its element enters the DOM on the next rendered frame, not when it is attached.
Constructors
Constructor
new SpeechBubble(
opts?):SpeechBubble
Defined in: src/bubble.ts:30
Parameters
opts?
SpeechBubbleOptions = {}
Returns
SpeechBubble
Properties
object
readonlyobject:CSS2DObject
Defined in: src/bubble.ts:26
The scene object that carries the bubble. Move it to move the anchor.
Methods
attachTo()
attachTo(
entity):this
Defined in: src/bubble.ts:118
Puts the bubble above an entity, which it then follows.
Parameters
entity
Returns
this
detach()
detach():
this
Defined in: src/bubble.ts:123
Returns
this
setChoices()
setChoices(
label,options,onPick):this
Defined in: src/bubble.ts:83
Shows a prompt with a button per option, and calls onPick with the one chosen. Needs interactive: true. With a LookAtCursor the player picks by aiming at an option and clicking.
Parameters
label
string
options
string[]
onPick
(choice) => void
Returns
this
setText()
setText(
text):this
Defined in: src/bubble.ts:74
Shows plain text, replacing what the bubble held.
Parameters
text
string
Returns
this
setVisible()
setVisible(
visible):this
Defined in: src/bubble.ts:128
Parameters
visible
boolean
Returns
this