0 votes

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.

in Engine by (460 points)

1 Answer

0 votes

Well, for all who might stumble over the same problem: I just replaced all the little animations with new ones and voilĂ , problem solved.

I'm not sure why, but it might be connected to my copying the whole project-folder (keeping the original as a backup I won't touch anymore, which I regularly do albeit not having caused such troubles yet). Maybe the animation player got confused...?

by (460 points)

You should probably take the time to get to know Git (or other SCM software). That would make managing various versions of a project simple, allow you to easily move between different versions, tests, and experiments - as well as serve as a cloud-based backup.

Well worth the time investment IMO...

Thanks for the tip, I'll look into it!

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.