0

I have the following error showing in the console when trying to run my platformer game in pygame:

pygame.error: font not initialised

I have tried to display fonts as follows...

font_score = pygame.font.SysFont('Arial', 30)

I have tried adding a ttf. file to call from but it will not go into the files (I am using replit) and I have tried using different file names such as Arial as I assume it will have standard fonts in the system such as arial.

I have tried using None instead of 'Arial' too, thinking it would revert to a standard font but to no avail. Same error shows each time.

Please help, thanks in advance.

Matt
  • 45
  • 7

1 Answers1

0

The error is pretty starightforward, you need to initalise pygame.font

pygame.font.init()
CopyrightC
  • 857
  • 2
  • 7
  • 15
  • I already had pygame.init. I have added pygame.font.init() as suggested and it now shows in the game and is solved, thank you. Could anyone explain why pygame.init didn't work? – Matt Jun 05 '21 at 14:04