The following code causes my game to shut down. I do not know what is the problem with this code.
pygame.font.init()
font=pygame.font.Font(None, 36)
text = font.render("Game Over", 1, (10, 10, 10))
background_image.blit(text, (0,0))
pygame.font.quit()
I want to display this text in the top left corner of the screen. Thanks.
It works for me –
I’d guess your platform is not getting along quite well with the “None” font you are passing – try passing a complete path to a (in disk) font file (a TTF file) as the first parameter to
pygame.font.Font–Also, save your script and run it from the command shell to get hold of proper error messages.
Also, there is no need to call “pygame.font.quit” – just call “pygame.quit” when exiting your program.