added description for the SelectionEgg, added .json files for each currently added egg

This commit is contained in:
Nick Dyer 2021-06-04 00:15:01 -04:00
parent 6d199b2e36
commit 4e0efbabd9
4 changed files with 10 additions and 0 deletions

View File

@ -81,8 +81,15 @@ class SelectionEgg(pygame.sprite.Sprite):
def __init__(self, egg_color):
pygame.sprite.Sprite.__init__(self)
# Loads the JSON file of the egg to read in data.
with open(script_dir + '/resources/data/egg_info/{0}.json'.format(egg_color), 'r') as save_file:
json_file = json.load(save_file)
save_file.close()
image_directory = script_dir + '/resources/images/egg_images/{0}'.format(egg_color)
# Gets the description off the egg from the JSON file.
self.description = json_file.get('description')
# Load the egg from the given color and get the bounding rectangle for the image.
self.images = []
for filename in os.listdir(image_directory):

View File

@ -0,0 +1 @@
{"description": "Blue egg description"}

View File

@ -0,0 +1 @@
{"description": "Rainbow egg description"}

View File

@ -0,0 +1 @@
{"description": "Red egg description"}