Topic was automatically imported from the old Question2Answer platform.
Asked By
Alleywaygentleman
So i want to make a day and night cycle that goes from am to pm, or at the very least 0 to 23, but i’m completely new to godot and when i look online, all i see are real time clocks which are neat but not what i needed, any tips?
I hope you don’t take it personally but you sound pretty young. I recommend if you are as young as I think you are and don’t understand my link that you ask your math teach about remainder/modulo as that is the answer to your problem.
What the above code will do is that anytime you reach 24, time will loop back to 0 without needing any logic.
if you don’t what to use modulo, use an if statement
func update_time():
if time == 24:
time = 0
else:
time = time + 1
Thanks! and it’s fine, didn’t realized i sounded young, never heard of remainder/modulo, school never taught that. didn’t think math would come in when it came to making a clock XD