Changed when timer is drawn

This commit is contained in:
2025-07-06 20:16:22 +01:00
parent f36bce66e2
commit 3cd2ddbd46

View File

@ -210,8 +210,8 @@ class Game(gameUtils.Game):
x2 = x1 + (self.currentCaptcha.charIdx / len(self.currentCaptcha.chars)) * self.currentCaptchaImg.size[0] x2 = x1 + (self.currentCaptcha.charIdx / len(self.currentCaptcha.chars)) * self.currentCaptchaImg.size[0]
pygame.draw.line(self.surf, (0, 255, 0), (x1, y), (x2, y), 5) pygame.draw.line(self.surf, (0, 255, 0), (x1, y), (x2, y), 5)
if self.timerLength != 0:
timeLeft = self.timerLength - (time.perf_counter() - self.timerStart) timeLeft = self.timerLength - (time.perf_counter() - self.timerStart)
if timeLeft > 0:
normalisedTimeLeft = max(timeLeft / self.timerLength, 0) normalisedTimeLeft = max(timeLeft / self.timerLength, 0)
x = round((1-normalisedTimeLeft) * (self.size[0] // 2)) x = round((1-normalisedTimeLeft) * (self.size[0] // 2))
w = normalisedTimeLeft * self.size[0] w = normalisedTimeLeft * self.size[0]