I have a global timer autoload in my game that I use to keep track of time. The timer starts right when the player hits the "Start Game" button. I need my animation player ( which is playing my Day Night Cycle) to play the cycle right when the Clock is no longer zero seconds ( NOT when the player hits the button)
I can see my global timers time increasing in the output screen so it works. My day / night cycle also works WHEN I don't have it attached to the global timer ( when I simply just play it in the ready function of my main script).
Below is my code:
/////////////////// My Main Scripts Code ////////////////////////////////////////
extends Control
func _ready():
if WorldClock.ExactWorldClockTime >= 1:
$AnimationPlayer.play("DayNight")
print("DayNightCycle Begins Now!")
I wanted my "If" statement to start it but it won't, it doesn't even print the statement " Daynight cycle begins now"
///////////////////// My Timer ////////////////////////////////////////////////
extends Node
onready var WorldTimer
onready var ExactWorldClockTime = 0
func _ready():
WorldTimer = Timer.new()
WorldTimer.set_one_shot(false)
WorldTimer.set_timer_process_mode(Timer.TIMER_PROCESS_IDLE)
WorldTimer.set_wait_time(1)
WorldTimer.connect("timeout", self, "_on_Clock_timeout")
add_child(WorldTimer)
func _WorldTimerStart():
WorldTimer.start()
func _on_Clock_timeout():
ExactWorldClockTime += 1
print_debug(ExactWorldClockTime)
pass
Please Help! Thank You! :)