10.7: The “Levels” Data Structure

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.

    10.7: The “Levels” Data Structure

    The level object contains a game state object (which will be the state used when the level first starts), a map object, and a few other values. The level object itself is a dictionary with the following keys:

    • The value at the key 'width' is an integer of how many tiles wide the entire map is.
    • The value at the key 'height' is an integer of how many tiles tall the entire map is.
    • The value at the key 'mapObj' is the map object for this level.
    • The value at the key 'goals' is a list of two-integer tuples with the XY coordinates of each goal space on the map.
    • The value at the key 'startState' is a game state object used to show the starting position of the stars and player at the start of the level.

    This page titled 10.7: The “Levels” Data Structure was last modified on Mon, 11 Nov 2019 01:45:30 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.