Godot 4.4
Question
I have a question and I need sombody to help me code it . I am making a game where you have to remember peoples names at a party however I want the textbubles to appear next to the characters head but it is not working with the current dialouge manager example balloon and I AM NOT AN experienced enough coder to code it on my own How would I do this
just spawn the Control Node with text inside as the child of the character?
else you may want to look at RemoteTransform2D
so the text bubbles follows the node2d transform of the character
no, that won’t work. because Control does not inherit position from Node2D.
first do not mix Controls with other nodes (they must all be green), otherwise the chain breaks and problems arise.
you need to either reference the character to the bubble or the bubble to the character.
placing the bubble as child of the character could be an option (maybe) then you have to set it’s position to the character’s global_position (or an attachment point, or add an offset).
@onready var bubble : Control = $Bubble
a better option is to have the Bubbles as children of a Control. then create an autoload with a reference to your control, and register it when it is created.
then when your characters are added, they get this control and spawn a bubble, then keep a reference.
manager.gd autoload
var bubble_container : Control
main_control.gd
func _ready() -> void:
Manager.bubble_container = self
character.gd
var bubble : Control
func _ready() -> void:
#we use a preload packedscene
bubble = bubble_package.instantiate()
Manager.bubble_container.add_child(bubble)
for changing position it must be done in process:
func _process(_delta : float) -> void:
bubble.position = global_position