Godot Version
Godot-4
Question
Just need help with a countdown timer that is on the game screen where the player can see it. I'm making a horror game called "10 minutes or die."
The character needs to escape a facility that is losing air and slowly suffocates the player but if he makes it out before 10 minutes we lives and wins the game. And if he doesn’t make it the game will say game over and it will go back to the loading screen. I just can’t seem to find out how to make a timer for the game. I tried to watch videos and read articles but none of them I could understand. So if you guys can help that would be great!
Have you tried adding a Timer node to your game? Could you explain more about what you’ve tried to do?
I have tried to add a timer node but I can’t get it on the screen where the player can see it and don’t now how to get it to count down.
Right the Timer node is only in charge of keeping time; you will need UI such as a Label node to show it’s progress.
For example this script will present the selected timer’s time_left
in minutes and seconds
extends Label
@export var target_timer: Timer
func _process(_delta: float) -> void:
var minutes: float = target_timer.time_left / 60
var seconds: float = fmod(target_timer.time_left, 60)
text = "%d:%02d" % [minutes, seconds]
1 Like