added description for the SelectionEgg, added .json files for each currently added egg
This commit is contained in:
parent
6d199b2e36
commit
4e0efbabd9
@ -81,8 +81,15 @@ class SelectionEgg(pygame.sprite.Sprite):
|
|||||||
def __init__(self, egg_color):
|
def __init__(self, egg_color):
|
||||||
pygame.sprite.Sprite.__init__(self)
|
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)
|
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.
|
# Load the egg from the given color and get the bounding rectangle for the image.
|
||||||
self.images = []
|
self.images = []
|
||||||
for filename in os.listdir(image_directory):
|
for filename in os.listdir(image_directory):
|
||||||
|
@ -0,0 +1 @@
|
|||||||
|
{"description": "Blue egg description"}
|
@ -0,0 +1 @@
|
|||||||
|
{"description": "Rainbow egg description"}
|
@ -0,0 +1 @@
|
|||||||
|
{"description": "Red egg description"}
|
Loading…
Reference in New Issue
Block a user