How to set timer.time_left without change wait time?

Godot Version

4.3

Question

how to set timer.time_left without change wait time?
i have timer that have 1sec wait_time, then i use it to count how many second i have like this

var second : float = 0
func _on_timer_timeout() -> void:
	second += 1
	print(second )

here the problem:
when i save the game , i need to recond how many second i have
but there chance when the moment i save the game and my timer still have timer.time_left ,
example if still have 0.5sec time_left
when i load the game i want first second to be already 0.5 sec time left
how should i do it
if i do like this , wait_time also change to 0.5sec

var second : float 
var timeleft : float = 0.5
func  _on_load() -> void:
	timer.start(time_left)

func _on_timer_timeout() -> void:
	second += 1
	print(second )

i want wait_time still 1sec ,after first second
how should i do?

var second : float 
var timeleft : float = 0.5
func  _on_load() -> void:
	timer.start(time_left)

func _on_timer_timeout() -> void:
	if time.wait_time < 1.0: time.wait_time = 1.0
	second += 1
	print(second )
1 Like

thank you

1 Like