Ejemplo n.º 1
0
def handle_keyboard_input():
    if controls.get_input_char_pressed('\t'):
        if settings.TICK_MODE == 'strategy':
            if ui_panel.ACTIVE_MENU:
                ui_panel.close()
            else:
                ui_panel.show_inventory(entity)

        else:
            _x, _y = movement.get_position(entity)

            camera.set_pos(_x - constants.MAP_VIEW_WIDTH / 2,
                           _y - constants.MAP_VIEW_HEIGHT / 2)

    if controls.get_input_char_pressed('O'):
        settings.toggle_show_node_grid()

    elif controls.get_input_char_pressed('o'):
        settings.toggle_observer_mode()

    if controls.get_input_char_pressed('d'):
        _mx, _my = ui_cursor.get_map_position()

        for entity_id in entities.get_entity_group('life'):
            _entity = entities.get_entity(entity_id)

            if not numbers.distance(
                (_mx, _my), movement.get_position(_entity)):
                _x, _y = ui_cursor.get_screen_position()
                _menu = ui_menu.create(_x, _y, title='Debug')
                ui_menu.add_selectable(_menu, 'Show Metas',
                                       lambda: _show_metas(_entity))
                ui_menu.add_selectable(
                    _menu, 'Kill',
                    lambda: entities.trigger_event(_entity, 'kill'))
                ui_menu.add_selectable(_menu, 'Overwatch',
                                       lambda: ai_debugger.register(_entity))

                break

    if controls.get_input_char_pressed('l'):
        _x, _y = ui_cursor.get_screen_position()
        _mx, _my = ui_cursor.get_map_position()
        _weight = zones.get_active_weight_map()[_my, _mx]
        _menu = ui_menu.create(_x, _y, title='Tile Info')

        ui_menu.add_selectable(
            _menu, 'Warp', lambda: entities.trigger_event(
                entity, 'set_position', x=_mx, y=_my))
        ui_menu.add_selectable(
            _menu, 'Light', lambda: effects.light(_mx,
                                                  _my,
                                                  15,
                                                  r=random.uniform(1.0, 1.5),
                                                  g=random.uniform(1.0, 1.5),
                                                  light_map='static_lighting'))
        ui_menu.add_selectable(_menu, 'Weight: %s' % _weight, lambda: _)
Ejemplo n.º 2
0
def handle_mouse_pressed(x, y, button):
	if settings.TICK_MODE == 'strategy':
		ui_squad_control.handle_mouse_pressed(x, y, button)

	elif settings.TICK_MODE == 'normal':
		_c_x = (camera.X+x) - (constants.MAP_VIEW_WIDTH/2)
		_c_y = (camera.Y+y) - (constants.MAP_VIEW_HEIGHT/2)

		if button == 1:
			camera.set_pos(_c_x, _c_y)
Ejemplo n.º 3
0
def handle_mouse_pressed(x, y, button):
    if settings.TICK_MODE == 'strategy':
        ui_squad_control.handle_mouse_pressed(x, y, button)

    elif settings.TICK_MODE == 'normal':
        _c_x = (camera.X + x) - (constants.MAP_VIEW_WIDTH / 2)
        _c_y = (camera.Y + y) - (constants.MAP_VIEW_HEIGHT / 2)

        if button == 1:
            camera.set_pos(_c_x, _c_y)
Ejemplo n.º 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()
Ejemplo n.º 5
0
def handle_keyboard_input():
	if controls.get_input_char('w'):
		camera.set_pos(camera.X, camera.Y - 2)
	elif controls.get_input_char('s'):
		camera.set_pos(camera.X, camera.Y + 2)
	
	if controls.get_input_char('a'):
		camera.set_pos(camera.X - 2, camera.Y)
	elif controls.get_input_char('d'):
		camera.set_pos(camera.X + 2, camera.Y)
