Skip to main content
Engineering LibreTexts

9.9: The Usual Text Creation Code

  • Page ID
    14627
  •     # create the surfaces to hold game text
        gameOverSurf = BASICFONT.render('Game Over', True, WHITE)
        gameOverRect = gameOverSurf.get_rect()
        gameOverRect.center = (HALF_WINWIDTH, HALF_WINHEIGHT)
    
        winSurf = BASICFONT.render('You have achieved OMEGA SQUIRREL!', True, WHITE)
        winRect = winSurf.get_rect()
        winRect.center = (HALF_WINWIDTH, HALF_WINHEIGHT)
    
        winSurf2 = BASICFONT.render('(Press "r" to restart.)', True, WHITE)
        winRect2 = winSurf2.get_rect()
        winRect2.center = (HALF_WINWIDTH, HALF_WINHEIGHT + 30)
    

    These variables contain Surface objects with the "Game Over", "You have achieved OMEGA SQUIRREL!", and "(Press "r" to restart.)" text that appears on the screen after the game ends (with either the player losing or winning).

    • Was this article helpful?