![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | wokeraccoon |
Currently on my player script there’s this code that emits its current health when the game starts:
signal update_health(h)
func _ready():
emit_signal("update_health",health)
I’ve been trying to connect it to the top node on my tree so it can update the GUI by using this code (player node is currently on a group called ‘Players’):
onready var in_game_HUD = $CanvasLayer/InGameHUD
onready var player = get_tree().get_nodes_in_group("Player")[0]
func _ready():
player.connect("update_health",self,"function")
print(player.is_connected("update_health",self,"update_health_UI"))
func update_health_UI(h):
in_game_HUD.update_health_GUI(h)
While the “is_connected()” returns true, it doesn’t seem to run the “update_health_UI” and I dont seem to understand why, since connecting this signal with Godot’s GUI works, but sadly I cannot use this method for my project.