Timer question

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

I have a basic 2d grid with a side UI, I want to have a 60 second countdown timer that ends the turn and starts a new turn. Ending the turn is handled by the gamemanager script and there is a Timer node with a TimerLabel subnode as a subnode of the UI scene.

First I can’t figure out yet how to make the Timer node control the text in the TimerLabelnode.

Second I am wondering how to make the End_Turn function in gamemanager be called when the timer event hits 0 sec.

Like usual maybe this is typical in gamedev I find all kinds of examples for everything except what I want to do in my concept.

And of course what is best practice, would it be better to just have the timer part of the mainscene which has the gamemanager script attached to it? It seems it belongs with the UI scene but does that make it more difficult to interface with the gamemanager?

:bust_in_silhouette: Reply From: SteveSmith

The timer node emits a signal when it has counted down. Add a method that listens for this signal and add the code you need in that method.