Capture Hud signal directly from main script?

On a whim I decided to try to directly connect the Hud pause_game signal from the main.gd script.

Put this in the _ready()
game.hud.pause_game.connect(_on_hud_pause_game)

Created this:

func _on_hud_pause_game():
	print("Hud signal captured from Main")

This seems to work. Is this a bad practice in general? If so, why not do this rather than what is being taught (chaining signals from grand-child, child, to parent)?

1 Like

hi Jovar,

probably a design choice at the time.

but i can see the way it was put together using the chaining method. my thoughts would be that each signal is created as that self contained scene is initialised as scenes are loaded in bottom > up.
that way each link in the chain is completed as its loaded up until it gets to the main root scene node.

but i also like the look of the . (dot) operator that you have, as it helps in showing pretty clearly where the signal method is located.

cheers for sharing that one, never thought of trying it that way.

Darren

1 Like

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms