Skip to main content
Engineering LibreTexts

9.25: The Game Over Screen

  • Page ID
    14644
  •         else:
                # game is over, show "game over" text
                DISPLAYSURF.blit(gameOverSurf, gameOverRect)
                if time.time() - gameOverStartTime > GAMEOVERTIME:
                    return # end the current game
    

    When the player has died, the "Game Over" text (which is on the Surface object in the gameOverSurf variable) will be shown on the screen for the number of seconds that is in the GAMEOVERTIME constant. Once this amount of time has elapsed, then the runGame() function will return.

    This lets the enemy squirrels continue to be animated and moving around for a few seconds after the player dies and before the next game starts. The "game over screen" in Squirrel Eat Squirrel does not wait until the player presses a key before a new game starts.