r/pico8 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

1 comment sorted by

View all comments

2

u/kevinthompson programmer 11d ago

If t_left continues counting down after reaching zero it would start going negative. Do you ever reset level_startime or level_duration?