It's hard to say without more code, but...
With the code you posted, when your Globals.timeLeft
value is <= 0
, you'll start processing the else
side of that code block. There, you set Globals.timeLeft = 0
, play some music, and do some other things.
Now, until something resets Globals.timeLeft
to a positive value again, every frame will process that else
block of code. So, it'll continue to set Globals.timeLeft = 0
, start playing your music again, and everything else there.
I'm not sure what the intent is here, but I assume you don't want to reprocess that else
block in every frame after your counter reaches 0 - which is what's happening now.