How to display timer countdown in a label node?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Macryc

Hi. I’m having trouble with the timer and label nodes, please help.

I have a timer in a scene. I want to create another scene to hold a label node which will display time_left. I’ve created the label node but don’t seem to be able to pass the timer countdown into it. I’ve tried get_node to fetch the timer from the other scene into the label node but I keep getting errors. What is the best way to create a label node with a countdown?

:bust_in_silhouette: Reply From: Rotsuoy

How I would personally do it, is add the timer to the label node, and in the script to make the countdown timer add set_text(str(minutes) + ":" + str(seconds) + ":" + str(milliseconds)) to make the label node display the numerical contents of whatever my variables were for the minutes, seconds, and milliseconds. See if that works?

Yea this is the simplest way to show a timer I guess but in my case the timer I have in my level scene has all sorts of functions (like you can increase or decrease it by a value depending on what happens in the game). The timer does some things in the game itself therefore I am really keen on picking up the data from this particular timer, not just any timer.

UPDATE: I’ve figured it out and it was a rather silly mistake on my part. Get node did work for the timer, I just forgot to instance the label scene! duh

Macryc | 2020-01-13 15:45

That’s the nature of coding for you. 9 times out of 10 it’s something you totally forgot to do borking up everything. lol

Rotsuoy | 2020-01-13 15:47