Reset Timer on death

I wanted the timer to reset on player death so I added

time_left = level_time
hud.set_time_label(time_left)

to the reset_player function and called reset_player() on timeout or on hitting a trap.

It works ok, sometimes on reset the first second changes immediately (e.g. 5 to 4), I guess because the timer is still running, even when I’ve reset time_left? If that makes sense.

1 Like

ye i noticed that too. Dont know a fix yet. Maybe stop the timer when you die and immediatly let it run again right after it? Could be more complicated than it should be, but i think that would work.

1 Like

Ok this fixed it. Just add

timer_node.stop()
timer_node.start()

at the top of func reset_player()

Privacy & Terms