Answer the question
In order to leave comments, you need to log in
How to avoid overlapping text on top of each other in pygame?
I am writing a game in pygame. Faced with the fact that you need to display the speed of the target in the status bar (the speed increases with hitting the target). Wrote like this:
pygame.font.init()
speed_font = pygame.font.Font('freesansbold.ttf', 24)
info_string.blit(speed_font.render(u"Скорость: "+ str(zet.speed), True, (0, 255, 0)), (10, 5))
Answer the question
In order to leave comments, you need to log in
I suspect you don't clear the screen before drawing, so you're left with the picture from the last frame when you update the speed value. You need to fill the entire screen with a solid color at the beginning of the drawing method, then nothing will overlap.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question