def create(): global MAP, FADER worlds.create('strategy') words.reset() display.create_surface('background') display.create_surface('map', width=constants.STRAT_MAP_WIDTH, height=constants.STRAT_MAP_HEIGHT) display.create_surface('map_markers', width=constants.STRAT_MAP_WIDTH, height=constants.STRAT_MAP_HEIGHT) display.create_surface('map_squads', width=constants.STRAT_MAP_WIDTH, height=constants.STRAT_MAP_HEIGHT) display.create_surface('map_path', width=constants.STRAT_MAP_WIDTH, height=constants.STRAT_MAP_HEIGHT) display.create_surface('ui_bar', width=constants.WINDOW_WIDTH, height=constants.WINDOW_HEIGHT-constants.STRAT_MAP_HEIGHT) display.fill_surface('ui_bar', (30, 30, 30)) display.blit_background('background') register_input() entities.create_entity_group('life', static=True) entities.create_entity_group('items', static=True) entities.create_entity_group('factions', static=True) entities.create_entity_group('squads', static=True) entities.create_entity_group('systems') FADER = entities.create_entity() timers.register(FADER) fade_in() _grid = {} _color_map = {} MAP = {'grid': _grid, 'color_map': _color_map, 'astar_map': None, 'astar_weight_map': numpy.ones((constants.STRAT_MAP_HEIGHT/constants.MAP_CELL_SPACE, constants.STRAT_MAP_WIDTH/constants.MAP_CELL_SPACE))} for x in range(constants.STRAT_MAP_WIDTH/constants.MAP_CELL_SPACE): for y in range(constants.STRAT_MAP_HEIGHT/constants.MAP_CELL_SPACE): _grid[x, y] = {'owned_by': None, 'is_ownable': False, 'squads': [], 'income': .025} worldgen.generate() unregister_input() world_action._start_battle(attacking_squads=[entities.get_entity_group('squads')[0]], defending_squads=[entities.get_entity_group('squads')[1]])
def enter_worldgen_mode(): global mode mode='worldgen' f.change_mode('symbols') f.wipe() w.generate(512) w.export() map=w.load_map(charnum=min(f.W,f.H)) for y in range(len(map)): for x in range(len(map[y])): c=map[x][y] if c>90: f.symbol(x,y,'^',color='white') elif c<40: f.symbol(x,y,'~',color='blue') elif c>60: f.symbol(x,y,'v',color='brown') else: f.symbol(x,y,'+',color='green')
def create(): global MAP, FADER worlds.create('strategy') words.reset() display.create_surface('background') display.create_surface('map', width=constants.STRAT_MAP_WIDTH, height=constants.STRAT_MAP_HEIGHT) display.create_surface('map_markers', width=constants.STRAT_MAP_WIDTH, height=constants.STRAT_MAP_HEIGHT) display.create_surface('map_squads', width=constants.STRAT_MAP_WIDTH, height=constants.STRAT_MAP_HEIGHT) display.create_surface('map_path', width=constants.STRAT_MAP_WIDTH, height=constants.STRAT_MAP_HEIGHT) display.create_surface('ui_bar', width=constants.WINDOW_WIDTH, height=constants.WINDOW_HEIGHT - constants.STRAT_MAP_HEIGHT) display.fill_surface('ui_bar', (30, 30, 30)) display.blit_background('background') register_input() entities.create_entity_group('life', static=True) entities.create_entity_group('items', static=True) entities.create_entity_group('factions', static=True) entities.create_entity_group('squads', static=True) entities.create_entity_group('systems') FADER = entities.create_entity() timers.register(FADER) fade_in() _grid = {} _color_map = {} MAP = { 'grid': _grid, 'color_map': _color_map, 'astar_map': None, 'astar_weight_map': numpy.ones((constants.STRAT_MAP_HEIGHT / constants.MAP_CELL_SPACE, constants.STRAT_MAP_WIDTH / constants.MAP_CELL_SPACE)) } for x in range(constants.STRAT_MAP_WIDTH / constants.MAP_CELL_SPACE): for y in range(constants.STRAT_MAP_HEIGHT / constants.MAP_CELL_SPACE): _grid[x, y] = { 'owned_by': None, 'is_ownable': False, 'squads': [], 'income': .025 } worldgen.generate() unregister_input() world_action._start_battle( attacking_squads=[entities.get_entity_group('squads')[0]], defending_squads=[entities.get_entity_group('squads')[1]])