Skip to main content
Engineering LibreTexts

10.7: The “Levels” Data Structure

  • Page ID
    14668
  • 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.