–1 vote

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?

Godot version v3.5.stable.official [991bb6ac7]
in Engine by (21 points)

1 Answer

0 votes

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.

by (1,053 points)
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.