From 963f760160f3608118f7c8c45bffd25b05074d09 Mon Sep 17 00:00:00 2001 From: Nick Dyer Date: Sat, 5 Jun 2021 19:12:22 -0400 Subject: [PATCH] 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'