def main_game_loop(): ##-- This is for navigating the map --## global opening, x, y if os.path.getsize('Worldmap.db') == 8192: Engine.map_builder() # while os.path.getsize('Worldmap.db') != 10000: # print('Loading...........') if opening == True: Story.intro_story(player_in_game.name) input("Press Enter to continue: ") opening = False map_info = Engine.get_tile(x, y) Screen.display(f"Location: {map_info[0][2]}") move_to = input( "Which way do you want to travel?\n\n(1): North\n(2): South\n(3): East\n(4): West\n(5): Quit\nInput a Number:> " ) ##-- NORTH = 1, SOUTH = 2, EAST = 3, & WEST = 4 if move_to == '1': ##-- UP --## if y > 0: y -= 1 encounter() else: print('NEED TO MAKE THE PLAYER TO TELEPORT TO OTHER SIDE OF MAP') pause() main_game_loop() elif move_to == '2': ##-- DOWN --## if y < small: y += 1 encounter() else: print('NEED TO MAKE THE PLAYER TO TELEPORT TO OTHER SIDE OF MAP') pause() main_game_loop() elif move_to == '3': ##-- RIGHT --## if x > 0: x += 1 encounter() else: print('NEED TO MAKE THE PLAYER TO TELEPORT TO OTHER SIDE OF MAP') pause() main_game_loop() elif move_to == '4': ##-- LEFT --## if x < small: x -= 1 encounter() else: print('NEED TO MAKE THE PLAYER TO TELEPORT TO OTHER SIDE OF MAP') pause() main_game_loop() elif move_to == '5': ##-- QUIT, I'll take this out after testing --## sys.exit()
def get_resouces(): biome_into = Engine.get_tile(x, y) biome_item = Biome.world_biomes[biome_into[2]]['resource'] random_item = random.choice(biome_item) item = Items.resources[random_item] player_inventory.add_item(item) pause() if biome_or_subBiome == False: main_game_loop() else: sub_map_move()
def main_game_loop(): ##-- This is for navigating the map --## global opening, x, y, sub_x, sub_y, biome_or_subBiome biome_or_subBiome = False if os.path.getsize('Worldmap.db') == 12288: Engine.map_builder() # while os.path.getsize('Worldmap.db') != 10000: # print('Loading...........') if opening == True: Story.intro_story(player_in_game.name) input("Press Enter to continue: ") opening = False map_info = Engine.get_tile(x, y) sub_x = map_info[0][8] sub_y = map_info[0][9] Engine.update_tile(x, y, True) Screen.display(f"Location: {map_info[0][3]}") move_to = input( "Which way do you want to travel?\n\n(1): North\n(2): South\n(3): East\n(4): West\n(5): Inspect Area\n(6): Inventory\n(7): Look For Resources\nInput a Number:> " ) ##-- NORTH = 1, SOUTH = 2, EAST = 3, & WEST = 4 if move_to == '1': ##-- UP --## if y > 0: y -= 1 encounter() else: print('NEED TO MAKE THE PLAYER TO TELEPORT TO OTHER SIDE OF MAP') pause() main_game_loop() elif move_to == '2': ##-- DOWN --## if y < small: y += 1 encounter() else: print('NEED TO MAKE THE PLAYER TO TELEPORT TO OTHER SIDE OF MAP') pause() main_game_loop() elif move_to == '3': ##-- RIGHT --## if x > 0: x += 1 encounter() else: print('NEED TO MAKE THE PLAYER TO TELEPORT TO OTHER SIDE OF MAP') pause() main_game_loop() elif move_to == '4': ##-- LEFT --## if x < small: x -= 1 encounter() else: print('NEED TO MAKE THE PLAYER TO TELEPORT TO OTHER SIDE OF MAP') pause() main_game_loop() elif move_to == '5': inspect_area(map_info[0][2]) elif move_to == '6': look_in_inventory() elif move_to == '7': get_resouces() elif move_to == 'Quit': ##-- QUIT, I'll take this out after testing --## sys.exit() else: print("Not an option.") pause() main_game_loop()
def sub_map_move(): global biome_or_subBiome, x, y, sub_x, sub_y clear() biome_or_subBiome = True map_info = Engine.get_tile(x, y) sub_map_info = Engine.get_subTile(x, y, sub_x, sub_y) Engine.update_subTile(x, y, sub_x, sub_y, True) Screen.display( f"Biome in: {sub_map_info[0][4]} Room: {sub_map_info[0][5]}") if sub_x == map_info[0][8] and sub_y == map_info[0][9]: options = "Which way do you want to move?\n\n(1): North\n(2): South\n(3): East\n(4): West\n(5): Look For Resources\n(6): Inventory\n(7): Exit\nInput a Number:> " else: options = "Which way do you want to move?\n\n(1): North\n(2): South\n(3): East\n(4): West\n(5): Look For Resources\n(6): Inventory\nInput a Number:> " move_to = input(options) ##-- NORTH = 1, SOUTH = 2, EAST = 3, & WEST = 4 if move_to == '1': ##-- UP --## if sub_y > 0: sub_y -= 1 encounter() else: print('Looks Like It Dead Ends Here') pause() main_game_loop() elif move_to == '2': ##-- DOWN --## if sub_y < small: sub_y += 1 encounter() else: print('Looks Like It Dead Ends Here') pause() main_game_loop() elif move_to == '3': ##-- RIGHT --## if sub_x > 0: sub_x += 1 encounter() else: print('Looks Like It Dead Ends Here') pause() main_game_loop() elif move_to == '4': ##-- LEFT --## if sub_x < small: sub_x -= 1 encounter() else: print('Looks Like It Dead Ends Here') pause() main_game_loop() elif move_to == '5': get_resouces() elif move_to == '6': look_in_inventory() elif move_to == '7' and sub_x == map_info[0][8] and sub_y == map_info[0][9]: main_game_loop() elif move_to == 'Quit': ##-- QUIT, I'll take this out after testing --## sys.exit()
def random_enemy(): global mob biome_info = Engine.get_tile(x, y) spawns = Biome.world_biomes[biome_info[0][2]]['spawns'] random_mob = random.choice(spawns) mob = Mobs.hostail_mobs[random_mob]
elif move_to == '4': ##-- LEFT --## if x < small: x -= 1 encounter() else: print('NEED TO MAKE THE PLAYER TO TELEPORT TO OTHER SIDE OF MAP') pause() main_game_loop() elif move_to == '5': inspect_area(map_info[0][2]) elif move_to == '6': look_in_inventory() elif move_to == '7': get_resouces() elif move_to == 'Quit': ##-- QUIT, I'll take this out after testing --## sys.exit() else: print("Not an option.") pause() main_game_loop() Engine.make_map_datebase() main()