I am making a clock in my game. After roughly 60 seconds it changes to the next number. I use the subroutine below to change the clock image when it needs to. My problem is that the images flickers when displayed, and I don't want that.
My code;
def display_night_clock():
global var_clock
global var_6_am
if var_hide == False:
if var_6_am == False:
if var_clock == 1:
screen.blit(image_12_am, (1266, 0))
pygame.display.update()
if var_clock == 2:
screen.blit(image_1_am, (1266, 0))
pygame.display.update()
if var_clock == 3:
screen.blit(image_2_am, (1266, 0))
pygame.display.update()
if var_clock == 4:
screen.blit(image_3_am, (1266, 0))
pygame.display.update()
if var_clock == 5:
screen.blit(image_4_am, (1266, 0))
pygame.display.update()
if var_clock == 6:
screen.blit(image_5_am, (1266, 0))
pygame.display.update()
if var_clock == 7:
screen.blit(image_7_am, (1266, 0))
pygame.display.update()
var_6_am = True
var_clock = 1
I just call this subroutine in my main loop. I have used this method of displaying images before in my program in my other subroutines, and those images don't flicker. But for some reason these images flicker.