term_res = 140 else: term_res = 80 g.partial_display_viewport = [10, int(term_res / 4)] # We need the hac-game-lib v1.1+ if Constants.HAC_GAME_LIB_VERSION < "1.1.0": Utils.print_white_on_red( "Super Panda Run EX require the hac-game-lib version 1.1.0 or greater." f" Version installed is {Constants.HAC_GAME_LIB_VERSION}") raise SystemExit() g = Game() g.enable_partial_display = True g.partial_display_viewport = [10, int(term_res / 4)] g.current_level = 0 g.player = Player(model=bg_color + Graphics.Sprites.PANDA + Graphics.Style.RESET_ALL) g.player.name = "Zigomar" g.player.max_y = g.player.pos[0] g.player.dy = gravity_speed g.player.last_y = g.player.pos[0] g.player.last_x = g.player.pos[1] g.timer = 60 g.score = 0 g.obj_stack = [] g.pause() if os.path.exists("settings-suparex.json"): g.load_config("settings-suparex.json", "settings")
print(f"starting position chosen: {random_board.player_starting_position}") # dg.print_map() # random_board.display() input("New random dungeon generated. Next?") g = Game() g.enable_partial_display = True # g.load_board('/home/arnaud/Code/Games/hgl-editor/Large_Dungeon.json', 1) g.player = Player(model=Sprites.MAGE) g.add_board(1, random_board) g.change_level(1) key = None viewport = [10, 10] g.partial_display_viewport = viewport while True: if key == "Q": break elif key == "S": g.save_board(1, f"random-dungeon-{randrange(1000,9999)}.json") elif key == "1": viewport = [10, 10] g.partial_display_viewport = viewport elif key == "2": viewport = [15, 30] g.partial_display_viewport = viewport elif key == "3": viewport = [20, 20] g.partial_display_viewport = viewport elif key == Utils.key.UP:
print("No pre-existing map found.") print("n - create a new map") print("q - Quit the editor") choice = input("Enter your choice (and hit ENTER): ") if choice == "q": print("Good Bye!") exit() elif choice == "n": create_board_wizard() break elif choice.isdigit() and int(choice) < len(hmaps): current_file = hmaps[int(choice)] board = game.load_board(hmaps[int(choice)], 1) if board.size[0] >= viewport_height or board.size[1] >= viewport_width: game.enable_partial_display = True game.partial_display_viewport = [viewport_height, viewport_width] else: game.enable_partial_display = False break game.change_level(1) if len(game.object_library) > 0: object_history += game.object_library for i in game.object_library: if i not in game.config("settings")["object_library"]: game.config("settings")["object_library"].append(i) # Build the menus i = 0 for sp in dir(Utils):