Added captcha progress bar

This commit is contained in:
2025-07-06 20:06:49 +01:00
parent db7faca3d9
commit f625c80fd3

View File

@ -204,6 +204,12 @@ class Game(gameUtils.Game):
self.surf.blit(gameUtils.centre(self.currentCaptchaImg, self.size)) #draws the text to center of the screen
#TODO: actually scale the text, however, more work needs to be done on the actual function of the game first
if self.currentCaptcha is not None:
x1 = self.size[0] / 2 - self.currentCaptchaImg.size[0] / 2
y = self.size[1] / 2 + self.currentCaptchaImg.size[1] / 2
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)
if self.timerLength != 0:
timeLeft = self.timerLength - (time.perf_counter() - self.timerStart)
normalisedTimeLeft = max(timeLeft / self.timerLength, 0)