Godot Version
4.4
Question
Hi Guys,
I’m working on a simple system where the progress bar emits a custom signal when it’s empty or less than 0. The issue I’m currently facing is everything works first time round but when it’s reset via a control node with a script attached the signal doesn’t emit again.
I wanted to ask if I’m missing something fundamental with signals or just the way Godot works or if it’s a bug.
Below is the code for my progress bar
extends ProgressBar
class_name ATBBarsignal barready
var speed = 5.0
var triggered = falsefunc _ready():
value = max_valuefunc _process(delta):
value = clamp(value - 10.0 * delta * speed, 0, max_value)
print(“value:”, value, “triggered:”, triggered)if is_zero_approx(value) and not triggered:
print(“>>> SIGNAL EMITTED”)
emit_signal(“barready”)
triggered = truefunc reset_bar():
print(“>>> reset_bar called”)
value = max_value
triggered = false
Below is the code for my control node
extends Control
@onready var atb: ATBBar = $“…/BattleMenu/Player Box/ATB” # ← CORRECT TYPE!func _ready():
atb.connect(“barready”, Callable(self, “_on_atb_barready”))func _on_atb_barready():
print(“yes bar ready”)
atb.reset_bar()
Thanks to anyone who answers or offers their two cents