blob: 0e8c4cedf1dce35f2edec5909f7f1290fb666044 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
class_name TextBubble
extends Node2D
@export var text: String
@export var options: Array[String]
signal answered(text: String)
func _ready() -> void:
find_child("Label").text = text
var hbox: HBoxContainer = find_child("HBoxContainer")
var first = true
for option in options:
var btn = Button.new()
btn.text = option
hbox.add_child(btn)
btn.connect("pressed", func (): answered.emit(option))
if first:
btn.grab_focus.call_deferred()
first = false
|