8.4: The Usual Setup 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.

    8.4: The Usual Setup Code
    # Tetromino (a Tetris clone)
    # By Al Sweigart al@inventwithpython.com
    # http://inventwithpython.com/pygame
    # Released under a "Simplified BSD" license
    
    import random, time, pygame, sys
    from pygame.locals import *
    
    FPS = 25
    WINDOWWIDTH = 640
    WINDOWHEIGHT = 480
    BOXSIZE = 20
    BOARDWIDTH = 10
    BOARDHEIGHT = 20
    BLANK = '.'
    

    These are the constants used by our Tetromino game. Each box is a square that is 20 pixels wide and high. The board itself is 10 boxes wide and 20 boxes tall. The BLANK constant will be used as a value to represent blank spaces in the board’s data structure.


    This page titled 8.4: The Usual Setup Code was last modified on Mon, 18 May 2020 08:25:49 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.