def draw(): global REDRAW_TIMES if REDRAW_TIMES: display.fill_surface('ui_inventory', (45, 45, 45)) REDRAW_TIMES -= 1
def show_inventory(entity): global ACTIVE_MENU display.fill_surface('ui_inventory', (45, 45, 45)) events.register_event('draw', draw) _holder_menu = ui_menu.create(1, 1, title='Inventory', surface='ui_inventory', click_offset=(constants.MAP_VIEW_WIDTH-35, 0)) ACTIVE_MENU = _holder_menu ui_menu.add_selectable(_holder_menu, 'Weapon', lambda: show_weapons(entity))
def show_inventory(entity): global ACTIVE_MENU display.fill_surface('ui_inventory', (45, 45, 45)) events.register_event('draw', draw) _holder_menu = ui_menu.create(1, 1, title='Inventory', surface='ui_inventory', click_offset=(constants.MAP_VIEW_WIDTH - 35, 0)) ACTIVE_MENU = _holder_menu ui_menu.add_selectable(_holder_menu, 'Weapon', lambda: show_weapons(entity))
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 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]])