'Not sure how to blit font with a variable onto a surface, pygame

trying to blit onto the screen a font with a variable - the score you have achieved - onto the screen after dying.

BLACK = (0, 0, 0)
font_small = pygame.font.SysFont("Verdana", 20)
scoreMsg = "Your score: {0}".format(SCORE)
show_score = font_small.render(scoreMsg, True, BLACK)

later on I call the show_score variable like this:

screen.blit(show_score, (30, 400))

here is the full code: https://pastebin.com/5RnShSCG

edit: i forgot to mention. the text "Your score:" shows up on the screen, but the variable is always 0, even if score is higher.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source