Changed when timer is drawn
This commit is contained in:
2
game.py
2
game.py
@ -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]
|
||||||
|
|||||||
Reference in New Issue
Block a user