Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | pferft |
Hi everyone,
I wonder if maybe someone had a similar problem once.
Holding down my button creates a timer which sends a signal after 1 second.
func _process(delta):
timer += delta
if Input.is_action_pressed("mousebuttonclick"):
if timer >= 1.0 and not being_pressed:
being_pressed = true
print("button held for 1.0 secs")
emit_signal("timer_finished")
The signal starts an animation above the button, a bar filling up. The idea is: releasing the button within the first second opens a popup#1, holding it until the bar is full will open a popup#2.
The process can be canceled which will interrupt the filling-animation, replacing it with a “canceled”-animation (the bar blinking shortly).
Both popups and the fill-bar-animations are all packed in their own scenes.
All this works smootly until I once hold the button for popup#2 to open. After closing this popup, when klicking and holding the button again, the counter starts, the print shows up, but the fill-bar-animation does not. (This problem does not occur with popup#1.)
Cancelling, however, will show the blinking animation and only after that a new press/hold shows the fill-bar-animation again as it should be! (Until opening popup#2 again…)
I have no idea what could cause that omitting the animation at that point. Is the signal not being sent? Is it not received? Some loop somewhere not finished?
I tried get_node("FillupAnimPlayer").stop(true)
, different signal paths, pushing a very short “invisible”-animation in between, timer = 0
in places… nothing helped.
Does this seem familiar? Suggestions would be much appreciated.