From 99cfcf4b486dd35585433cbc600d861eea4e9c54 Mon Sep 17 00:00:00 2001 From: Nick Dyer Date: Sat, 5 Jun 2021 16:36:30 -0400 Subject: [PATCH 01/39] added contentness and metabolism value to eggs --- pocket_friends/game_files/resources/data/egg_info/blue.json | 6 +++++- .../game_files/resources/data/egg_info/rainbow.json | 6 +++++- pocket_friends/game_files/resources/data/egg_info/red.json | 6 +++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/pocket_friends/game_files/resources/data/egg_info/blue.json b/pocket_friends/game_files/resources/data/egg_info/blue.json index 780dd86..376b00e 100644 --- a/pocket_friends/game_files/resources/data/egg_info/blue.json +++ b/pocket_friends/game_files/resources/data/egg_info/blue.json @@ -1 +1,5 @@ -{"description": "Blue egg description"} \ No newline at end of file +{ + "description": "Blue egg description", + "contentness": 10, + "metabolism": 10 +} \ 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 index e4f43a2..7f6c244 100644 --- a/pocket_friends/game_files/resources/data/egg_info/rainbow.json +++ b/pocket_friends/game_files/resources/data/egg_info/rainbow.json @@ -1 +1,5 @@ -{"description": "Rainbow egg description"} \ No newline at end of file +{ + "description": "Rainbow egg description", + "contentness": 10, + "metabolism": 10 +} \ 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 index bbf92c9..fc7e758 100644 --- a/pocket_friends/game_files/resources/data/egg_info/red.json +++ b/pocket_friends/game_files/resources/data/egg_info/red.json @@ -1 +1,5 @@ -{"description": "Red egg description"} \ No newline at end of file +{ + "description": "Red egg description", + "contentness": 10, + "metabolism": 10 +} \ No newline at end of file From 6c52458f41746ce3d1b361078f56c65171588d86 Mon Sep 17 00:00:00 2001 From: Nick Dyer Date: Sat, 5 Jun 2021 18:05:27 -0400 Subject: [PATCH 02/39] revised file structure to be more organized --- pocket_friends/game_files/game.py | 4 ++-- .../data/{egg_info => bloop_info}/blue.json | 0 .../data/{egg_info => bloop_info}/rainbow.json | 0 .../data/{egg_info => bloop_info}/red.json | 0 .../blue => bloops/blue/egg_images}/blue.png | Bin .../dev_egg/egg_images/0.png} | Bin .../dev_egg/egg_images/1.png} | Bin .../images/{egg_images => bloops}/green/green.png | Bin .../images/{egg_images => bloops}/indigo/indigo.png | Bin .../images/{egg_images => bloops}/orange/orange.png | Bin .../rainbow/egg_images}/rainbow.png | Bin .../red => bloops/red/egg_images}/red.png | Bin .../images/{egg_images => bloops}/violet/violet.png | Bin .../images/{egg_images => bloops}/white/white.png | Bin .../images/{egg_images => bloops}/yellow/yellow.png | Bin 15 files changed, 2 insertions(+), 2 deletions(-) rename pocket_friends/game_files/resources/data/{egg_info => bloop_info}/blue.json (100%) rename pocket_friends/game_files/resources/data/{egg_info => bloop_info}/rainbow.json (100%) rename pocket_friends/game_files/resources/data/{egg_info => bloop_info}/red.json (100%) rename pocket_friends/game_files/resources/images/{egg_images/blue => bloops/blue/egg_images}/blue.png (100%) rename pocket_friends/game_files/resources/images/{egg_images/dev_egg/dev_egg_0.png => bloops/dev_egg/egg_images/0.png} (100%) rename pocket_friends/game_files/resources/images/{egg_images/dev_egg/dev_egg_1.png => bloops/dev_egg/egg_images/1.png} (100%) rename pocket_friends/game_files/resources/images/{egg_images => bloops}/green/green.png (100%) rename pocket_friends/game_files/resources/images/{egg_images => bloops}/indigo/indigo.png (100%) rename pocket_friends/game_files/resources/images/{egg_images => bloops}/orange/orange.png (100%) rename pocket_friends/game_files/resources/images/{egg_images/rainbow => bloops/rainbow/egg_images}/rainbow.png (100%) rename pocket_friends/game_files/resources/images/{egg_images/red => bloops/red/egg_images}/red.png (100%) rename pocket_friends/game_files/resources/images/{egg_images => bloops}/violet/violet.png (100%) rename pocket_friends/game_files/resources/images/{egg_images => bloops}/white/white.png (100%) rename pocket_friends/game_files/resources/images/{egg_images => bloops}/yellow/yellow.png (100%) diff --git a/pocket_friends/game_files/game.py b/pocket_friends/game_files/game.py index a0e41ca..53ebab4 100644 --- a/pocket_friends/game_files/game.py +++ b/pocket_friends/game_files/game.py @@ -84,10 +84,10 @@ class SelectionEgg(pygame.sprite.Sprite): self.egg_color = egg_color # 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: + with open(script_dir + '/resources/data/bloop_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/bloops/{0}/egg_images'.format(egg_color) # Gets the description off the egg from the JSON file. self.description = json_file.get('description') diff --git a/pocket_friends/game_files/resources/data/egg_info/blue.json b/pocket_friends/game_files/resources/data/bloop_info/blue.json similarity index 100% rename from pocket_friends/game_files/resources/data/egg_info/blue.json rename to pocket_friends/game_files/resources/data/bloop_info/blue.json diff --git a/pocket_friends/game_files/resources/data/egg_info/rainbow.json b/pocket_friends/game_files/resources/data/bloop_info/rainbow.json similarity index 100% rename from pocket_friends/game_files/resources/data/egg_info/rainbow.json rename to pocket_friends/game_files/resources/data/bloop_info/rainbow.json diff --git a/pocket_friends/game_files/resources/data/egg_info/red.json b/pocket_friends/game_files/resources/data/bloop_info/red.json similarity index 100% rename from pocket_friends/game_files/resources/data/egg_info/red.json rename to pocket_friends/game_files/resources/data/bloop_info/red.json diff --git a/pocket_friends/game_files/resources/images/egg_images/blue/blue.png b/pocket_friends/game_files/resources/images/bloops/blue/egg_images/blue.png similarity index 100% rename from pocket_friends/game_files/resources/images/egg_images/blue/blue.png rename to pocket_friends/game_files/resources/images/bloops/blue/egg_images/blue.png diff --git a/pocket_friends/game_files/resources/images/egg_images/dev_egg/dev_egg_0.png b/pocket_friends/game_files/resources/images/bloops/dev_egg/egg_images/0.png similarity index 100% rename from pocket_friends/game_files/resources/images/egg_images/dev_egg/dev_egg_0.png rename to pocket_friends/game_files/resources/images/bloops/dev_egg/egg_images/0.png diff --git a/pocket_friends/game_files/resources/images/egg_images/dev_egg/dev_egg_1.png b/pocket_friends/game_files/resources/images/bloops/dev_egg/egg_images/1.png similarity index 100% rename from pocket_friends/game_files/resources/images/egg_images/dev_egg/dev_egg_1.png rename to pocket_friends/game_files/resources/images/bloops/dev_egg/egg_images/1.png diff --git a/pocket_friends/game_files/resources/images/egg_images/green/green.png b/pocket_friends/game_files/resources/images/bloops/green/green.png similarity index 100% rename from pocket_friends/game_files/resources/images/egg_images/green/green.png rename to pocket_friends/game_files/resources/images/bloops/green/green.png diff --git a/pocket_friends/game_files/resources/images/egg_images/indigo/indigo.png b/pocket_friends/game_files/resources/images/bloops/indigo/indigo.png similarity index 100% rename from pocket_friends/game_files/resources/images/egg_images/indigo/indigo.png rename to pocket_friends/game_files/resources/images/bloops/indigo/indigo.png diff --git a/pocket_friends/game_files/resources/images/egg_images/orange/orange.png b/pocket_friends/game_files/resources/images/bloops/orange/orange.png similarity index 100% rename from pocket_friends/game_files/resources/images/egg_images/orange/orange.png rename to pocket_friends/game_files/resources/images/bloops/orange/orange.png diff --git a/pocket_friends/game_files/resources/images/egg_images/rainbow/rainbow.png b/pocket_friends/game_files/resources/images/bloops/rainbow/egg_images/rainbow.png similarity index 100% rename from pocket_friends/game_files/resources/images/egg_images/rainbow/rainbow.png rename to pocket_friends/game_files/resources/images/bloops/rainbow/egg_images/rainbow.png diff --git a/pocket_friends/game_files/resources/images/egg_images/red/red.png b/pocket_friends/game_files/resources/images/bloops/red/egg_images/red.png similarity index 100% rename from pocket_friends/game_files/resources/images/egg_images/red/red.png rename to pocket_friends/game_files/resources/images/bloops/red/egg_images/red.png diff --git a/pocket_friends/game_files/resources/images/egg_images/violet/violet.png b/pocket_friends/game_files/resources/images/bloops/violet/violet.png similarity index 100% rename from pocket_friends/game_files/resources/images/egg_images/violet/violet.png rename to pocket_friends/game_files/resources/images/bloops/violet/violet.png diff --git a/pocket_friends/game_files/resources/images/egg_images/white/white.png b/pocket_friends/game_files/resources/images/bloops/white/white.png similarity index 100% rename from pocket_friends/game_files/resources/images/egg_images/white/white.png rename to pocket_friends/game_files/resources/images/bloops/white/white.png diff --git a/pocket_friends/game_files/resources/images/egg_images/yellow/yellow.png b/pocket_friends/game_files/resources/images/bloops/yellow/yellow.png similarity index 100% rename from pocket_friends/game_files/resources/images/egg_images/yellow/yellow.png rename to pocket_friends/game_files/resources/images/bloops/yellow/yellow.png From c5d07c8b1eadb1f73a4d7898fddec5d99bdacd0a Mon Sep 17 00:00:00 2001 From: Nick Dyer Date: Sat, 5 Jun 2021 18:27:53 -0400 Subject: [PATCH 03/39] changed lots of values to be based around the render resolution, changed animation to be a constant 2 FPS --- pocket_friends/game_files/game.py | 33 +++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/pocket_friends/game_files/game.py b/pocket_friends/game_files/game.py index 53ebab4..1759205 100644 --- a/pocket_friends/game_files/game.py +++ b/pocket_friends/game_files/game.py @@ -13,6 +13,10 @@ from ..hardware.gpio_handler import Constants, GPIOHandler # FPS for the entire game to run at. game_fps = 16 +# FPS that animations run at +animation_fps = 2 +# The resolution the game is rendered at. +game_res = 80 # Gets the directory of the script for importing and the save directory script_dir = os.path.dirname(os.path.abspath(__file__)) @@ -101,12 +105,12 @@ class SelectionEgg(pygame.sprite.Sprite): self.index = 0 self.image = self.images[self.index] - self.animation_frames = game_fps / len(self.images) + self.animation_frames = game_fps / animation_fps self.current_frame = 0 def update_frame_dependent(self): """ - Updates the image of Sprite every 6 frame (approximately every 0.1 second if frame rate is 60). + Takes the images loaded and animates it, spacing it out equally for the framerate. """ self.current_frame += 1 @@ -116,7 +120,9 @@ class SelectionEgg(pygame.sprite.Sprite): self.image = self.images[self.index] def update(self): - """This is the method that's being called when 'all_sprites.update(dt)' is called.""" + """ + Updates the sprite object. + """ self.update_frame_dependent() @@ -139,7 +145,8 @@ class InfoText: raw_text = text # Copy the text to a different variable to be cut up. - max_line_width = 71 # The maximum pixel width that drawn text can be. + margins = 4.5 + max_line_width = game_res - (margins * 2) # The maximum pixel width that drawn text can be. cut_chars = '.,! ' # Characters that will be considered "cuts" aka when a line break can occur. # Prevents freezing if the end of the string does not end in a cut character @@ -200,16 +207,23 @@ class InfoText: Draws the text on a given surface. :param surface: The surface for the text to be drawn on. """ + # Constants to help draw the text + line_separation = 7 + left_margin = 3 + top_margin = 25 + bottom_margin = 10 + # Draw the lines on the screen for i in range(min(len(self.text), self.max_lines)): text = self.font.render(self.text[i + self.offset], False, (64, 64, 64)) - surface.blit(text, (3, 25 + (i * 7))) + surface.blit(text, (left_margin, top_margin + (i * line_separation))) # Draw the arrows if there is more text than is on screen. if self.offset != 0: - surface.blit(self.up_arrow, (36, 22)) + surface.blit(self.up_arrow, ((game_res / 2) - (self.up_arrow.get_rect().width / 2), top_margin - 3)) if len(self.text) - (self.offset + 1) >= self.max_lines: - surface.blit(self.down_arrow, (36, 70)) + surface.blit(self.down_arrow, + ((game_res / 2) - (self.down_arrow.get_rect().width / 2), game_res - bottom_margin)) def scroll_down(self): """ @@ -250,11 +264,10 @@ def game(): # The hardware is normally rendered at 80 pixels and upscaled from there. If changing displays, change the # screen_size to reflect what the resolution of the new display is. - rendered_size = 80 screen_size = 320 window = pygame.display.set_mode((screen_size, screen_size)) - surface = pygame.Surface((rendered_size, rendered_size)) + surface = pygame.Surface((game_res, game_res)) # Only really useful for PCs. Does nothing on the Raspberry Pi. pygame.display.set_caption('Pocket Friends {0}'.format(pocket_friends.__version__)) @@ -616,7 +629,7 @@ def game(): # Draws the frame counter. frame_counter = small_font.render('frames: {0}'.format(frames_passed), False, (64, 64, 64)) - surface.blit(frame_counter, (1, 70)) + surface.blit(frame_counter, (1, game_res - 10)) for event in pygame.event.get(): if event.type == pygame.KEYDOWN: From 92c905e82bf3087b8a0ff9164971491449e54d4d Mon Sep 17 00:00:00 2001 From: Nick Dyer Date: Sat, 5 Jun 2021 18:32:51 -0400 Subject: [PATCH 04/39] added additional information to the save file, renamed references of eggs to bloops --- pocket_friends/game_files/game.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/pocket_friends/game_files/game.py b/pocket_friends/game_files/game.py index 1759205..76ecaf1 100644 --- a/pocket_friends/game_files/game.py +++ b/pocket_friends/game_files/game.py @@ -37,11 +37,15 @@ class SaveHandler: def __init__(self): # Attributes that are saved to a file to recover upon startup. self.attributes = { + 'version': pocket_friends.__version__, 'time_elapsed': 0, + 'bloop': '', 'age': 0, 'health': 0, 'hunger': 0, 'happiness': 0, + 'missed_care': 0, + 'adult': 0, 'evolution_stage': -1, } @@ -442,7 +446,7 @@ def game(): # Determines if it is a new hardware or not by looking at the evolution stage. If it is -1, the egg has # not been created yet, and the hardware sends you to the egg selection screen. If not, the hardware sends # you to the playground. - if save_handler.attributes['evolution_stage'] == -1: + if save_handler.attributes['bloop'] == '': game_state = 'egg_select' else: game_state = 'playground' @@ -560,7 +564,7 @@ def game(): sel_up() if event.key == Constants.buttons.get('a'): # Advance to the egg info screen for the selected egg. - submenu = 'egg_info' + submenu = 'bloop_info' # Draws the cursor on screen. cursor = pygame.image.load(script_dir + '/resources/images/clock_selector.png').convert_alpha() @@ -570,7 +574,7 @@ def game(): draw() - elif submenu == 'egg_info': + elif submenu == 'bloop_info': # Draw the selected egg on screen egg = SelectionEgg(selected_color) @@ -581,7 +585,7 @@ def game(): # Info screen for the eggs. info = InfoText(small_font, egg.description) - while running and game_state == 'egg_select' and submenu == 'egg_info': + while running and game_state == 'egg_select' and submenu == 'bloop_info': pre_handler() From 658e808f96a1a31f838d016449a941289ba42618 Mon Sep 17 00:00:00 2001 From: Nick Dyer Date: Sat, 5 Jun 2021 19:12:02 -0400 Subject: [PATCH 05/39] added beginning of PlaygroundFriend class --- pocket_friends/game_files/game.py | 75 ++++++++++++++++++++++++++++++- 1 file changed, 74 insertions(+), 1 deletion(-) diff --git a/pocket_friends/game_files/game.py b/pocket_friends/game_files/game.py index 76ecaf1..93d70cf 100644 --- a/pocket_friends/game_files/game.py +++ b/pocket_friends/game_files/game.py @@ -77,9 +77,81 @@ class PlaygroundFriend(pygame.sprite.Sprite): Class for the sprite of the creature on the main playground. """ - def __init__(self): + def __init__(self, save_handler): pygame.sprite.Sprite.__init__(self) + # All attributes of the bloops + self.bloop = save_handler.attributes['bloop'] + self.age = save_handler.attributes['age'] + self.health = save_handler.attributes['health'] + self.hunger = save_handler.attributes['hunger'] + self.happiness = save_handler.attributes['happiness'] + self.evolution_stage = save_handler.attributes['evolution_stage'] + self.missed_care = save_handler.attributes['missed_care'] + self.adult = save_handler.attributes['adult'] + self.direction = 0 + + # Draw the correct bloop depending on the stage + if self.evolution_stage == 0: + image_directory = script_dir + '/resources/images/bloops/{0}/egg_images'.format(self.bloop) + elif self.evolution_stage == 1: + image_directory = script_dir + '/resources/images/bloops/{0}/baby_images'.format(self.bloop) + elif self.evolution_stage == 2: + image_directory = script_dir + '/resources/images/bloops/{0}/teen_images'.format(self.bloop) + else: + # Draw the correct adult based on care + if self.adult == 0: + image_directory = script_dir + '/resources/images/bloops/{0}/adult_images/good'.format(self.bloop) + elif self.adult == 1: + image_directory = script_dir + '/resources/images/bloops/{0}/adult_images/neutral'.format(self.bloop) + else: + image_directory = script_dir + '/resources/images/bloops/{0}/adult_images/bad'.format(self.bloop) + + self.images = [] + for filename in os.listdir(image_directory): + self.images.append(pygame.image.load(image_directory + '/' + filename)) + + self.rect = self.images[0].get_rect() + self.rect.x = (game_res / 2) - (self.rect.width / 2) + self.rect.y = (game_res / 2) - (self.rect.height / 2) + self.index = 0 + self.image = self.images[self.index] + + self.animation_frames = game_fps / animation_fps + self.current_frame = 0 + + def update_frame_dependent(self): + """ + Takes the images loaded and animates it, spacing it out equally for the framerate. + """ + + margins = 9 + movement_amount = 4 + + self.current_frame += 1 + if self.current_frame >= self.animation_frames: + self.current_frame = 0 + self.index = (self.index + 1) % len(self.images) + self.image = self.images[self.index] + + # Move the sprite so long as it is not in the egg stage + if self.evolution_stage == 0: + if self.rect.x < margins: + self.direction = 1 + elif self.rect.x > game_res - margins - self.rect.width: + self.direction = 0 + + if self.direction == 0: + self.rect.x -= movement_amount + else: + self.rect.x += movement_amount + + def update(self): + """ + Updates the sprite object. + """ + self.update_frame_dependent() + class SelectionEgg(pygame.sprite.Sprite): """ @@ -105,6 +177,7 @@ class SelectionEgg(pygame.sprite.Sprite): for filename in os.listdir(image_directory): self.images.append(pygame.image.load(image_directory + '/' + filename)) + # Get the rectangle from the first image in the list self.rect = self.images[0].get_rect() self.index = 0 self.image = self.images[self.index] From 963f760160f3608118f7c8c45bffd25b05074d09 Mon Sep 17 00:00:00 2001 From: Nick Dyer Date: Sat, 5 Jun 2021 19:12:22 -0400 Subject: [PATCH 06/39] implemented very basic playground gamestate --- pocket_friends/game_files/game.py | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/pocket_friends/game_files/game.py b/pocket_friends/game_files/game.py index 93d70cf..e01d666 100644 --- a/pocket_friends/game_files/game.py +++ b/pocket_friends/game_files/game.py @@ -506,7 +506,13 @@ def game(): elif game_state == 'playground': all_sprites.empty() - game_state = None # Playground currently not implemented, send to error screen. + + bloop = PlaygroundFriend(save_handler) + all_sprites.add(bloop) + + while running and game_state == 'playground': + pre_handler() + draw() elif game_state == 'init': all_sprites.empty() @@ -539,7 +545,7 @@ def game(): if submenu == 'main': # Creates and holds the egg objects in a list. - eggs = [SelectionEgg('red'), SelectionEgg('blue'), SelectionEgg('rainbow')] + eggs = [SelectionEgg('dev_egg'), SelectionEgg('blue'), SelectionEgg('rainbow')] # How many eggs per row should be displayed. eggs_per_row = 3 @@ -671,8 +677,16 @@ def game(): # Scroll up on the info screen. info.scroll_up() if event.key == Constants.buttons.get('a'): - # Go to an invalid hardware state if continuing. - game_state = None + # Write save file with new attributes + save_handler.attributes['bloop'] = egg.egg_color + save_handler.attributes['health'] = 10 + save_handler.attributes['hunger'] = 10 + save_handler.attributes['happiness'] = 10 + save_handler.attributes['evolution_stage'] = 0 + save_handler.write_save() + + # Go to playground + game_state = 'playground' if event.key == Constants.buttons.get('b'): # Go back to the egg selection screen. submenu = 'main' From 75aa07a370d1b0f2bbe31c04b5152ac9ec074341 Mon Sep 17 00:00:00 2001 From: Nick Dyer Date: Sat, 5 Jun 2021 19:12:55 -0400 Subject: [PATCH 07/39] fixed egg moving and other forms of bloop not --- pocket_friends/game_files/game.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pocket_friends/game_files/game.py b/pocket_friends/game_files/game.py index e01d666..d1ff181 100644 --- a/pocket_friends/game_files/game.py +++ b/pocket_friends/game_files/game.py @@ -92,7 +92,7 @@ class PlaygroundFriend(pygame.sprite.Sprite): self.direction = 0 # Draw the correct bloop depending on the stage - if self.evolution_stage == 0: + if self.evolution_stage != 0: image_directory = script_dir + '/resources/images/bloops/{0}/egg_images'.format(self.bloop) elif self.evolution_stage == 1: image_directory = script_dir + '/resources/images/bloops/{0}/baby_images'.format(self.bloop) From b533cde54996d62f4612177ad9aa0e2d4182430e Mon Sep 17 00:00:00 2001 From: Nick Dyer Date: Sat, 5 Jun 2021 19:13:14 -0400 Subject: [PATCH 08/39] added dev_egg.json --- .../game_files/resources/data/bloop_info/dev_egg.json | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 pocket_friends/game_files/resources/data/bloop_info/dev_egg.json diff --git a/pocket_friends/game_files/resources/data/bloop_info/dev_egg.json b/pocket_friends/game_files/resources/data/bloop_info/dev_egg.json new file mode 100644 index 0000000..702b1de --- /dev/null +++ b/pocket_friends/game_files/resources/data/bloop_info/dev_egg.json @@ -0,0 +1,5 @@ +{ + "description": "Dev egg description", + "contentness": 10, + "metabolism": 10 +} \ No newline at end of file From ef6ce5118cb6a3338086ceb7b337de69ce82189a Mon Sep 17 00:00:00 2001 From: Nick Dyer Date: Sat, 5 Jun 2021 22:10:47 -0400 Subject: [PATCH 09/39] fixed mistake in stage calulation, age now ticks with time --- pocket_friends/game_files/game.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/pocket_friends/game_files/game.py b/pocket_friends/game_files/game.py index d1ff181..427e131 100644 --- a/pocket_friends/game_files/game.py +++ b/pocket_friends/game_files/game.py @@ -92,7 +92,7 @@ class PlaygroundFriend(pygame.sprite.Sprite): self.direction = 0 # Draw the correct bloop depending on the stage - if self.evolution_stage != 0: + if self.evolution_stage == 0: image_directory = script_dir + '/resources/images/bloops/{0}/egg_images'.format(self.bloop) elif self.evolution_stage == 1: image_directory = script_dir + '/resources/images/bloops/{0}/baby_images'.format(self.bloop) @@ -120,7 +120,7 @@ class PlaygroundFriend(pygame.sprite.Sprite): self.animation_frames = game_fps / animation_fps self.current_frame = 0 - def update_frame_dependent(self): + def update(self): """ Takes the images loaded and animates it, spacing it out equally for the framerate. """ @@ -135,7 +135,7 @@ class PlaygroundFriend(pygame.sprite.Sprite): self.image = self.images[self.index] # Move the sprite so long as it is not in the egg stage - if self.evolution_stage == 0: + if self.evolution_stage != 0: if self.rect.x < margins: self.direction = 1 elif self.rect.x > game_res - margins - self.rect.width: @@ -146,11 +146,7 @@ class PlaygroundFriend(pygame.sprite.Sprite): else: self.rect.x += movement_amount - def update(self): - """ - Updates the sprite object. - """ - self.update_frame_dependent() + self.age += 1 class SelectionEgg(pygame.sprite.Sprite): From b339454f407aed1f783bd8fc8d1142c0830e5da5 Mon Sep 17 00:00:00 2001 From: Nick Dyer Date: Sat, 12 Jun 2021 22:06:48 -0400 Subject: [PATCH 10/39] added launch arg "--delete-save" to delete save file on launch --- pocket_friends/__main__.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pocket_friends/__main__.py b/pocket_friends/__main__.py index 45820fa..68f6a97 100644 --- a/pocket_friends/__main__.py +++ b/pocket_friends/__main__.py @@ -1,6 +1,8 @@ """ Launch script for Pocket Friends. """ +import os +from pathlib import Path import pygame import sys from pocket_friends.game_files.game import main as game_main @@ -14,6 +16,10 @@ if __name__ == '__main__': for args in sys.argv: if args == '--dev': enable_dev = True + if args == '--delete-save': + save_dir = os.path.join(Path.home(), '.pocket_friends') + os.remove(save_dir + '/save.json') + if not enable_dev: game_main() From 29ea40d874df8703e1122b50086be3b66236a225 Mon Sep 17 00:00:00 2001 From: Nick Dyer Date: Sat, 12 Jun 2021 22:08:40 -0400 Subject: [PATCH 11/39] transitioned to sprite sheets for egg sprites --- .../bloops/{ => _postponed}/green/green.png | Bin .../bloops/{ => _postponed}/indigo/indigo.png | Bin .../bloops/{ => _postponed}/orange/orange.png | Bin .../bloops/{ => _postponed}/violet/violet.png | Bin .../bloops/{ => _postponed}/white/white.png | Bin .../bloops/{ => _postponed}/yellow/yellow.png | Bin .../resources/images/bloops/blue/egg.json | 5 +++++ .../resources/images/bloops/blue/egg.png | Bin 0 -> 2683 bytes .../bloops/blue/{egg_images/blue.png => old.png} | Bin .../resources/images/bloops/dev_egg/egg.json | 5 +++++ .../resources/images/bloops/dev_egg/egg.png | Bin 0 -> 565 bytes .../images/bloops/dev_egg/egg_images/0.png | Bin 4131 -> 0 bytes .../images/bloops/dev_egg/egg_images/1.png | Bin 3654 -> 0 bytes .../resources/images/bloops/rainbow/egg.json | 5 +++++ .../rainbow/{egg_images/rainbow.png => egg.png} | Bin .../resources/images/bloops/red/egg.json | 5 +++++ .../bloops/red/{egg_images/red.png => egg.png} | Bin 17 files changed, 20 insertions(+) rename pocket_friends/game_files/resources/images/bloops/{ => _postponed}/green/green.png (100%) rename pocket_friends/game_files/resources/images/bloops/{ => _postponed}/indigo/indigo.png (100%) rename pocket_friends/game_files/resources/images/bloops/{ => _postponed}/orange/orange.png (100%) rename pocket_friends/game_files/resources/images/bloops/{ => _postponed}/violet/violet.png (100%) rename pocket_friends/game_files/resources/images/bloops/{ => _postponed}/white/white.png (100%) rename pocket_friends/game_files/resources/images/bloops/{ => _postponed}/yellow/yellow.png (100%) create mode 100644 pocket_friends/game_files/resources/images/bloops/blue/egg.json create mode 100644 pocket_friends/game_files/resources/images/bloops/blue/egg.png rename pocket_friends/game_files/resources/images/bloops/blue/{egg_images/blue.png => old.png} (100%) create mode 100644 pocket_friends/game_files/resources/images/bloops/dev_egg/egg.json create mode 100644 pocket_friends/game_files/resources/images/bloops/dev_egg/egg.png delete mode 100644 pocket_friends/game_files/resources/images/bloops/dev_egg/egg_images/0.png delete mode 100644 pocket_friends/game_files/resources/images/bloops/dev_egg/egg_images/1.png create mode 100644 pocket_friends/game_files/resources/images/bloops/rainbow/egg.json rename pocket_friends/game_files/resources/images/bloops/rainbow/{egg_images/rainbow.png => egg.png} (100%) create mode 100644 pocket_friends/game_files/resources/images/bloops/red/egg.json rename pocket_friends/game_files/resources/images/bloops/red/{egg_images/red.png => egg.png} (100%) diff --git a/pocket_friends/game_files/resources/images/bloops/green/green.png b/pocket_friends/game_files/resources/images/bloops/_postponed/green/green.png similarity index 100% rename from pocket_friends/game_files/resources/images/bloops/green/green.png rename to pocket_friends/game_files/resources/images/bloops/_postponed/green/green.png diff --git a/pocket_friends/game_files/resources/images/bloops/indigo/indigo.png b/pocket_friends/game_files/resources/images/bloops/_postponed/indigo/indigo.png similarity index 100% rename from pocket_friends/game_files/resources/images/bloops/indigo/indigo.png rename to pocket_friends/game_files/resources/images/bloops/_postponed/indigo/indigo.png diff --git a/pocket_friends/game_files/resources/images/bloops/orange/orange.png b/pocket_friends/game_files/resources/images/bloops/_postponed/orange/orange.png similarity index 100% rename from pocket_friends/game_files/resources/images/bloops/orange/orange.png rename to pocket_friends/game_files/resources/images/bloops/_postponed/orange/orange.png diff --git a/pocket_friends/game_files/resources/images/bloops/violet/violet.png b/pocket_friends/game_files/resources/images/bloops/_postponed/violet/violet.png similarity index 100% rename from pocket_friends/game_files/resources/images/bloops/violet/violet.png rename to pocket_friends/game_files/resources/images/bloops/_postponed/violet/violet.png diff --git a/pocket_friends/game_files/resources/images/bloops/white/white.png b/pocket_friends/game_files/resources/images/bloops/_postponed/white/white.png similarity index 100% rename from pocket_friends/game_files/resources/images/bloops/white/white.png rename to pocket_friends/game_files/resources/images/bloops/_postponed/white/white.png diff --git a/pocket_friends/game_files/resources/images/bloops/yellow/yellow.png b/pocket_friends/game_files/resources/images/bloops/_postponed/yellow/yellow.png similarity index 100% rename from pocket_friends/game_files/resources/images/bloops/yellow/yellow.png rename to pocket_friends/game_files/resources/images/bloops/_postponed/yellow/yellow.png diff --git a/pocket_friends/game_files/resources/images/bloops/blue/egg.json b/pocket_friends/game_files/resources/images/bloops/blue/egg.json new file mode 100644 index 0000000..00ecd46 --- /dev/null +++ b/pocket_friends/game_files/resources/images/bloops/blue/egg.json @@ -0,0 +1,5 @@ +{ + "width": 17, + "height": 17, + "frames": 17 +} \ No newline at end of file diff --git a/pocket_friends/game_files/resources/images/bloops/blue/egg.png b/pocket_friends/game_files/resources/images/bloops/blue/egg.png new file mode 100644 index 0000000000000000000000000000000000000000..0bc9f3e2621ffb30148b68d477c6da8abd863828 GIT binary patch literal 2683 zcmV->3WW8EP)r400006VoOIv0RI60 z0RN!9r;`8x010qNS#tmYE+YT{E+YYWr9XB6000McNlirue zSad^gZEa<4bO1wgWnpw>WFU8GbZ8()Nlj2!fese{014wsL_t(|+U=ZOiyX%lhTp30 zp6S-C3F1o9?ySlr&s#b~7um={F9rmH8ruw6vc~3En)ZubX_TT>Wi*pPC^(HdXv48%< zy9H(pU;qd}sQ}ckO&yS7{O)3bpUlwVgff16u>c1;oKVJRmkK=IqQmiG94^=NOb|WY z5lK2JO++tc^+QB7G~#W>M$#l_ia|t^93RFMXOwZcT$9j5KM0~yQ?E9fXs3x*l1S)b z(BX1Tr6zCA7=wtsIWC4Tr_Jb`GXIglg%p?%OrivUs(;_;@oBozfY5%NQHBDx`2TSR zXUD^m=rCp7aB@wJWn{jD}j^<eBhQpS)#BWD~r1GE%S1C#B`R|*;|h*RG;n);j2 zINDGU$F4gojXXmT#}qqUuIX}?f^i1USm*EvfRwTtIjt~f3^^2tB`D@8gw*)Uwz{BP z%QHMz6vg@Ts(S5e&cTpGac)$9#;@lbk|Bz7T_x2FIUot87}j9WR85~WO)F46dVH2b z08k*5I{{WIFrwDQi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ONEM4w-PYq7pIs_o z(%%gyLJ&1=a)#q8i0pQ<7%?-{mKMX9;!H7IZE{|MXsn&g_YL(TSrZ)J1d)s5YIXDF zI0ccfSn(;}wzU5R=QM3{ooOB-R)$);LOElM5YA8vDU{O_M90eAPBtV~>?#S9ZD}^g zu4j_G+S}S3yZ$A}yG_n;dUu&GUI=G9*^pSV>x&m^vMtT#*!AVH_G)iybL{%A)ZT4! zhSL#5W(^V}R*WDrUsA_#zNwp#3?qhPzLIQz(H+XUUe*mnipZ;-Y)Gs$`cMe(wltg5 zX1LNyE>1fR5!xnaI46S0vz=^6tf0O>l=OxV_DAU_y5(^J^y?5-X+(?%$SXbIdGDvNWi@ zt<7n!84+!As^w)Hsq*2XaJG{TiIsa>(GfGB6tl^;G@J8{)Lprg&%D~(+MN3qlxLF(6**5O!;i-~`Go8g#m&DcsYfG~^wFZ53?DUvvjmg&Ty`uwV3^gg6K`G)Foy*`ws<(nZ2pQ z<$7}ep(!!5SA*fZ|Ij`UN@wjnmJWJdqUVj89ijUVt>u2slIEiNPf0=h551G}{l3dQ zDP_?9Lr=tho-OQfxu*B#S=9bRk^whLy;ry4YC{zzqxK(qE93il$|PwTwg1qOCIEW> z2IN@A?Hj~6+s_$tE^_}NMf>+`)=BP!>^~%>#J5uK-MXf^?H=&3eS>D%iTc~S8DdKn p08X)TePj=!y&90$DQ4c}`Y$48g4?!QwJQJs002ovPDHLkV1oMW;XnWY literal 0 HcmV?d00001 diff --git a/pocket_friends/game_files/resources/images/bloops/blue/egg_images/blue.png b/pocket_friends/game_files/resources/images/bloops/blue/old.png similarity index 100% rename from pocket_friends/game_files/resources/images/bloops/blue/egg_images/blue.png rename to pocket_friends/game_files/resources/images/bloops/blue/old.png diff --git a/pocket_friends/game_files/resources/images/bloops/dev_egg/egg.json b/pocket_friends/game_files/resources/images/bloops/dev_egg/egg.json new file mode 100644 index 0000000..c332357 --- /dev/null +++ b/pocket_friends/game_files/resources/images/bloops/dev_egg/egg.json @@ -0,0 +1,5 @@ +{ + "width": 17, + "height": 17, + "frames": 16 +} \ No newline at end of file diff --git a/pocket_friends/game_files/resources/images/bloops/dev_egg/egg.png b/pocket_friends/game_files/resources/images/bloops/dev_egg/egg.png new file mode 100644 index 0000000000000000000000000000000000000000..a952bfefa8361117ff629672c8c1adf531df3f1e GIT binary patch literal 565 zcmeAS@N?(olHy`uVBq!ia0vp^E+EXo1|%(nCvO5$Y)RhkE)4%caKYZ?lYt_f1s;*b z3=De8Ak0{?)V>TT$X?><>&pI=jhB&ERzbGZpMin#kf)1dNX4zUGaM%!R^VY#4c*uH z@Bdnf{mkDcEo5m7Df8zx-Fbs?^;@aroT${lt0$XHz5jPx@{3hB?k>GHZ*uX!Z%x}$ zdk)MBdL^AD8Y&u^`#*le)uTCQFNiW6HNMf_eRE#oW)@eMGjDQdJe<*=TvE)&wDR3O zuF%kV=hMSeuBEE4w-)GhH;D4rboJ6yQsSLZ{H`sk=3CNl&mMQ11=nr`m3;p;hf$7k z<6D)sqz=VMK71@C&_ZnS{wbH<9eDNb&6x^?vldq-l(8)4 zzkQ=z=&>OGfqlDAm&U&3et)jqUc0)gI(P1&jA9O{G~@4CX5m-g-L!2?R9e)~E3f5o z`^>H<8*8t=^yHcCYqoi&#P9nxKi{6YP?$O+=#|i%xo`HpfBLAPyshpfU)^ivZK)cp zf@H#r`_pf5w1hbBvN)KM)Mt_D*^jP9|&KYm%YIy$-#4Zoxx zaB^>EX>4U6ba`-PAZ2)IW&i+q+O3&smLoZig#Ysta|G_oak#!WH|XQf2hgQZW=2O= z&+AZ?T>>evbE?vr*q)f9`pA z=G!kk$G|b%lO;aihUfh2`uslfpl`l#>9-rgdl>&YaOux^Z~ZSbTE`yy`B%UGKWEi* z_FY|%nK0zLs5^vtJ%$ShQ3`rn=2iGV@ww=$@v64l>7reB+QDnO=DZ8`xagK~-5s~x z;yB%8j?r&lIC?*Q&~r5u-~0?VxDe&#jxV8w6>9Kd`W-@uCiwSUoQ~Ucyy+?gA2E{q!d6f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o-DTc$_G zGN!wMhhT2*ZjW8V40M<8_7sU|ThB=?EplB=pEO+rm|0EC_79syg_h?S-p?(cUu>J1 z@AlEGx|VjX(M^r9UGStGZ(j#V4x!Nki$5gps_S1Xl#_>_cDGjwfTe+>@ zP1KO^T4y+;(|4n@ZfJfxJbpj?*Q3op8~*Fj=KnvJJKFr;<`PuQbl_CX>@2HM@dakSAh-}0002(NklMh=^I)%;p{to&h-~ zY=v%Abvhv|19Hm%(0i{N%Y>P2V&>g_x~7|p4suJq_YKS(-#Mpw!ZBT#*(|UM%gHgp zBt-<}%IiJhu`2+f{q-UdpsEGN_p1{#J+8_ga7~l07*qoM6N<$f=N3ZwEzGB diff --git a/pocket_friends/game_files/resources/images/bloops/rainbow/egg.json b/pocket_friends/game_files/resources/images/bloops/rainbow/egg.json new file mode 100644 index 0000000..b9ca6c2 --- /dev/null +++ b/pocket_friends/game_files/resources/images/bloops/rainbow/egg.json @@ -0,0 +1,5 @@ +{ + "width": 17, + "height": 17, + "frames": 1 +} \ No newline at end of file diff --git a/pocket_friends/game_files/resources/images/bloops/rainbow/egg_images/rainbow.png b/pocket_friends/game_files/resources/images/bloops/rainbow/egg.png similarity index 100% rename from pocket_friends/game_files/resources/images/bloops/rainbow/egg_images/rainbow.png rename to pocket_friends/game_files/resources/images/bloops/rainbow/egg.png diff --git a/pocket_friends/game_files/resources/images/bloops/red/egg.json b/pocket_friends/game_files/resources/images/bloops/red/egg.json new file mode 100644 index 0000000..b9ca6c2 --- /dev/null +++ b/pocket_friends/game_files/resources/images/bloops/red/egg.json @@ -0,0 +1,5 @@ +{ + "width": 17, + "height": 17, + "frames": 1 +} \ No newline at end of file diff --git a/pocket_friends/game_files/resources/images/bloops/red/egg_images/red.png b/pocket_friends/game_files/resources/images/bloops/red/egg.png similarity index 100% rename from pocket_friends/game_files/resources/images/bloops/red/egg_images/red.png rename to pocket_friends/game_files/resources/images/bloops/red/egg.png From a31e2452c73261b7e2fd4e797c03cc7e5c7f636c Mon Sep 17 00:00:00 2001 From: Nick Dyer Date: Sat, 12 Jun 2021 22:16:54 -0400 Subject: [PATCH 12/39] added SpriteSheet class --- pocket_friends/game_files/game.py | 42 +++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/pocket_friends/game_files/game.py b/pocket_friends/game_files/game.py index 427e131..ef09770 100644 --- a/pocket_friends/game_files/game.py +++ b/pocket_friends/game_files/game.py @@ -29,6 +29,48 @@ except FileExistsError: pass +class SpriteSheet: + """ + Imports a sprite sheet as separate pygame images given an image file and a json file. + """ + + def __init__(self, sprite_sheet, texture_json): + # Load in whole sprite sheet as one image. + self.sprite_sheet = pygame.image.load(sprite_sheet).convert_alpha() + self.images = [] + + # Get the sprite sheet json file. + with open(texture_json, 'r') as json_file: + self.img_attrib = json.load(json_file) + json_file.close() + + image_count = 0 + + # Get the sprite size as a tuple + sprite_size = self.img_attrib['width'], self.img_attrib['height'] + + # Iterate through every image location on the sprite sheet given the sprite size + for i in range(self.sprite_sheet.get_size()[1] // sprite_size[1]): + i *= sprite_size[1] + for j in range(self.sprite_sheet.get_size()[0] // sprite_size[0]): + j *= sprite_size[0] + + # Create a new transparent surface + sprite = pygame.Surface(sprite_size, SRCALPHA) + # Blit the sprite onto the image + sprite.blit(self.sprite_sheet, (0, 0), (j, i, sprite_size[0], sprite_size[1])) + # Add the image to the list of images + self.images.append(sprite) + + image_count += 1 + + # Break the loop if the specified number of frames has been reached. + if image_count >= self.img_attrib['frames']: + break + if image_count >= self.img_attrib['frames']: + break + + class SaveHandler: """ Class that handles the hardware attributes and save files. From a94b454048d9386afe606c96313c29c809918df4 Mon Sep 17 00:00:00 2001 From: Nick Dyer Date: Sat, 12 Jun 2021 22:17:53 -0400 Subject: [PATCH 13/39] changed sprite image loading to use sprite sheets --- pocket_friends/game_files/game.py | 32 +++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/pocket_friends/game_files/game.py b/pocket_friends/game_files/game.py index ef09770..1031c75 100644 --- a/pocket_friends/game_files/game.py +++ b/pocket_friends/game_files/game.py @@ -135,23 +135,27 @@ class PlaygroundFriend(pygame.sprite.Sprite): # Draw the correct bloop depending on the stage if self.evolution_stage == 0: - image_directory = script_dir + '/resources/images/bloops/{0}/egg_images'.format(self.bloop) + sprite_sheet = SpriteSheet(script_dir + '/resources/images/bloops/{0}/egg.png'.format(self.bloop), + script_dir + '/resources/images/bloops/{0}/egg.json'.format(self.bloop)) elif self.evolution_stage == 1: - image_directory = script_dir + '/resources/images/bloops/{0}/baby_images'.format(self.bloop) + sprite_sheet = SpriteSheet(script_dir + '/resources/images/bloops/{0}/baby.png'.format(self.bloop), + script_dir + '/resources/images/bloops/{0}/baby.json'.format(self.bloop)) elif self.evolution_stage == 2: - image_directory = script_dir + '/resources/images/bloops/{0}/teen_images'.format(self.bloop) + sprite_sheet = SpriteSheet(script_dir + '/resources/images/bloops/{0}/teen.png'.format(self.bloop), + script_dir + '/resources/images/bloops/{0}/teen.json'.format(self.bloop)) else: # Draw the correct adult based on care if self.adult == 0: - image_directory = script_dir + '/resources/images/bloops/{0}/adult_images/good'.format(self.bloop) + sprite_sheet = SpriteSheet(script_dir + '/resources/images/bloops/{0}/adult0.png'.format(self.bloop), + script_dir + '/resources/images/bloops/{0}/adult0.json'.format(self.bloop)) elif self.adult == 1: - image_directory = script_dir + '/resources/images/bloops/{0}/adult_images/neutral'.format(self.bloop) + sprite_sheet = SpriteSheet(script_dir + '/resources/images/bloops/{0}/adult1.png'.format(self.bloop), + script_dir + '/resources/images/bloops/{0}/adult1.json'.format(self.bloop)) else: - image_directory = script_dir + '/resources/images/bloops/{0}/adult_images/bad'.format(self.bloop) + sprite_sheet = SpriteSheet(script_dir + '/resources/images/bloops/{0}/adult2.png'.format(self.bloop), + script_dir + '/resources/images/bloops/{0}/adult2.json'.format(self.bloop)) - self.images = [] - for filename in os.listdir(image_directory): - self.images.append(pygame.image.load(image_directory + '/' + filename)) + self.images = sprite_sheet.images self.rect = self.images[0].get_rect() self.rect.x = (game_res / 2) - (self.rect.width / 2) @@ -159,7 +163,7 @@ class PlaygroundFriend(pygame.sprite.Sprite): self.index = 0 self.image = self.images[self.index] - self.animation_frames = game_fps / animation_fps + self.animation_frames = 1 self.current_frame = 0 def update(self): @@ -211,16 +215,16 @@ class SelectionEgg(pygame.sprite.Sprite): 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): - self.images.append(pygame.image.load(image_directory + '/' + filename)) + sprite_sheet = SpriteSheet(script_dir + '/resources/images/bloops/{0}/egg.png'.format(self.egg_color), + script_dir + '/resources/images/bloops/{0}/egg.json'.format(self.egg_color)) + self.images = sprite_sheet.images # Get the rectangle from the first image in the list self.rect = self.images[0].get_rect() self.index = 0 self.image = self.images[self.index] - self.animation_frames = game_fps / animation_fps + self.animation_frames = 1 self.current_frame = 0 def update_frame_dependent(self): From 15cf0fa9fd15f0dab31faa78a3ee8fe5500e0210 Mon Sep 17 00:00:00 2001 From: Nick Dyer Date: Sat, 12 Jun 2021 22:18:49 -0400 Subject: [PATCH 14/39] cleaned up some straggling unused code --- pocket_friends/game_files/game.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/pocket_friends/game_files/game.py b/pocket_friends/game_files/game.py index 1031c75..ad0c925 100644 --- a/pocket_friends/game_files/game.py +++ b/pocket_friends/game_files/game.py @@ -13,8 +13,6 @@ from ..hardware.gpio_handler import Constants, GPIOHandler # FPS for the entire game to run at. game_fps = 16 -# FPS that animations run at -animation_fps = 2 # The resolution the game is rendered at. game_res = 80 @@ -209,7 +207,6 @@ class SelectionEgg(pygame.sprite.Sprite): with open(script_dir + '/resources/data/bloop_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/bloops/{0}/egg_images'.format(egg_color) # Gets the description off the egg from the JSON file. self.description = json_file.get('description') From adaa2872bb98a98da9ff6b39aab2a6d77be23ed9 Mon Sep 17 00:00:00 2001 From: Nick Dyer Date: Sat, 12 Jun 2021 23:10:59 -0400 Subject: [PATCH 15/39] changed SaveHandler and references to DataHandler, added update method to run game logic --- pocket_friends/game_files/game.py | 53 ++++++++++++++++++------------- 1 file changed, 31 insertions(+), 22 deletions(-) diff --git a/pocket_friends/game_files/game.py b/pocket_friends/game_files/game.py index ad0c925..be583fe 100644 --- a/pocket_friends/game_files/game.py +++ b/pocket_friends/game_files/game.py @@ -69,7 +69,7 @@ class SpriteSheet: break -class SaveHandler: +class DataHandler: """ Class that handles the hardware attributes and save files. """ @@ -84,10 +84,12 @@ class SaveHandler: 'health': 0, 'hunger': 0, 'happiness': 0, + 'care_counter': 0, 'missed_care': 0, 'adult': 0, 'evolution_stage': -1, } + self.frames_passed = 0 def write_save(self): """ @@ -111,24 +113,32 @@ class SaveHandler: except FileNotFoundError: self.write_save() + def update(self): + """ + Run the game logic. + """ + self.frames_passed += 1 + if self.frames_passed >= game_fps: + self.attributes['age'] += 1 + print(self.attributes['age']) + + if self.attributes['age'] % 10 == 0: + self.write_save() + self.frames_passed = 0 + class PlaygroundFriend(pygame.sprite.Sprite): """ Class for the sprite of the creature on the main playground. """ - def __init__(self, save_handler): + def __init__(self, data_handler): pygame.sprite.Sprite.__init__(self) # All attributes of the bloops - self.bloop = save_handler.attributes['bloop'] - self.age = save_handler.attributes['age'] - self.health = save_handler.attributes['health'] - self.hunger = save_handler.attributes['hunger'] - self.happiness = save_handler.attributes['happiness'] - self.evolution_stage = save_handler.attributes['evolution_stage'] - self.missed_care = save_handler.attributes['missed_care'] - self.adult = save_handler.attributes['adult'] + self.bloop = data_handler.attributes['bloop'] + self.adult = data_handler.attributes['adult'] + self.evolution_stage = data_handler.attributes['evolution_stage'] self.direction = 0 # Draw the correct bloop depending on the stage @@ -190,8 +200,6 @@ class PlaygroundFriend(pygame.sprite.Sprite): else: self.rect.x += movement_amount - self.age += 1 - class SelectionEgg(pygame.sprite.Sprite): """ @@ -400,7 +408,7 @@ def game(): # Default hardware state when the hardware first starts. game_state = 'title' running = True - save_handler = SaveHandler() + data_handler = DataHandler() # A group of all the sprites on screen. Used to update all sprites at onc all_sprites = pygame.sprite.Group() @@ -546,11 +554,12 @@ def game(): elif game_state == 'playground': all_sprites.empty() - bloop = PlaygroundFriend(save_handler) + bloop = PlaygroundFriend(data_handler) all_sprites.add(bloop) while running and game_state == 'playground': pre_handler() + data_handler.update() draw() elif game_state == 'init': @@ -559,12 +568,12 @@ def game(): draw() # Read the save file. - save_handler.read_save() + data_handler.read_save() # Determines if it is a new hardware or not by looking at the evolution stage. If it is -1, the egg has # not been created yet, and the hardware sends you to the egg selection screen. If not, the hardware sends # you to the playground. - if save_handler.attributes['bloop'] == '': + if data_handler.attributes['bloop'] == '': game_state = 'egg_select' else: game_state = 'playground' @@ -717,12 +726,12 @@ def game(): info.scroll_up() if event.key == Constants.buttons.get('a'): # Write save file with new attributes - save_handler.attributes['bloop'] = egg.egg_color - save_handler.attributes['health'] = 10 - save_handler.attributes['hunger'] = 10 - save_handler.attributes['happiness'] = 10 - save_handler.attributes['evolution_stage'] = 0 - save_handler.write_save() + data_handler.attributes['bloop'] = egg.egg_color + data_handler.attributes['health'] = 10 + data_handler.attributes['hunger'] = 10 + data_handler.attributes['happiness'] = 10 + data_handler.attributes['evolution_stage'] = 0 + data_handler.write_save() # Go to playground game_state = 'playground' From f084f0a4e6a848fa44424e0d9f0f91ad4ad6c595 Mon Sep 17 00:00:00 2001 From: Nick Dyer Date: Sat, 12 Jun 2021 23:11:54 -0400 Subject: [PATCH 16/39] changed values in egg personality jsons from 10 to 5 --- .../game_files/resources/data/bloop_info/blue.json | 6 +++--- .../game_files/resources/data/bloop_info/dev_egg.json | 4 ++-- .../game_files/resources/data/bloop_info/rainbow.json | 4 ++-- .../game_files/resources/data/bloop_info/red.json | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/pocket_friends/game_files/resources/data/bloop_info/blue.json b/pocket_friends/game_files/resources/data/bloop_info/blue.json index 376b00e..7f2a90d 100644 --- a/pocket_friends/game_files/resources/data/bloop_info/blue.json +++ b/pocket_friends/game_files/resources/data/bloop_info/blue.json @@ -1,5 +1,5 @@ { - "description": "Blue egg description", - "contentness": 10, - "metabolism": 10 + "description": "This is Blue! They are a easy going bloop, with a laid back personality that you will love! They are also easy to take care of, as they just enjoy living life!", + "contentness": 5, + "metabolism": 5 } \ No newline at end of file diff --git a/pocket_friends/game_files/resources/data/bloop_info/dev_egg.json b/pocket_friends/game_files/resources/data/bloop_info/dev_egg.json index 702b1de..682c0bc 100644 --- a/pocket_friends/game_files/resources/data/bloop_info/dev_egg.json +++ b/pocket_friends/game_files/resources/data/bloop_info/dev_egg.json @@ -1,5 +1,5 @@ { "description": "Dev egg description", - "contentness": 10, - "metabolism": 10 + "contentness": 5, + "metabolism": 5 } \ No newline at end of file diff --git a/pocket_friends/game_files/resources/data/bloop_info/rainbow.json b/pocket_friends/game_files/resources/data/bloop_info/rainbow.json index 7f6c244..5e057de 100644 --- a/pocket_friends/game_files/resources/data/bloop_info/rainbow.json +++ b/pocket_friends/game_files/resources/data/bloop_info/rainbow.json @@ -1,5 +1,5 @@ { "description": "Rainbow egg description", - "contentness": 10, - "metabolism": 10 + "contentness": 5, + "metabolism": 5 } \ No newline at end of file diff --git a/pocket_friends/game_files/resources/data/bloop_info/red.json b/pocket_friends/game_files/resources/data/bloop_info/red.json index fc7e758..4b0f64d 100644 --- a/pocket_friends/game_files/resources/data/bloop_info/red.json +++ b/pocket_friends/game_files/resources/data/bloop_info/red.json @@ -1,5 +1,5 @@ { "description": "Red egg description", - "contentness": 10, - "metabolism": 10 + "contentness": 5, + "metabolism": 5 } \ No newline at end of file From 4e77601afe50d4d3d0790beb64868d9c3c75ea73 Mon Sep 17 00:00:00 2001 From: Nick Dyer Date: Sun, 13 Jun 2021 14:51:18 -0400 Subject: [PATCH 17/39] added EggInfo class, added drawing contentness and metabolism stats on info screen --- pocket_friends/game_files/game.py | 58 ++++++++++++++++++++++++++++--- 1 file changed, 53 insertions(+), 5 deletions(-) diff --git a/pocket_friends/game_files/game.py b/pocket_friends/game_files/game.py index be583fe..4a19326 100644 --- a/pocket_friends/game_files/game.py +++ b/pocket_friends/game_files/game.py @@ -218,6 +218,8 @@ class SelectionEgg(pygame.sprite.Sprite): # Gets the description off the egg from the JSON file. self.description = json_file.get('description') + self.contentness = json_file.get('contentness') + self.metabolism = json_file.get('metabolism') # Load the egg from the given color and get the bounding rectangle for the image. sprite_sheet = SpriteSheet(script_dir + '/resources/images/bloops/{0}/egg.png'.format(self.egg_color), @@ -250,6 +252,50 @@ class SelectionEgg(pygame.sprite.Sprite): self.update_frame_dependent() +class EggInfo: + """ + Class to draw the contentness and metabolism value off the egg on the info screen. + """ + + def __init__(self, contentness, metabolism, location): + self.contentness = contentness + self.metabolism = metabolism + self.x = location[0] + self.y = location[1] + + # Create a new surface to blit onto the other surface + self.surface = pygame.Surface((44, 15), SRCALPHA) + + # Blit the two indicator icons on screen + smiley = pygame.image.load(script_dir + '/resources/images/gui/smiley.png').convert_alpha() + self.surface.blit(smiley, (0, 0)) + apple = pygame.image.load(script_dir + '/resources/images/gui/apple.png').convert_alpha() + self.surface.blit(apple, (1, 9)) + + # Draw 5 stars. If the value of the contentness is less than the current star, make it a blank star. + for i in range(5): + if i < self.contentness: + star = pygame.image.load(script_dir + '/resources/images/gui/star.png').convert_alpha() + else: + star = pygame.image.load(script_dir + '/resources/images/gui/blank_star.png').convert_alpha() + self.surface.blit(star, (11 + (i * 6), 1)) + + # Draw 5 stars. If the value of the metabolism is less than the current star, make it a blank star. + for i in range(5): + if i < self.metabolism: + star = pygame.image.load(script_dir + '/resources/images/gui/star.png').convert_alpha() + else: + star = pygame.image.load(script_dir + '/resources/images/gui/blank_star.png').convert_alpha() + self.surface.blit(star, (11 + (i * 6), 10)) + + def draw(self, surface): + """ + Draw the info icons on a given surface. + :param surface: the surface to draw the icons on. + """ + surface.blit(self.surface, (self.x, self.y)) + + class InfoText: """ Class for drawing large amounts of text on the screen at a time @@ -705,12 +751,13 @@ def game(): # Draw the selected egg on screen egg = SelectionEgg(selected_color) - egg.rect.x = 32 + egg.rect.x = 8 egg.rect.y = 3 all_sprites.add(egg) # Info screen for the eggs. - info = InfoText(small_font, egg.description) + info_text = InfoText(small_font, egg.description) + info_icons = EggInfo(egg.contentness, egg.metabolism, (32, 4)) while running and game_state == 'egg_select' and submenu == 'bloop_info': @@ -720,10 +767,10 @@ def game(): if event.type == pygame.KEYDOWN: if event.key == Constants.buttons.get('j_d'): # Scroll down on the info screen. - info.scroll_down() + info_text.scroll_down() if event.key == Constants.buttons.get('j_u'): # Scroll up on the info screen. - info.scroll_up() + info_text.scroll_up() if event.key == Constants.buttons.get('a'): # Write save file with new attributes data_handler.attributes['bloop'] = egg.egg_color @@ -740,7 +787,8 @@ def game(): submenu = 'main' # Draw the info screen. - info.draw(surface) + info_text.draw(surface) + info_icons.draw(surface) draw() From adb984600f812693095ef5ba36328a8a279dc1bc Mon Sep 17 00:00:00 2001 From: Nick Dyer Date: Sun, 13 Jun 2021 14:53:12 -0400 Subject: [PATCH 18/39] updated rainbow bloop egg texture --- .../resources/images/bloops/rainbow/egg.json | 2 +- .../resources/images/bloops/rainbow/egg.png | Bin 14934 -> 7034 bytes 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/pocket_friends/game_files/resources/images/bloops/rainbow/egg.json b/pocket_friends/game_files/resources/images/bloops/rainbow/egg.json index b9ca6c2..eab2b8e 100644 --- a/pocket_friends/game_files/resources/images/bloops/rainbow/egg.json +++ b/pocket_friends/game_files/resources/images/bloops/rainbow/egg.json @@ -1,5 +1,5 @@ { "width": 17, "height": 17, - "frames": 1 + "frames": 48 } \ No newline at end of file diff --git a/pocket_friends/game_files/resources/images/bloops/rainbow/egg.png b/pocket_friends/game_files/resources/images/bloops/rainbow/egg.png index 92291ec1cab54f1b03e976bbff63d114a7e3d455..c685da6fcf91439f21ceb32fb3128fde2caa40da 100644 GIT binary patch literal 7034 zcmXY$cRX9)|Hp$8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?gd_38o zhUXG4V})D6vc>SS5zM8M=qDq9hju$J^mACI74>Z3FkzLi9hk_=LXhu5(Ns#NkULnnOf5Z;Ow65>2xH0qvzI8 z!I-^|tF)yn7pJIuUST6Pu7}hIuyFsQYoXzp9RlAL9-pJGBHM5iT}0AX5u%jPlsV;;kk6jctq-Jz|uJl5;&ZPAPGnm{)Empq$1x<`S99 zWvSc@I*3RiJ%e!f#r5Vpk04tep)5Q)@Y}THeV4c?#z;tg?5p|AFT-qwgnEdhwn8p@ zb+)1DkFQzA?@*61CdzyB2dNBt qnXwMVq`Z<7H>f*q?w1MIo+IAarsZQsw>*^wKtV=Tx<<-8?0*5h@AMM@ From 2115825baaafd652c9e519499f40219b6857b787 Mon Sep 17 00:00:00 2001 From: Nick Dyer Date: Sun, 13 Jun 2021 14:53:55 -0400 Subject: [PATCH 19/39] added graphics textures --- .../game_files/resources/images/gui/apple.png | Bin 0 -> 246 bytes .../resources/images/gui/bar_graphic.png | Bin 0 -> 218 bytes .../resources/images/gui/bar_outline.png | Bin 0 -> 188 bytes .../resources/images/gui/blank_star.png | Bin 0 -> 178 bytes .../game_files/resources/images/gui/smiley.png | Bin 0 -> 258 bytes .../game_files/resources/images/gui/star.png | Bin 0 -> 213 bytes 6 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 pocket_friends/game_files/resources/images/gui/apple.png create mode 100644 pocket_friends/game_files/resources/images/gui/bar_graphic.png create mode 100644 pocket_friends/game_files/resources/images/gui/bar_outline.png create mode 100644 pocket_friends/game_files/resources/images/gui/blank_star.png create mode 100644 pocket_friends/game_files/resources/images/gui/smiley.png create mode 100644 pocket_friends/game_files/resources/images/gui/star.png diff --git a/pocket_friends/game_files/resources/images/gui/apple.png b/pocket_friends/game_files/resources/images/gui/apple.png new file mode 100644 index 0000000000000000000000000000000000000000..605e3a7d3dd07b92588f6d69d62fcbac4a7e2f1a GIT binary patch literal 246 zcmeAS@N?(olHy`uVBq!ia0vp^tU%1h!3HF`e}{O3I7!~_EbHUgGKN%Kns%m&wGaov->UP)M@GHKN2hKQ}iuuY|$5C^fMpHASI3 zvm`^o-P1Q9ypc~Fs3^|U#W95Ay6NeSoDBvd3>SYVDM~tTD3CaK?3858DNUn>9j(nB zoau^jfBF6uO`5}!!7xXS@y>Jp9qYvM@0z`>mSsDfI&sPa8$~9sg-c&QuyEM_wUUG3 hcwkm*ROjn1@tzf$ueW?Vxfo~@gQu&X%Q~loCIAwgPEr5> literal 0 HcmV?d00001 diff --git a/pocket_friends/game_files/resources/images/gui/bar_graphic.png b/pocket_friends/game_files/resources/images/gui/bar_graphic.png new file mode 100644 index 0000000000000000000000000000000000000000..701d07c4b5cfc0472b5aedd371d6e07ca158ebc5 GIT binary patch literal 218 zcmeAS@N?(olHy`uVBq!ia0vp^B0$WBuiW)N}Tg^b5rw57@Uhz6H8K4 z6v{J8G8EiBeFMT9`NV;WoIG6|LpZMIb{g_E7ziAe35$sS@&EI!xmR@-ICFRhu2IR$ zV7A`D-2eTS%>lOOT*d}9>OLtP!4Xf?1P%s7$o_m@9P=bpNq@Wc--|%g7(8A5T-G@y GGywoS%s-U? literal 0 HcmV?d00001 diff --git a/pocket_friends/game_files/resources/images/gui/bar_outline.png b/pocket_friends/game_files/resources/images/gui/bar_outline.png new file mode 100644 index 0000000000000000000000000000000000000000..d4036655735558e6b71253628bd90a51febacf76 GIT binary patch literal 188 zcmeAS@N?(olHy`uVBq!ia0vp^VnEEo!3HF|R-IoBq}Y|16d5l>NTH%6lZ}) zWHAGSo-znCRxGtI0}8U2c>21sKV{=(=H$_Jb-4}{k}PqJC~?lu%}vcKVQ?-=O)N=G zQ7F$W$xv|j^bH7azopr0Fg5>n*aa+ literal 0 HcmV?d00001 diff --git a/pocket_friends/game_files/resources/images/gui/blank_star.png b/pocket_friends/game_files/resources/images/gui/blank_star.png new file mode 100644 index 0000000000000000000000000000000000000000..c56f3ee42c5f633c0361475f41c7c401db8c241d GIT binary patch literal 178 zcmeAS@N?(olHy`uVBq!ia0vp^tU%1d!3HGVjK4YnDYhhUcNZWH1V5d3*8?fe0*}aI z1_nK45N51cYF`EvWH0gbb!C6b#>-?X;v;e16DTBE;u=xnoS&PUnpeW$T$GwvlA5AW zo>`Ki;O^-g5Z=fq4pb!N>Eal|aXmS~p@B`JS#V~v&WQ%Kiw9bKtr?P@Gqvt%-w+8@ O#o+1c=d#Wzp$P!M=PY#q literal 0 HcmV?d00001 diff --git a/pocket_friends/game_files/resources/images/gui/smiley.png b/pocket_friends/game_files/resources/images/gui/smiley.png new file mode 100644 index 0000000000000000000000000000000000000000..d27d3c28fc6cd860e2d4561cfd4bd4f6d131bac7 GIT binary patch literal 258 zcmeAS@N?(olHy`uVBq!ia0vp^>_E)M!3HGx`C7_AoFs2|7a$D;Kb?2i11Zh|kH}&M z20djEW~^9h4^qZn;_2(k{*;ZE$wXG?zS|n0kYtH#M2T~LZfQI@BRV+hA}+tb#0OpYS12Y2;0B&a#;HBz4WRnU=3`*ntp-8W^2 zf=ib;uY3yj*-^Ovk!Ea^Zo87v{0mF$9eJ-hlx6)?jW!LlGnF%v4ZL&i$K-#Gt)i7o28^p6Le$a%CprxM6!A^fVMJty85}Sb4q9e00NRv*8l(j literal 0 HcmV?d00001 diff --git a/pocket_friends/game_files/resources/images/gui/star.png b/pocket_friends/game_files/resources/images/gui/star.png new file mode 100644 index 0000000000000000000000000000000000000000..e3c4ddbb4f7f0274173e4d2d778bc8ea8ebb7c7f GIT binary patch literal 213 zcmeAS@N?(olHy`uVBq!ia0vp^tU%1d!3HGVjK4YnDYhhUcNZWH1V5d3*8?fe0*}aI z1_nK45N51cYF`EvWH0gbb!C6b#>-^NwtwM1Mxc;niEBiObAE1aYF-J0b5UwyNotBh zd1gt5g1e`0KzJjcI8c$Tr;B3<$92=w3q>0YL|6{~w9#2Poo|5}%NG&xGl?fw8J>>+ zHSeWqZU5T`wM)1~QtlY)1-xCu+T*=-^Rs`9yJ|%emZmDb1scTQ>FVdQ&MBb@00yN$ Ao&W#< literal 0 HcmV?d00001 From e0cf80dec95169b765a85bb448268df35d8ac511 Mon Sep 17 00:00:00 2001 From: Nick Dyer Date: Sun, 13 Jun 2021 14:54:13 -0400 Subject: [PATCH 20/39] changed some stats for dev_egg and blue --- pocket_friends/game_files/resources/data/bloop_info/blue.json | 2 +- .../game_files/resources/data/bloop_info/dev_egg.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pocket_friends/game_files/resources/data/bloop_info/blue.json b/pocket_friends/game_files/resources/data/bloop_info/blue.json index 7f2a90d..3080216 100644 --- a/pocket_friends/game_files/resources/data/bloop_info/blue.json +++ b/pocket_friends/game_files/resources/data/bloop_info/blue.json @@ -1,5 +1,5 @@ { "description": "This is Blue! They are a easy going bloop, with a laid back personality that you will love! They are also easy to take care of, as they just enjoy living life!", - "contentness": 5, + "contentness": 4, "metabolism": 5 } \ No newline at end of file diff --git a/pocket_friends/game_files/resources/data/bloop_info/dev_egg.json b/pocket_friends/game_files/resources/data/bloop_info/dev_egg.json index 682c0bc..2e7e213 100644 --- a/pocket_friends/game_files/resources/data/bloop_info/dev_egg.json +++ b/pocket_friends/game_files/resources/data/bloop_info/dev_egg.json @@ -1,5 +1,5 @@ { "description": "Dev egg description", - "contentness": 5, - "metabolism": 5 + "contentness": 4, + "metabolism": 4 } \ No newline at end of file From 4eef9353c72c6ac5ea365dd09bed5c625403c7f9 Mon Sep 17 00:00:00 2001 From: Nick Dyer Date: Tue, 15 Jun 2021 18:55:24 -0400 Subject: [PATCH 21/39] removed button press speed limit when not on rpi --- pocket_friends/game_files/game.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pocket_friends/game_files/game.py b/pocket_friends/game_files/game.py index 4a19326..cefd4a1 100644 --- a/pocket_friends/game_files/game.py +++ b/pocket_friends/game_files/game.py @@ -419,8 +419,10 @@ os.environ["SDL_FBDEV"] = "/dev/fb1" try: importlib.util.find_spec('RPi.GPIO') import RPi.GPIO as GPIO + on_hardware = True except ImportError: import pocket_friends.development.FakeGPIO as GPIO + on_hardware = False def game(): @@ -513,7 +515,7 @@ def game(): """ nonlocal last_input_tick # Register a button click so long as the last button click happened no less than two frames ago - if pygame.time.get_ticks() - last_input_tick > clock.get_time() * 2: + if pygame.time.get_ticks() - last_input_tick > clock.get_time() * 2 or not on_hardware: pygame.event.post(pygame.event.Event(KEYDOWN, {'key': pressed_button})) pygame.event.post(pygame.event.Event(KEYUP, {'key': pressed_button})) log_button(pressed_button) From 522db7c01cf6ce39e052160ec04a5f53eecf2644 Mon Sep 17 00:00:00 2001 From: Nick Dyer Date: Tue, 15 Jun 2021 18:56:09 -0400 Subject: [PATCH 22/39] changed rainbow bloop stats --- .../resources/data/bloop_info/rainbow.json | 2 +- .../resources/images/bloops/blue/old.png | Bin 631 -> 0 bytes 2 files changed, 1 insertion(+), 1 deletion(-) delete mode 100644 pocket_friends/game_files/resources/images/bloops/blue/old.png diff --git a/pocket_friends/game_files/resources/data/bloop_info/rainbow.json b/pocket_friends/game_files/resources/data/bloop_info/rainbow.json index 5e057de..86f158a 100644 --- a/pocket_friends/game_files/resources/data/bloop_info/rainbow.json +++ b/pocket_friends/game_files/resources/data/bloop_info/rainbow.json @@ -1,5 +1,5 @@ { "description": "Rainbow egg description", "contentness": 5, - "metabolism": 5 + "metabolism": 4 } \ No newline at end of file diff --git a/pocket_friends/game_files/resources/images/bloops/blue/old.png b/pocket_friends/game_files/resources/images/bloops/blue/old.png deleted file mode 100644 index 9656dafc1f893bceec9b49b324eddfdec7f3fd2e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 631 zcmV--0*L*IP)e zSad^gZEa<4bO1wgWnpw>WFU8GbZ8()Nlj2!fese{00G}gL_t(I%Z-%5ZWA#OhQIM{ z(ryB2RV0KeE(5KrI=F9yJ7mB$#Fx2B55Mf~^1_ucXsX`qW91beW`> zrR+m>S-MN*3J|l@Ch2FC&N}H!=YUy~=2^NbuyMQz3hSV$AQ+4)c-(^s{7z7n^+opd zw!=*UVX5NfUc;6_&wSG)!RI-=o547Fa4QF!;Q6Ro`L{AQ34TTB8=SOovVcJiF#`p@ zQ-J{&37+)f&F$*E?_gw*1#>~af^meM8ZIL2RxW!Xuhgr{>vZh!e5Pl^hM~dz0G(WR zzj$Oo0uE|8=(%UFr`LefS?fyr=7HamZyp2~8srSi5?o|Bn?i>xX$5&boxR{vM*$`o zDuXEK6%|&l)`K2=U%yR Rz_tJY002ovPDHLkV1gK27J~o) From 10cc67728670dab9461c5afa2060181070104195 Mon Sep 17 00:00:00 2001 From: Nick Dyer Date: Tue, 15 Jun 2021 23:52:11 -0400 Subject: [PATCH 23/39] renamed clock_selector.png to egg_selector.png, moved it to gui folder --- .../{clock_selector.png => gui/egg_selector.png} | Bin 1 file changed, 0 insertions(+), 0 deletions(-) rename pocket_friends/game_files/resources/images/{clock_selector.png => gui/egg_selector.png} (100%) diff --git a/pocket_friends/game_files/resources/images/clock_selector.png b/pocket_friends/game_files/resources/images/gui/egg_selector.png similarity index 100% rename from pocket_friends/game_files/resources/images/clock_selector.png rename to pocket_friends/game_files/resources/images/gui/egg_selector.png From 95c8a48a6dc3b67712437d79b17e9b3db2e4940a Mon Sep 17 00:00:00 2001 From: Nick Dyer Date: Wed, 16 Jun 2021 00:31:15 -0400 Subject: [PATCH 24/39] created popup menu icons --- .../resources/images/gui/popup_menu/apple.png | Bin 0 -> 419 bytes .../resources/images/gui/popup_menu/bed.png | Bin 0 -> 268 bytes .../images/gui/popup_menu/controller.png | Bin 0 -> 350 bytes .../resources/images/gui/popup_menu/dumbell.png | Bin 0 -> 344 bytes .../resources/images/gui/popup_menu/stats.png | Bin 0 -> 302 bytes 5 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 pocket_friends/game_files/resources/images/gui/popup_menu/apple.png create mode 100644 pocket_friends/game_files/resources/images/gui/popup_menu/bed.png create mode 100644 pocket_friends/game_files/resources/images/gui/popup_menu/controller.png create mode 100644 pocket_friends/game_files/resources/images/gui/popup_menu/dumbell.png create mode 100644 pocket_friends/game_files/resources/images/gui/popup_menu/stats.png diff --git a/pocket_friends/game_files/resources/images/gui/popup_menu/apple.png b/pocket_friends/game_files/resources/images/gui/popup_menu/apple.png new file mode 100644 index 0000000000000000000000000000000000000000..675c1b43ca31647f904bee22610d269d6d3e388e GIT binary patch literal 419 zcmeAS@N?(olHy`uVBq!ia0vp^LO{&L!3HFEdh;y=Qfx`y?k)`XK`<%)-F~15XMsm# zF$061G6*wPEVVBK3bL1Y`ns||WfNeL(z)!MP|ku_QG` zp**uBL&4qCHz2%`Pn>~)k=xV7F+}71+)4Ic%z*;!`zzn;b}NSZZE*El@PJpRRbZNk zn3B??r8+uHi(I+h?r{((YPLPR?cm?fbzm6~*1O^hItt&jn%z44@3{M&_cuA1f3URdp3Sv1B6lh<>=-;< L{an^LB{Ts55SpXc literal 0 HcmV?d00001 diff --git a/pocket_friends/game_files/resources/images/gui/popup_menu/bed.png b/pocket_friends/game_files/resources/images/gui/popup_menu/bed.png new file mode 100644 index 0000000000000000000000000000000000000000..075300d11d970cfe947dd6fb0dfbb59e3d401119 GIT binary patch literal 268 zcmeAS@N?(olHy`uVBq!ia0vp^VnEEs!3HFcC*>^wagw~H489H5Y7iEBiObAE1aYF-J0b5UwyNotBh zd1gt5g1e`0KzJjcI8afEr;B5V#`)xg1x7#q_dT>{1_EKjuI=Z}|L@O1TaS?83{1OP5{ BUibh2 literal 0 HcmV?d00001 diff --git a/pocket_friends/game_files/resources/images/gui/popup_menu/controller.png b/pocket_friends/game_files/resources/images/gui/popup_menu/controller.png new file mode 100644 index 0000000000000000000000000000000000000000..b446c52869976a60589887b0142447f53866e1ad GIT binary patch literal 350 zcmeAS@N?(olHy`uVBq!ia0vp^5hT|;+&tGo0?a`;9QiNSdyBe zP@Y+mq2TW68xY>eCk|9}%+tj&MC1J0Nrrq)4g#+C1+=X^cQBS*Q8~@3V=<9cv^D(` zi^`RfGrS%e+hw^~19^lVo6Y|F`Pq4&vKION-Wy>tN-PfyIM3}o+p;V(B{OcyJ8$M* z&lVQ%&+A@?EwI0;&#QBG`;SE>H#%5@6Pl)be!VFir=9ga+^zcOPKRl!`sNO$oR-(- zY4L=!e*45UL8bF(p-uN;1BMUlR<63yv9$7#+`jy;|4y#b`f#V~_-y}KE*-sDng8Z2 o%NK1Z_f>NFw{h8JuewWl;=XwumxY{|fIedIboFyt=akR{0Nr1LRsaA1 literal 0 HcmV?d00001 diff --git a/pocket_friends/game_files/resources/images/gui/popup_menu/dumbell.png b/pocket_friends/game_files/resources/images/gui/popup_menu/dumbell.png new file mode 100644 index 0000000000000000000000000000000000000000..50b9843d8d1662e9ffb7349102d9e4471abd29fd GIT binary patch literal 344 zcmeAS@N?(olHy`uVBq!ia0vp^VnEEn!3HG%X7FDCQfx`y?k)`XK`<%)-F~15XMsm# zF$061G6*wPEVVBK3bL1Y`ns||WfNeL zLV0FMhJw4NZ$Nk>pEyv_0Z$jl5RLO|gAQ^vIf%?juU^B)ohYwR!qfBV+1B|V{B3?G z-&>*|U{%_kqBubzAih1SG;mtSz07-O-Wa^m`*3&z(`KgI77H79_e(OYTi%i*qy6ER zM18>_702K?%naQ6NzsRIYNg2TvT<4b?Qm?4(*~w)#mK3w9&GO?ta`I!<;qh`ec}$) zch|lYW%#fo{({;0eXXirqSs5<`?&pm7QKFjZMy8d_chMN3=4KHP2s*^nUl=@H{an^LB{Ts5j)j6v literal 0 HcmV?d00001 diff --git a/pocket_friends/game_files/resources/images/gui/popup_menu/stats.png b/pocket_friends/game_files/resources/images/gui/popup_menu/stats.png new file mode 100644 index 0000000000000000000000000000000000000000..0e0868f6d6df7506d1c602cc72d83a5002835824 GIT binary patch literal 302 zcmeAS@N?(olHy`uVBq!ia0vp^VnEEv!3HGFOzxBdDYhhUcNd2HAea>YZa+x6z$3Dl zfk96hgc&QA+Lr+Z*-JcqUD=EaloaXvXkLGVxg@elJSNVzGpxrwoXK(2XHm*l#4Nq_$L zJ+xoER$6e{`(Njo9{>5hv-{zEUFO5_)@*J2zwz*FKO!N~^>=Q+v4MfXo7#gpoogma zZ0#{A{P-}Iry{oIg*@}&hxI%>tJendD!b{{#=hCgA{1xPpx;xtvQ_%bk$1-q6m&5* lNlNH^+}Q!txW(%@gKJ!xeet$cyMZob@O1TaS?83{1OUf Date: Wed, 16 Jun 2021 01:12:47 -0400 Subject: [PATCH 25/39] fixed typo in dumbbell image file --- .../gui/popup_menu/{dumbell.png => dumbbell.png} | Bin 1 file changed, 0 insertions(+), 0 deletions(-) rename pocket_friends/game_files/resources/images/gui/popup_menu/{dumbell.png => dumbbell.png} (100%) diff --git a/pocket_friends/game_files/resources/images/gui/popup_menu/dumbell.png b/pocket_friends/game_files/resources/images/gui/popup_menu/dumbbell.png similarity index 100% rename from pocket_friends/game_files/resources/images/gui/popup_menu/dumbell.png rename to pocket_friends/game_files/resources/images/gui/popup_menu/dumbbell.png From 1a4560fea79b8fab0d077e1f89b87dfc97b908b8 Mon Sep 17 00:00:00 2001 From: Nick Dyer Date: Wed, 16 Jun 2021 01:50:52 -0400 Subject: [PATCH 26/39] added json files for gui images --- .../game_files/resources/images/gui/popup_menu/apple.json | 5 +++++ .../game_files/resources/images/gui/popup_menu/bed.json | 5 +++++ .../resources/images/gui/popup_menu/controller.json | 5 +++++ .../game_files/resources/images/gui/popup_menu/dumbbell.json | 5 +++++ .../game_files/resources/images/gui/popup_menu/stats.json | 5 +++++ 5 files changed, 25 insertions(+) create mode 100644 pocket_friends/game_files/resources/images/gui/popup_menu/apple.json create mode 100644 pocket_friends/game_files/resources/images/gui/popup_menu/bed.json create mode 100644 pocket_friends/game_files/resources/images/gui/popup_menu/controller.json create mode 100644 pocket_friends/game_files/resources/images/gui/popup_menu/dumbbell.json create mode 100644 pocket_friends/game_files/resources/images/gui/popup_menu/stats.json diff --git a/pocket_friends/game_files/resources/images/gui/popup_menu/apple.json b/pocket_friends/game_files/resources/images/gui/popup_menu/apple.json new file mode 100644 index 0000000..ce0fb87 --- /dev/null +++ b/pocket_friends/game_files/resources/images/gui/popup_menu/apple.json @@ -0,0 +1,5 @@ +{ + "width": 9, + "height": 10, + "frames": 2 +} \ No newline at end of file diff --git a/pocket_friends/game_files/resources/images/gui/popup_menu/bed.json b/pocket_friends/game_files/resources/images/gui/popup_menu/bed.json new file mode 100644 index 0000000..735846f --- /dev/null +++ b/pocket_friends/game_files/resources/images/gui/popup_menu/bed.json @@ -0,0 +1,5 @@ +{ + "width": 11, + "height": 6, + "frames": 2 +} \ No newline at end of file diff --git a/pocket_friends/game_files/resources/images/gui/popup_menu/controller.json b/pocket_friends/game_files/resources/images/gui/popup_menu/controller.json new file mode 100644 index 0000000..70c337f --- /dev/null +++ b/pocket_friends/game_files/resources/images/gui/popup_menu/controller.json @@ -0,0 +1,5 @@ +{ + "width": 12, + "height": 8, + "frames": 2 +} \ No newline at end of file diff --git a/pocket_friends/game_files/resources/images/gui/popup_menu/dumbbell.json b/pocket_friends/game_files/resources/images/gui/popup_menu/dumbbell.json new file mode 100644 index 0000000..87f7592 --- /dev/null +++ b/pocket_friends/game_files/resources/images/gui/popup_menu/dumbbell.json @@ -0,0 +1,5 @@ +{ + "width": 11, + "height": 8, + "frames": 2 +} \ No newline at end of file diff --git a/pocket_friends/game_files/resources/images/gui/popup_menu/stats.json b/pocket_friends/game_files/resources/images/gui/popup_menu/stats.json new file mode 100644 index 0000000..476146f --- /dev/null +++ b/pocket_friends/game_files/resources/images/gui/popup_menu/stats.json @@ -0,0 +1,5 @@ +{ + "width": 11, + "height": 9, + "frames": 2 +} \ No newline at end of file From c43563fc2c5d38a600868c819baaa040944b9ea0 Mon Sep 17 00:00:00 2001 From: Nick Dyer Date: Wed, 16 Jun 2021 01:51:06 -0400 Subject: [PATCH 27/39] added frame image for popup menu --- .../resources/images/gui/popup_menu/frame.png | Bin 0 -> 235 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 pocket_friends/game_files/resources/images/gui/popup_menu/frame.png diff --git a/pocket_friends/game_files/resources/images/gui/popup_menu/frame.png b/pocket_friends/game_files/resources/images/gui/popup_menu/frame.png new file mode 100644 index 0000000000000000000000000000000000000000..b232a6336201b8c220e81b708368ba38a494fae3 GIT binary patch literal 235 zcmeAS@N?(olHy`uVBq!ia0vp^UO>#p!3HEdB)hnQ6kC$Fy9>j85KM}Hw;w3NS>O>_ z%)p?h48n{ROYO^mg6t)pzOL*~*#uaW4NleOg49WtxJHyX=jZ08=9Mrw7o{eaq^2m8 zXO?6rxO@5rgg5eu0~G~(x;TbJ98OM20D=h@f1fwtDri=pE)gk_^5x(9SF2x2^77tM zShM1({pAb;0d_a$ERzK&gh&tDl?;bowkrt?J&WfiJ+eB=P_~-;W9+qA7C_?}JYD@< J);T3K0RXFlNUQ(= literal 0 HcmV?d00001 From d16604c019799adfaf754e34fdd738163918755d Mon Sep 17 00:00:00 2001 From: Nick Dyer Date: Wed, 16 Jun 2021 03:19:48 -0400 Subject: [PATCH 28/39] changed evolution_stage to a string rather than an int --- pocket_friends/game_files/game.py | 35 ++++++++++++------------------- 1 file changed, 13 insertions(+), 22 deletions(-) diff --git a/pocket_friends/game_files/game.py b/pocket_friends/game_files/game.py index cefd4a1..cd51718 100644 --- a/pocket_friends/game_files/game.py +++ b/pocket_friends/game_files/game.py @@ -87,7 +87,7 @@ class DataHandler: 'care_counter': 0, 'missed_care': 0, 'adult': 0, - 'evolution_stage': -1, + 'evolution_stage': '', } self.frames_passed = 0 @@ -141,33 +141,24 @@ class PlaygroundFriend(pygame.sprite.Sprite): self.evolution_stage = data_handler.attributes['evolution_stage'] self.direction = 0 - # Draw the correct bloop depending on the stage - if self.evolution_stage == 0: - sprite_sheet = SpriteSheet(script_dir + '/resources/images/bloops/{0}/egg.png'.format(self.bloop), - script_dir + '/resources/images/bloops/{0}/egg.json'.format(self.bloop)) - elif self.evolution_stage == 1: - sprite_sheet = SpriteSheet(script_dir + '/resources/images/bloops/{0}/baby.png'.format(self.bloop), - script_dir + '/resources/images/bloops/{0}/baby.json'.format(self.bloop)) - elif self.evolution_stage == 2: - sprite_sheet = SpriteSheet(script_dir + '/resources/images/bloops/{0}/teen.png'.format(self.bloop), - script_dir + '/resources/images/bloops/{0}/teen.json'.format(self.bloop)) + if self.evolution_stage == 'adult': + image = self.evolution_stage + self.adult else: - # Draw the correct adult based on care - if self.adult == 0: - sprite_sheet = SpriteSheet(script_dir + '/resources/images/bloops/{0}/adult0.png'.format(self.bloop), - script_dir + '/resources/images/bloops/{0}/adult0.json'.format(self.bloop)) - elif self.adult == 1: - sprite_sheet = SpriteSheet(script_dir + '/resources/images/bloops/{0}/adult1.png'.format(self.bloop), - script_dir + '/resources/images/bloops/{0}/adult1.json'.format(self.bloop)) - else: - sprite_sheet = SpriteSheet(script_dir + '/resources/images/bloops/{0}/adult2.png'.format(self.bloop), - script_dir + '/resources/images/bloops/{0}/adult2.json'.format(self.bloop)) + image = self.evolution_stage + # Draw the correct bloop depending on the stage + sprite_sheet = SpriteSheet(script_dir + '/resources/images/bloops/{0}/{1}.png'.format(self.bloop, image), + script_dir + '/resources/images/bloops/{0}/{1}.json'.format(self.bloop, image)) + + # Load the images from the sprite sheet self.images = sprite_sheet.images + # Put the egg in the middle of the screen. self.rect = self.images[0].get_rect() self.rect.x = (game_res / 2) - (self.rect.width / 2) self.rect.y = (game_res / 2) - (self.rect.height / 2) + + # Start animation at the beginning of the sprite sheet. self.index = 0 self.image = self.images[self.index] @@ -779,7 +770,7 @@ def game(): data_handler.attributes['health'] = 10 data_handler.attributes['hunger'] = 10 data_handler.attributes['happiness'] = 10 - data_handler.attributes['evolution_stage'] = 0 + data_handler.attributes['evolution_stage'] = 'egg' data_handler.write_save() # Go to playground From 5f326c8fda2c9eb9f562bd637335b49869222b8c Mon Sep 17 00:00:00 2001 From: Nick Dyer Date: Wed, 16 Jun 2021 03:23:14 -0400 Subject: [PATCH 29/39] added dev_egg baby images --- .../resources/images/bloops/dev_egg/baby.json | 5 +++++ .../resources/images/bloops/dev_egg/baby.png | Bin 0 -> 422 bytes 2 files changed, 5 insertions(+) create mode 100644 pocket_friends/game_files/resources/images/bloops/dev_egg/baby.json create mode 100644 pocket_friends/game_files/resources/images/bloops/dev_egg/baby.png diff --git a/pocket_friends/game_files/resources/images/bloops/dev_egg/baby.json b/pocket_friends/game_files/resources/images/bloops/dev_egg/baby.json new file mode 100644 index 0000000..0ba8327 --- /dev/null +++ b/pocket_friends/game_files/resources/images/bloops/dev_egg/baby.json @@ -0,0 +1,5 @@ +{ + "width": 14, + "height": 10, + "frames": 16 +} \ No newline at end of file diff --git a/pocket_friends/game_files/resources/images/bloops/dev_egg/baby.png b/pocket_friends/game_files/resources/images/bloops/dev_egg/baby.png new file mode 100644 index 0000000000000000000000000000000000000000..ba30870e8c9a347a1eba2a9d441b30889a880f89 GIT binary patch literal 422 zcmeAS@N?(olHy`uVBq!ia0vp^7C@}Q!3HE(2UxZODYhhUcNYd(5EMJTWgAe0v%n*= zn1Ml08H5=tmfDvA1=&kHeO=j~vI(&B$gzEV=EA_hXzc0Y7?N@C?X=ju76Tr(;~SPo zOuFz}UR&q5$3D9c!Cg_?`j>1HbmH<6IOcb32j5?Vv_1W|3%;FpX46>eqS?Ccy`z)R z`s=Gb{S;Y_N=!|1}7r=cx-`mlb&4DO!JxD`T%ya7<5NBFFPdJFI3ul&cndvpU Date: Wed, 16 Jun 2021 03:35:21 -0400 Subject: [PATCH 30/39] created MenuIcon and PopupMenu classes for implementation in the playground --- pocket_friends/game_files/game.py | 106 ++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) diff --git a/pocket_friends/game_files/game.py b/pocket_friends/game_files/game.py index cd51718..5fd9a8d 100644 --- a/pocket_friends/game_files/game.py +++ b/pocket_friends/game_files/game.py @@ -402,6 +402,112 @@ class InfoText: self.offset -= 1 +class MenuIcon(pygame.sprite.Sprite): + """ + Sprite for an icon on the main popup menu. + """ + + def __init__(self, icon): + pygame.sprite.Sprite.__init__(self) + self.icon = icon + + # Load the sprite sheet from the icon name + sprite_sheet = SpriteSheet(script_dir + '/resources/images/gui/popup_menu/{0}.png'.format(self.icon), + script_dir + '/resources/images/gui/popup_menu/{0}.json'.format(self.icon)) + self.images = sprite_sheet.images + + # Get the rectangle from the first image in the list + self.rect = self.images[0].get_rect() + self.image = self.images[0] + + def select(self): + """ + Change the icon sprite to the selected icon. + """ + self.image = self.images[1] + + def deselect(self): + """ + Change the icon sprite to the not selected icon. + """ + self.image = self.images[0] + + +class PopupMenu: + """ + Class to create a popup menu that can be hidden and shown at will + """ + + def __init__(self, position): + # Background frame of the popup menu + self.frame = pygame.image.load(script_dir + '/resources/images/gui/popup_menu/frame.png').convert_alpha() + + self.draw_menu = False # Whether or not to draw the popup menu + self.menu_sprites = pygame.sprite.Group() # Sprite group for the icons + self.selected = 0 # The currently selected icon + + # The names of the icons to be drawn + icon_names = ['apple', 'dumbbell', 'stats', 'controller', 'bed'] + + self.icons = [] + # Create an icon sprite for each name in the list and add it to the icon list + for i in icon_names: + self.icons.append(MenuIcon(i)) + + # Add each sprite in the icon list to the sprite group + for i in range(len(self.icons)): + icon = self.icons[i] + if i == self.selected: # Make the default selected icon glow + icon.select() + + # Calculate the position of the icon on screen + icon.rect.x = position[0] + 2 + (i * 14) + icon.rect.y = position[1] + self.frame.get_height() / 2 - icon.image.get_height() / 2 + + # Add the icon to the sprite group. + self.menu_sprites.add(icon) + + def toggle(self): + """ + Toggles the menu on or off. + """ + self.draw_menu = not self.draw_menu + + def next(self): + """ + Changes the selection to the next icon (to the right.) + """ + if self.draw_menu: # Only change if the menu is on screen + + self.icons[self.selected].deselect() # Deselect the current icon + self.selected += 1 # Change selection to the next icon + if self.selected >= len(self.icons): # Wrap around if new value is invalid + self.selected = 0 + self.icons[self.selected].select() # Select the newly selected icon + + def prev(self): + """ + Changes the selection to the previous icon (to the left.) + """ + if self.draw_menu: # Only change if the menu is on screen + + self.icons[self.selected].deselect() # Deselect the current icon + self.selected -= 1 # Change selection to the previous icon + if self.selected < 0: # Wrap around if new value is invalid + self.selected = len(self.icons) - 1 + self.icons[self.selected].select() # Select the newly selected icon + + def draw(self, surface): + """ + Draw the menu onto a given surface + :param surface: the surface to draw the menu on. + """ + # Draw the menu only if it is toggled on. + if self.draw_menu: + surface.blit(self.frame, (3, 3)) + self.menu_sprites.draw(surface) + + # Makes Pygame draw on the display of the RPi. os.environ["SDL_FBDEV"] = "/dev/fb1" From 14343034508378c59028420f5477bb0f58e9b099 Mon Sep 17 00:00:00 2001 From: Nick Dyer Date: Wed, 16 Jun 2021 03:38:47 -0400 Subject: [PATCH 31/39] fixed the egg selector pointing to the wrong file --- pocket_friends/game_files/game.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pocket_friends/game_files/game.py b/pocket_friends/game_files/game.py index 5fd9a8d..645af6c 100644 --- a/pocket_friends/game_files/game.py +++ b/pocket_friends/game_files/game.py @@ -839,7 +839,8 @@ def game(): submenu = 'bloop_info' # Draws the cursor on screen. - cursor = pygame.image.load(script_dir + '/resources/images/clock_selector.png').convert_alpha() + cursor = pygame.image.load( + script_dir + '/resources/images/gui/egg_selector.png').convert_alpha() surface.blit(cursor, get_cursor_coords(selected)) selected_color = eggs[selected].egg_color From ab2c7dcb48f815bcdd37586367c558e62426a84b Mon Sep 17 00:00:00 2001 From: Nick Dyer Date: Wed, 16 Jun 2021 03:40:02 -0400 Subject: [PATCH 32/39] added many comments, fixed bloop movement in playground --- pocket_friends/game_files/game.py | 56 +++++++++++++++++-------------- 1 file changed, 30 insertions(+), 26 deletions(-) diff --git a/pocket_friends/game_files/game.py b/pocket_friends/game_files/game.py index 645af6c..142e5e5 100644 --- a/pocket_friends/game_files/game.py +++ b/pocket_friends/game_files/game.py @@ -42,6 +42,7 @@ class SpriteSheet: self.img_attrib = json.load(json_file) json_file.close() + # Count for how many images have been added in the image list image_count = 0 # Get the sprite size as a tuple @@ -89,6 +90,8 @@ class DataHandler: 'adult': 0, 'evolution_stage': '', } + + # Frame counter self.frames_passed = 0 def write_save(self): @@ -118,12 +121,17 @@ class DataHandler: Run the game logic. """ self.frames_passed += 1 + # Run logic of the game every second. if self.frames_passed >= game_fps: - self.attributes['age'] += 1 - print(self.attributes['age']) + # Add one to the age of the bloop. + self.attributes['age'] += 1 + + # Save the data when the age of the bloop is a multiple of 10. if self.attributes['age'] % 10 == 0: self.write_save() + + # Reset frame counter self.frames_passed = 0 @@ -162,7 +170,7 @@ class PlaygroundFriend(pygame.sprite.Sprite): self.index = 0 self.image = self.images[self.index] - self.animation_frames = 1 + self.movement_frames = game_fps / 2 # How many frames pass before the bloop moves self.current_frame = 0 def update(self): @@ -170,27 +178,34 @@ class PlaygroundFriend(pygame.sprite.Sprite): Takes the images loaded and animates it, spacing it out equally for the framerate. """ - margins = 9 - movement_amount = 4 + margins = 9 # Margins for how far the bloop can move from the left and the right of the screen + movement_amount = 2 # Pixels that the bloop moves in one movement self.current_frame += 1 - if self.current_frame >= self.animation_frames: - self.current_frame = 0 - self.index = (self.index + 1) % len(self.images) - self.image = self.images[self.index] - # Move the sprite so long as it is not in the egg stage - if self.evolution_stage != 0: + # Check to see if the number of movement frames has passed + if self.current_frame >= self.movement_frames: + self.current_frame = 0 + + # Move only if the bloop is not in the egg stage + if self.evolution_stage != 'egg': + + # Change direction if the bloop has reached either edge of the screen if self.rect.x < margins: self.direction = 1 elif self.rect.x > game_res - margins - self.rect.width: self.direction = 0 + # Move according to the direction. if self.direction == 0: self.rect.x -= movement_amount else: self.rect.x += movement_amount + # Animate the bloop + self.index = (self.index + 1) % len(self.images) + self.image = self.images[self.index] + class SelectionEgg(pygame.sprite.Sprite): """ @@ -222,25 +237,13 @@ class SelectionEgg(pygame.sprite.Sprite): self.index = 0 self.image = self.images[self.index] - self.animation_frames = 1 - self.current_frame = 0 - - def update_frame_dependent(self): - """ - Takes the images loaded and animates it, spacing it out equally for the framerate. - """ - - self.current_frame += 1 - if self.current_frame >= self.animation_frames: - self.current_frame = 0 - self.index = (self.index + 1) % len(self.images) - self.image = self.images[self.index] - def update(self): """ Updates the sprite object. """ - self.update_frame_dependent() + # Animate the sprite + self.index = (self.index + 1) % len(self.images) + self.image = self.images[self.index] class EggInfo: @@ -284,6 +287,7 @@ class EggInfo: Draw the info icons on a given surface. :param surface: the surface to draw the icons on. """ + # Blit the info onto the given surface. surface.blit(self.surface, (self.x, self.y)) From 307543e4f9ae78a453a3efc6f5ab635c2106297a Mon Sep 17 00:00:00 2001 From: Nick Dyer Date: Wed, 16 Jun 2021 03:43:51 -0400 Subject: [PATCH 33/39] added submenu to the playground, added dummy class 'pet' for PlaygroundFriend --- pocket_friends/game_files/game.py | 53 +++++++++++++++++++++++++++---- 1 file changed, 47 insertions(+), 6 deletions(-) diff --git a/pocket_friends/game_files/game.py b/pocket_friends/game_files/game.py index 142e5e5..514fd00 100644 --- a/pocket_friends/game_files/game.py +++ b/pocket_friends/game_files/game.py @@ -173,6 +173,12 @@ class PlaygroundFriend(pygame.sprite.Sprite): self.movement_frames = game_fps / 2 # How many frames pass before the bloop moves self.current_frame = 0 + def pet(self): + """ + Pet the bloop! + """ + pass + def update(self): """ Takes the images loaded and animates it, spacing it out equally for the framerate. @@ -701,15 +707,50 @@ def game(): game_state = 'init' elif game_state == 'playground': - all_sprites.empty() - bloop = PlaygroundFriend(data_handler) - all_sprites.add(bloop) + # Submenu used within the playground. + submenu = 'main' while running and game_state == 'playground': - pre_handler() - data_handler.update() - draw() + + all_sprites.empty() + + if submenu == 'main': + + # Create the bloop and the menu + bloop = PlaygroundFriend(data_handler) + all_sprites.add(bloop) + popup_menu = PopupMenu((3, 3)) + + while running and game_state == 'playground' and submenu == 'main': + pre_handler() + data_handler.update() + + for event in pygame.event.get(): + if event.type == pygame.KEYDOWN: + if event.key == Constants.buttons.get('j_r'): + # Move selection to the next item + popup_menu.next() + if event.key == Constants.buttons.get('j_l'): + # Move selection to the previous item + popup_menu.prev() + if event.key == Constants.buttons.get('a'): + # Change submenu to the menu the icon points to + if popup_menu.draw_menu: + submenu = popup_menu.icons[popup_menu.selected].icon + else: # Pet the bloop otherwise + bloop.pet() + if event.key == Constants.buttons.get('b'): + # Toggle the popup menu on or off + popup_menu.toggle() + + # Draw the popup menu if toggled on + popup_menu.draw(surface) + + draw() + + else: # Go to the error state if an invalid state is set. + game_state = None elif game_state == 'init': all_sprites.empty() From 3e25d66e9ad2a59745e394094e4ca81ca6545a6a Mon Sep 17 00:00:00 2001 From: Nick Dyer Date: Wed, 16 Jun 2021 17:44:27 -0400 Subject: [PATCH 34/39] fixing documentation where "game" is replaced with "hardware" for some reason --- pocket_friends/game_files/game.py | 38 ++++++++++++++++--------------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/pocket_friends/game_files/game.py b/pocket_friends/game_files/game.py index 514fd00..616ce83 100644 --- a/pocket_friends/game_files/game.py +++ b/pocket_friends/game_files/game.py @@ -1,5 +1,5 @@ """ -Main file for the entire hardware. Controls everything except for GPIO input. +Main file for the entire game. Controls everything except for GPIO input. """ from collections import deque import importlib.util @@ -526,24 +526,26 @@ os.environ["SDL_FBDEV"] = "/dev/fb1" try: importlib.util.find_spec('RPi.GPIO') import RPi.GPIO as GPIO + on_hardware = True except ImportError: import pocket_friends.development.FakeGPIO as GPIO + on_hardware = False def game(): """ - Starts the hardware. + Starts the game. """ pygame.init() # Hide the cursor for the Pi display. pygame.mouse.set_visible(False) - # The hardware is normally rendered at 80 pixels and upscaled from there. If changing displays, change the + # The game is normally rendered at 80 pixels and upscaled from there. If changing displays, change the # screen_size to reflect what the resolution of the new display is. - screen_size = 320 + screen_size = 800 window = pygame.display.set_mode((screen_size, screen_size)) surface = pygame.Surface((game_res, game_res)) @@ -557,10 +559,10 @@ def game(): clock = pygame.time.Clock() - # Font used for small text in the hardware. Bigger text is usually image files. + # Font used for small text in the game. Bigger text is usually image files. small_font = pygame.font.Font(script_dir + '/resources/fonts/5Pts5.ttf', 10) - # Default hardware state when the hardware first starts. + # Default game state when the game first starts. game_state = 'title' running = True data_handler = DataHandler() @@ -571,7 +573,7 @@ def game(): # Start the GPIO handler to take in buttons from the RPi HAT. GPIOHandler.setup() - # Dev code used to exit the hardware. Default Down, Down, Up, Up, Down, Down, Up, Up, A, A, B + # Dev code used to exit the game. Default Down, Down, Up, Up, Down, Down, Up, Up, A, A, B dev_code = deque() for button in [Constants.buttons.get('j_d'), Constants.buttons.get('j_d'), Constants.buttons.get('j_u'), Constants.buttons.get('j_u'), Constants.buttons.get('j_d'), Constants.buttons.get('j_d'), @@ -601,7 +603,7 @@ def game(): def draw_bg(): """ - Draws the main hardware background image onto a given surface. + Draws the main game background image onto a given surface. """ bg_image = pygame.image.load(script_dir + '/resources/images/bg.png').convert() surface.blit(bg_image, (0, 0)) @@ -650,7 +652,7 @@ def game(): def keyboard_handler(): """ - Simulates key presses to GPIO button presses. Also handles quitting the hardware. + Simulates key presses to GPIO button presses. Also handles quitting the game. """ nonlocal running @@ -678,10 +680,10 @@ def game(): def pre_handler(): """ - Runs at the beginning of each loop, handles drawing the background, controlling hardware speed, and + Runs at the beginning of each loop, handles drawing the background, controlling game speed, and controlling the GPIO button inputs and keyboard handler """ - # Regulate the speed of the hardware. + # Regulate the speed of the game. clock.tick(game_fps) # Handle all inputs for both debugging and real GPIO button presses. @@ -702,7 +704,7 @@ def game(): surface.blit(title_image, (0, 0)) draw() - # Show the title for 1 second then move on to the initialization phase of the hardware. + # Show the title for 1 second then move on to the initialization phase of the game. pygame.time.wait(1000) game_state = 'init' @@ -738,7 +740,7 @@ def game(): # Change submenu to the menu the icon points to if popup_menu.draw_menu: submenu = popup_menu.icons[popup_menu.selected].icon - else: # Pet the bloop otherwise + else: # Pet the bloop otherwise bloop.pet() if event.key == Constants.buttons.get('b'): # Toggle the popup menu on or off @@ -760,8 +762,8 @@ def game(): # Read the save file. data_handler.read_save() - # Determines if it is a new hardware or not by looking at the evolution stage. If it is -1, the egg has - # not been created yet, and the hardware sends you to the egg selection screen. If not, the hardware sends + # Determines if it is a new game or not by looking at the evolution stage. If it is -1, the egg has + # not been created yet, and the game sends you to the egg selection screen. If not, the game sends # you to the playground. if data_handler.attributes['bloop'] == '': game_state = 'egg_select' @@ -941,10 +943,10 @@ def game(): game_state = None else: - # Error screen. This appears when an invalid hardware state has been selected. + # Error screen. This appears when an invalid game state has been selected. all_sprites.empty() - frames_passed = 0 # Counter for frames, helps ensure the hardware isn't frozen. + frames_passed = 0 # Counter for frames, helps ensure the game isn't frozen. while running and game_state != 'title': @@ -974,7 +976,7 @@ def game(): def main(): """ - Calls the hardware() function to start the hardware. + Calls the game() function to start the game. """ game() From 40983db230dc3d24f1e5aca60bdd942663d53481 Mon Sep 17 00:00:00 2001 From: Nick Dyer Date: Sat, 19 Jun 2021 23:31:19 -0400 Subject: [PATCH 35/39] aligned popup menu icons to look nicer --- pocket_friends/game_files/game.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pocket_friends/game_files/game.py b/pocket_friends/game_files/game.py index 616ce83..b5a9d91 100644 --- a/pocket_friends/game_files/game.py +++ b/pocket_friends/game_files/game.py @@ -471,7 +471,7 @@ class PopupMenu: icon.select() # Calculate the position of the icon on screen - icon.rect.x = position[0] + 2 + (i * 14) + icon.rect.x = 10 + (i * 15) - (icon.image.get_width() / 2) icon.rect.y = position[1] + self.frame.get_height() / 2 - icon.image.get_height() / 2 # Add the icon to the sprite group. From a203a14118bd27e7687a150313373d4cb3ec3735 Mon Sep 17 00:00:00 2001 From: Nick Dyer Date: Sat, 19 Jun 2021 23:32:01 -0400 Subject: [PATCH 36/39] changed resolution back to 320x320 --- pocket_friends/game_files/game.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pocket_friends/game_files/game.py b/pocket_friends/game_files/game.py index b5a9d91..dfd3e66 100644 --- a/pocket_friends/game_files/game.py +++ b/pocket_friends/game_files/game.py @@ -545,7 +545,7 @@ def game(): # The game is normally rendered at 80 pixels and upscaled from there. If changing displays, change the # screen_size to reflect what the resolution of the new display is. - screen_size = 800 + screen_size = 320 window = pygame.display.set_mode((screen_size, screen_size)) surface = pygame.Surface((game_res, game_res)) From 8895e9f6be1411f1f418e2227935c8985a99550d Mon Sep 17 00:00:00 2001 From: Nick Dyer Date: Sat, 19 Jun 2021 23:35:15 -0400 Subject: [PATCH 37/39] fixed formatting not following PEP standards --- pocket_friends/__main__.py | 1 - 1 file changed, 1 deletion(-) diff --git a/pocket_friends/__main__.py b/pocket_friends/__main__.py index 68f6a97..8bc143a 100644 --- a/pocket_friends/__main__.py +++ b/pocket_friends/__main__.py @@ -20,7 +20,6 @@ if __name__ == '__main__': save_dir = os.path.join(Path.home(), '.pocket_friends') os.remove(save_dir + '/save.json') - if not enable_dev: game_main() else: From 3bcbec660e4a8ba0afb0fa0e6288c79d3a8eb16b Mon Sep 17 00:00:00 2001 From: Nick Dyer Date: Sat, 19 Jun 2021 23:35:36 -0400 Subject: [PATCH 38/39] changed version to dev_0.0.3 --- pocket_friends/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pocket_friends/__init__.py b/pocket_friends/__init__.py index 463e1b1..c8ad717 100644 --- a/pocket_friends/__init__.py +++ b/pocket_friends/__init__.py @@ -1 +1 @@ -__version__ = 'dev_0.0.2' +__version__ = 'dev_0.0.3' From 47cbe15369543123269aa8eecb86dd5a183e7f22 Mon Sep 17 00:00:00 2001 From: Nick Dyer Date: Sun, 20 Jun 2021 00:43:08 -0400 Subject: [PATCH 39/39] fixed typo: contentness to contentedness --- pocket_friends/game_files/game.py | 14 +++++++------- .../game_files/resources/data/bloop_info/blue.json | 2 +- .../resources/data/bloop_info/dev_egg.json | 2 +- .../resources/data/bloop_info/rainbow.json | 2 +- .../game_files/resources/data/bloop_info/red.json | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/pocket_friends/game_files/game.py b/pocket_friends/game_files/game.py index dfd3e66..6b6d248 100644 --- a/pocket_friends/game_files/game.py +++ b/pocket_friends/game_files/game.py @@ -230,7 +230,7 @@ class SelectionEgg(pygame.sprite.Sprite): # Gets the description off the egg from the JSON file. self.description = json_file.get('description') - self.contentness = json_file.get('contentness') + self.contentedness = json_file.get('contentedness') self.metabolism = json_file.get('metabolism') # Load the egg from the given color and get the bounding rectangle for the image. @@ -254,11 +254,11 @@ class SelectionEgg(pygame.sprite.Sprite): class EggInfo: """ - Class to draw the contentness and metabolism value off the egg on the info screen. + Class to draw the contentedness and metabolism value off the egg on the info screen. """ - def __init__(self, contentness, metabolism, location): - self.contentness = contentness + def __init__(self, contentedness, metabolism, location): + self.contentedness = contentedness self.metabolism = metabolism self.x = location[0] self.y = location[1] @@ -272,9 +272,9 @@ class EggInfo: apple = pygame.image.load(script_dir + '/resources/images/gui/apple.png').convert_alpha() self.surface.blit(apple, (1, 9)) - # Draw 5 stars. If the value of the contentness is less than the current star, make it a blank star. + # Draw 5 stars. If the value of the contentedness is less than the current star, make it a blank star. for i in range(5): - if i < self.contentness: + if i < self.contentedness: star = pygame.image.load(script_dir + '/resources/images/gui/star.png').convert_alpha() else: star = pygame.image.load(script_dir + '/resources/images/gui/blank_star.png').convert_alpha() @@ -904,7 +904,7 @@ def game(): # Info screen for the eggs. info_text = InfoText(small_font, egg.description) - info_icons = EggInfo(egg.contentness, egg.metabolism, (32, 4)) + info_icons = EggInfo(egg.contentedness, egg.metabolism, (32, 4)) while running and game_state == 'egg_select' and submenu == 'bloop_info': diff --git a/pocket_friends/game_files/resources/data/bloop_info/blue.json b/pocket_friends/game_files/resources/data/bloop_info/blue.json index 3080216..4cdc731 100644 --- a/pocket_friends/game_files/resources/data/bloop_info/blue.json +++ b/pocket_friends/game_files/resources/data/bloop_info/blue.json @@ -1,5 +1,5 @@ { "description": "This is Blue! They are a easy going bloop, with a laid back personality that you will love! They are also easy to take care of, as they just enjoy living life!", - "contentness": 4, + "contentedness": 4, "metabolism": 5 } \ No newline at end of file diff --git a/pocket_friends/game_files/resources/data/bloop_info/dev_egg.json b/pocket_friends/game_files/resources/data/bloop_info/dev_egg.json index 2e7e213..e634dd3 100644 --- a/pocket_friends/game_files/resources/data/bloop_info/dev_egg.json +++ b/pocket_friends/game_files/resources/data/bloop_info/dev_egg.json @@ -1,5 +1,5 @@ { "description": "Dev egg description", - "contentness": 4, + "contentedness": 4, "metabolism": 4 } \ No newline at end of file diff --git a/pocket_friends/game_files/resources/data/bloop_info/rainbow.json b/pocket_friends/game_files/resources/data/bloop_info/rainbow.json index 86f158a..9c296f6 100644 --- a/pocket_friends/game_files/resources/data/bloop_info/rainbow.json +++ b/pocket_friends/game_files/resources/data/bloop_info/rainbow.json @@ -1,5 +1,5 @@ { "description": "Rainbow egg description", - "contentness": 5, + "contentedness": 5, "metabolism": 4 } \ No newline at end of file diff --git a/pocket_friends/game_files/resources/data/bloop_info/red.json b/pocket_friends/game_files/resources/data/bloop_info/red.json index 4b0f64d..e657d2b 100644 --- a/pocket_friends/game_files/resources/data/bloop_info/red.json +++ b/pocket_friends/game_files/resources/data/bloop_info/red.json @@ -1,5 +1,5 @@ { "description": "Red egg description", - "contentness": 5, + "contentedness": 5, "metabolism": 5 } \ No newline at end of file