diff --git a/pocket_friends/game_files/game.py b/pocket_friends/game_files/game.py index f9efb56..9fa430d 100644 --- a/pocket_friends/game_files/game.py +++ b/pocket_friends/game_files/game.py @@ -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): diff --git a/pocket_friends/game_files/resources/data/egg_info/blue.json b/pocket_friends/game_files/resources/data/egg_info/blue.json new file mode 100644 index 0000000..780dd86 --- /dev/null +++ b/pocket_friends/game_files/resources/data/egg_info/blue.json @@ -0,0 +1 @@ +{"description": "Blue egg description"} \ No newline at end of file diff --git a/pocket_friends/game_files/resources/data/egg_info/rainbow.json b/pocket_friends/game_files/resources/data/egg_info/rainbow.json new file mode 100644 index 0000000..e4f43a2 --- /dev/null +++ b/pocket_friends/game_files/resources/data/egg_info/rainbow.json @@ -0,0 +1 @@ +{"description": "Rainbow egg description"} \ No newline at end of file diff --git a/pocket_friends/game_files/resources/data/egg_info/red.json b/pocket_friends/game_files/resources/data/egg_info/red.json new file mode 100644 index 0000000..bbf92c9 --- /dev/null +++ b/pocket_friends/game_files/resources/data/egg_info/red.json @@ -0,0 +1 @@ +{"description": "Red egg description"} \ No newline at end of file