Exemplo n.º 1
0
         answer = str(input('> '))
         if answer.startswith('y'):
             if not os.path.exists('hac-maps') or not os.path.isdir('hac-maps'):
                 os.makedirs('hac-maps')
             game.object_library = object_history
             game.save_board(1,'hac-maps/'+game.current_board().name.replace(' ','_')+'.json')
     break
 elif key == 'S':
     save_current_board()
     info_messages.append("Board saved")
 elif key == 'm':
     if menu_mode == 'full':
         menu_mode = 'hidden'
     else:
         menu_mode = 'full'
     game.update_menu_entry('main',None,'\n=== Menu ('+menu_mode+') ===')
 elif current_menu == 'main':
     if key == 'w':
         game.move_player(Constants.UP,1)
     elif key == 's':
         game.move_player(Constants.DOWN,1)
     elif key == 'a':
         game.move_player(Constants.LEFT,1)
     elif key == 'd':
         game.move_player(Constants.RIGHT,1)
     elif key == "k" and edit_mode:
         place_and_go( current_object, game.player.pos[0], game.player.pos[1], Constants.DOWN )
     elif key == "i" and edit_mode:
         place_and_go( current_object, game.player.pos[0], game.player.pos[1], Constants.UP )
     elif key == "j" and edit_mode:
         place_and_go( current_object, game.player.pos[0], game.player.pos[1], Constants.LEFT )
Exemplo n.º 2
0
         if answer.startswith('y'):
             if not os.path.exists('hac-maps') or not os.path.isdir(
                     'hac-maps'):
                 os.makedirs('hac-maps')
             game.object_library = object_history
             game.save_board(1, current_file)
     break
 elif key == 'S':
     save_current_board()
     info_messages.append("Board saved")
 elif key == 'm':
     if menu_mode == 'full':
         menu_mode = 'hidden'
     else:
         menu_mode = 'full'
     game.update_menu_entry('main', None,
                            '\n=== Menu (' + menu_mode + ') ===')
 elif current_menu == 'main':
     if key == 'w':
         game.move_player(Constants.UP, 1)
     elif key == 's':
         game.move_player(Constants.DOWN, 1)
     elif key == 'a':
         game.move_player(Constants.LEFT, 1)
     elif key == 'd':
         game.move_player(Constants.RIGHT, 1)
     elif key == "k" and edit_mode:
         place_and_go(current_object, game.player.pos[0],
                      game.player.pos[1], Constants.DOWN)
     elif key == "i" and edit_mode:
         place_and_go(current_object, game.player.pos[0],
                      game.player.pos[1], Constants.UP)
Exemplo n.º 3
0
             for o in object_history:
                 if o not in game.config("settings")["object_library"]:
                     game.config("settings")["object_library"].append(o)
             game.save_board(1, current_file)
     break
 elif key == "S":
     save_current_board()
     info_messages.append("Board saved")
 elif key == "m":
     if game.config("settings")["menu_mode"] == "full":
         game.config("settings")["menu_mode"] = "hidden"
     else:
         game.config("settings")["menu_mode"] = "full"
     game.update_menu_entry(
         "main",
         None,
         "\n=== Menu (" + game.config("settings")["menu_mode"] + ") ===",
     )
 elif current_menu == "main":
     if key == Utils.key.UP:
         game.move_player(Constants.UP, 1)
     elif key == Utils.key.DOWN:
         game.move_player(Constants.DOWN, 1)
     elif key == Utils.key.LEFT:
         game.move_player(Constants.LEFT, 1)
     elif key == Utils.key.RIGHT:
         game.move_player(Constants.RIGHT, 1)
     elif key == "k" and edit_mode:
         current_object_instance = place_and_go(current_object,
                                                game.player.pos[0],
                                                game.player.pos[1],