I am a nubie in pygame and python overall. I started a simple helicopter game project yesterday but i cant figure out why i cant display a message.
I tried using different code formats and also tried moving a few lines here and there but still could not get it to work.
def display_gameover():
pygame.font.init()
font = pygame.font.SysFont(None, 100)
text = font.render("GAME OVER", True, red)
extRect = text.get_rect()
screen.blit(text,(screen_height//2, screen_width//2))
pygame.display.update()
time.sleep(2)
if x > screen_width - heli_width or x < 0 or y > screen_height - heli_height or y < 0:
display_gameover()
game_loop()
I defined display_gameover
and called it as shown above. However when i try to run the code, everything works fine, apart from the fact that during the 2 second wait time, nothing is displayed.