Skip to main content
Engineering LibreTexts

7.15: The Start Screen

  • Page ID
  • def showStartScreen():
        titleFont = pygame.font.Font('freesansbold.ttf', 100)
        titleSurf1 = titleFont.render('Wormy!', True, WHITE, DARKGREEN)
        titleSurf2 = titleFont.render('Wormy!', True, GREEN)
        degrees1 = 0
        degrees2 = 0
        while True:

    When the Wormy game program first begins running, the player doesn’t automatically begin playing the game. Instead, a start screen appears which tells the player what program they are running. A start screen also gives the player a chance to prepare for the game to begin (otherwise the player might not be ready and crash on their first game).

    The Wormy start screen requires two Surface objects with the "Wormy!" text drawn on them. These are what the render() method calls create on lines 3 [130] and 4 [131]. The text will be large: the Font() constructor function call on line 2 [129] creates a Font object that is 100 points in size. The first "Wormy!" text will have white text with a dark green background, and the other will have green text with a transparent background.

    Line 8 [135] begins the animation loop for the start screen. During this animation, the two pieces of text will be rotated and drawn to the display Surface object.