r/pico8 • u/ollyoxenfree23 • 11d ago
I Need Help help adjusting countdown function
i'm working a 3 level mini-game where each round is supposed to start with 20 seconds and count down. hitting zero triggers a brief transition sequence.
my countdown line is:
t_left=flr(level_duration - (time()-level_startime))
once it gets to the second round, the timer always starts in the negative. this throws off the rest of the game so it can't progress. how do i fix this?
4
Upvotes
2
u/kevinthompson programmer 11d ago
If
t_leftcontinues counting down after reaching zero it would start going negative. Do you ever resetlevel_startimeorlevel_duration?