0 votes

Help needed. Cant use tween, doesnt work. thanks. Help needed asap. Thanks

in Engine by (73 points)

Can you show me your code ?

This is the tween variable declared in beginning, and Tween as in Node is added under Progressbar Node :

onready var tween = get_node("Tween")

This is the code for changing color that i found on questions.

 if time > 0 && time <= 25:
 #Attempt to change color of progress bar as time goes below 25 seconds
     tween.interpolate_method(get_node("Control/ProgressBar").get("custom_styles/fg"), "set_bg_color", Color("0081ff"), 
        #Color("ffffff"), 1, Tween.TRANS_LINEAR, Tween.EASE_IN_OUT)

This is the code that i put in the time constraint, in so the color changes as time in progress bar goes under 25. Thanks.

Did the tween node connect to tween_step signal ?

I dont think it does. When time strikes 25, this error pops up.

Attempt to call function 'interpolate_method' in base 'null instance' on a null instance

That means it can't find the Tween node.

You need to give the correct NodePath.

onready var tween = get_node("Tween")

1 Answer

0 votes
by (206 points)

I tried that. It didn work. I dont know what i am doing wrong.

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 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 webmaster@godotengine.org with your username.