Hi, I can't get my head around the signal syntax with the use of a singleton. I've created the singleton (Events) and set it up to autoload:
Events script:
signal health_updated(msg)
Healthbar script (in a hud):
Events.connect("health_updated", self, "_health_updated")
In the player script I have
func _set_health(value):
var prev_health = health
health = clamp(value, 0, max_health)
if health != prev_health:
Events.emit_signal("health_updated")
From what I've gathered this is the formula for emitting signals:
Events.emit_signal("health_updated", {destination = destination})
But how do I set the "destination = destination" parts- what's missing to actually update the Healthbar?
Input much appreciated - specifics even more.
Thanks!