I am just starting out on pygame, and wondering how a message can linger in pygame without affecting the loop. Let's say I want the message to display for 5 seconds then disappear, but the game loop will still keep running when it happens. I tried using time.sleep and clock, but those will completely pause the loop until the message stops appearing. How do I make it so that the message will display while the game loop is still running?
Simplified example:
def message_linger():
#message output code here
time.sleep(4)
def game_loop():
#some pygame junk
message_linger
pygame.display.update()
clock.tick(60)
game_loop()