9.9: The Usual Text Creation Code

Making Games with Python and Pygame · LibreTexts

0%

Contents

    Text

    Size
    100%
    Theme
    Typeface
    Line length
    Spacing

    From LibreTexts, under CC BY-NC-SA 3.0, as the source states it; its equations are written in TeX, which the PDF shows typeset. This page at LibreTexts.

    9.9: The Usual Text Creation Code
        # 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).


    This page titled 9.9: The Usual Text Creation Code was last modified on Mon, 18 May 2020 08:25:01 GMT and is shared under a CC BY-NC-SA 3.0 license and was authored, remixed, and/or curated by Al Sweigart via source content that was edited to the style and standards of the LibreTexts platform.