Ejemplo n.º 6
0
def handle_keyboard_input():
    if controls.get_input_char('w'):
        camera.set_pos(camera.X, camera.Y - 2)
    elif controls.get_input_char('s'):
        camera.set_pos(camera.X, camera.Y + 2)

    if controls.get_input_char('a'):
        camera.set_pos(camera.X - 2, camera.Y)
    elif controls.get_input_char('d'):
        camera.set_pos(camera.X + 2, camera.Y)
Ejemplo n.º 7
0
def handle_keyboard_input():
	if controls.get_input_char_pressed('\t'):
		if settings.TICK_MODE == 'strategy':
			if ui_panel.ACTIVE_MENU:
				ui_panel.close()
			else:
				ui_panel.show_inventory(entity)
		
		else:
			_x, _y = movement.get_position(entity)
			
			camera.set_pos(_x - constants.MAP_VIEW_WIDTH/2, _y - constants.MAP_VIEW_HEIGHT/2)
	
	if controls.get_input_char_pressed('O'):
		settings.toggle_show_node_grid()
	
	elif controls.get_input_char_pressed('o'):
		settings.toggle_observer_mode()
	
	if controls.get_input_char_pressed('d'):
		_mx, _my = ui_cursor.get_map_position()
		
		for entity_id in entities.get_entity_group('life'):
			_entity = entities.get_entity(entity_id)
			
			if not numbers.distance((_mx, _my), movement.get_position(_entity)):
				_x, _y = ui_cursor.get_screen_position()
				_menu = ui_menu.create(_x, _y, title='Debug')
				ui_menu.add_selectable(_menu, 'Show Metas', lambda: _show_metas(_entity))
				ui_menu.add_selectable(_menu, 'Kill', lambda: entities.trigger_event(_entity, 'kill'))
				ui_menu.add_selectable(_menu, 'Overwatch', lambda: ai_debugger.register(_entity))
				
				break
	
	if controls.get_input_char_pressed('l'):
		_x, _y = ui_cursor.get_screen_position()
		_mx, _my = ui_cursor.get_map_position()
		_weight = zones.get_active_weight_map()[_my, _mx]
		_menu = ui_menu.create(_x, _y, title='Tile Info')
		
		ui_menu.add_selectable(_menu, 'Warp', lambda: entities.trigger_event(entity, 'set_position', x=_mx, y=_my))
		ui_menu.add_selectable(_menu, 'Light', lambda: effects.light(_mx, _my, 15, r=random.uniform(1.0, 1.5), g=random.uniform(1.0, 1.5), light_map='static_lighting'))
		ui_menu.add_selectable(_menu, 'Weight: %s' % _weight, lambda: _)
Ejemplo n.º 8
0
def logic():
	if not ui_dialog.ACTIVE_DIALOG and not ui_menu.ACTIVE_MENU:
		if CURSOR['tile']['x'] > constants.MAP_VIEW_WIDTH - 5:
			camera.set_pos(camera.X + 3, camera.Y)
		
		elif CURSOR['tile']['x'] <= 5:
			camera.set_pos(camera.X - 3, camera.Y)
		
		if CURSOR['tile']['y'] > constants.MAP_VIEW_HEIGHT - 5:
			camera.set_pos(camera.X, camera.Y + 3)
		
		elif CURSOR['tile']['y'] <= 5:
			camera.set_pos(camera.X, camera.Y - 3)	
Ejemplo n.º 9
0
def logic():
    if not ui_dialog.ACTIVE_DIALOG and not ui_menu.ACTIVE_MENU:
        if CURSOR['tile']['x'] > constants.MAP_VIEW_WIDTH - 5:
            camera.set_pos(camera.X + 3, camera.Y)

        elif CURSOR['tile']['x'] <= 5:
            camera.set_pos(camera.X - 3, camera.Y)

        if CURSOR['tile']['y'] > constants.MAP_VIEW_HEIGHT - 5:
            camera.set_pos(camera.X, camera.Y + 3)

        elif CURSOR['tile']['y'] <= 5:
            camera.set_pos(camera.X, camera.Y - 3)
Ejemplo n.º 10
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()