Exemple #1
0
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]])
Exemple #2
0
def create():
	global QUIT
	
	QUIT = False
	
	entities.create_entity_group('tiles', static=True)
	entities.create_entity_group('bullets', static=True)
	entities.create_entity_group('node_grid', static=True)
	entities.create_entity_group('missions', static=True)
	entities.create_entity_group('ui')
	entities.create_entity_group('ui_menus')
	entities.create_entity_group('ui_dialogs')
	entities.create_entity_group('nodes')
	entities.create_entity_group('effects_freetick')
	entities.create_entity_group('ui_effects_freetick')
	entities.create_entity_group('contexts')
	entities.create_entity_group('effects', static=True)
	entities.create_entity_group('ui_effects', static=True)

	display.create_surface('life', width=constants.MAP_VIEW_WIDTH, height=constants.MAP_VIEW_HEIGHT)
	display.create_surface('items', width=constants.MAP_VIEW_WIDTH, height=constants.MAP_VIEW_HEIGHT)
	display.create_surface('nodes', width=constants.MAP_VIEW_WIDTH, height=constants.MAP_VIEW_HEIGHT)
	display.create_surface('node_grid', width=constants.MAP_VIEW_WIDTH, height=constants.MAP_VIEW_HEIGHT)
	display.create_surface('effects', width=constants.MAP_VIEW_WIDTH, height=constants.MAP_VIEW_HEIGHT)
	display.create_surface('ui_inventory', width=35, height=constants.MAP_VIEW_HEIGHT)
	display.create_surface('ui')
	display.create_surface('ui_menus')
	display.create_surface('ui_dialogs')
	
	display.set_clear_surface('effects', 'tiles')
	display.set_clear_surface('ui_menus', 'tiles')
	display.set_clear_surface('ui_dialogs', 'tiles')
	display.set_clear_surface('ui', 'tiles')
	display.set_clear_surface('life', 'tiles')
	display.set_clear_surface('nodes', 'tiles')
	display.set_clear_surface('effects', 'tiles')
	
	events.register_event('mouse_pressed', handle_mouse_pressed)
	events.register_event('mouse_moved', handle_mouse_movement)
	events.register_event('camera', camera.update)
	
	camera.set_pos(0, 0)
	
	ui_cursor.boot()
	ai.boot()
	ui_input.boot()
	ui_draw.boot()
	ui_menu.boot()
	ui_dialog.boot()
	ui_director.boot()
Exemple #3
0
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]])
Exemple #4
0
def create():
    global QUIT

    QUIT = False

    entities.create_entity_group('tiles', static=True)
    entities.create_entity_group('bullets', static=True)
    entities.create_entity_group('node_grid', static=True)
    entities.create_entity_group('missions', static=True)
    entities.create_entity_group('ui')
    entities.create_entity_group('ui_menus')
    entities.create_entity_group('ui_dialogs')
    entities.create_entity_group('nodes')
    entities.create_entity_group('effects_freetick')
    entities.create_entity_group('ui_effects_freetick')
    entities.create_entity_group('contexts')
    entities.create_entity_group('effects', static=True)
    entities.create_entity_group('ui_effects', static=True)

    display.create_surface('life',
                           width=constants.MAP_VIEW_WIDTH,
                           height=constants.MAP_VIEW_HEIGHT)
    display.create_surface('items',
                           width=constants.MAP_VIEW_WIDTH,
                           height=constants.MAP_VIEW_HEIGHT)
    display.create_surface('nodes',
                           width=constants.MAP_VIEW_WIDTH,
                           height=constants.MAP_VIEW_HEIGHT)
    display.create_surface('node_grid',
                           width=constants.MAP_VIEW_WIDTH,
                           height=constants.MAP_VIEW_HEIGHT)
    display.create_surface('effects',
                           width=constants.MAP_VIEW_WIDTH,
                           height=constants.MAP_VIEW_HEIGHT)
    display.create_surface('ui_inventory',
                           width=35,
                           height=constants.MAP_VIEW_HEIGHT)
    display.create_surface('ui')
    display.create_surface('ui_menus')
    display.create_surface('ui_dialogs')

    display.set_clear_surface('effects', 'tiles')
    display.set_clear_surface('ui_menus', 'tiles')
    display.set_clear_surface('ui_dialogs', 'tiles')
    display.set_clear_surface('ui', 'tiles')
    display.set_clear_surface('life', 'tiles')
    display.set_clear_surface('nodes', 'tiles')
    display.set_clear_surface('effects', 'tiles')

    events.register_event('mouse_pressed', handle_mouse_pressed)
    events.register_event('mouse_moved', handle_mouse_movement)
    events.register_event('camera', camera.update)

    camera.set_pos(0, 0)

    ui_cursor.boot()
    ai.boot()
    ui_input.boot()
    ui_draw.boot()
    ui_menu.boot()
    ui_dialog.boot()
    ui_director.boot()