At this moment, I can only display text once I stop updating and drawing sprites. In the code below (which is actually the game loop), you can see how if
GAMEOVER == True (gameloop stops drawing), the text "Game Over!" is displayed. But if I try to display any text while drawing and updating, it doesn't appears until I stop drawing the sprites. In fact, the frist block to display text ("My Game!") isn't shown, as I said, until the gameloop stops drawing. I need to display some info like, name of char, instructions, etc while the game is running, so, how can I render text in every loops and frames?
The game loop:
while True: myfont = pygame.font.SysFont("monospace", 30) label = myfont.render("My Game!", 1, (255, 255, 0)) SCREEN.blit(label, (500, 400)) if PLAYER.healthBase <= 0: GAMEOVER = True #True para que se acabe la partida if not GAMEOVER: charsGroup.update(time_passed) npcsGroup.update(time_passed) mapTilesGroup.draw(SCREEN) charsGroup.draw(SCREEN) npcsGroup.draw(SCREEN) drawBullets() for event in pygame.event.get(): if event.type == pygame.QUIT: pygame.quit() sys.exit() time_passed = freq.tick(0) /1000. if GAMEOVER: myfont = pygame.font.SysFont("monospace", 30) label = myfont.render("GAME OVER!", 1, (255, 255, 0)) SCREEN.blit(label, (400, 300)) pygame.display.flip()