Example #1
0
def focus_on_entity(entity, target_id, show_line=False, pause=False):
    global HAS_FOCUS, PAUSE

    if HAS_FOCUS or '--no-fx' in sys.argv:
        return

    HAS_FOCUS = target_id
    PAUSE = pause

    _entity = ui_dialog.create(18, 7, 'Enemy spotted!')

    entities.register_event(_entity, 'delete', lambda e: lose_focus())
    entities.trigger_event(DIRECTOR,
                           'create_timer',
                           time=120,
                           exit_callback=lambda e: ui_dialog.delete(_entity))

    if show_line:
        for x, y in shapes.line(movement.get_position(entity),
                                movement.get_position_via_id(target_id)):
            effects.vapor(x,
                          y,
                          group='effects_freetick',
                          start_alpha=1.0,
                          fade_rate=.01)
Example #2
0
def focus_on_entity(entity, target_id, show_line=False, pause=False):
	global HAS_FOCUS, PAUSE
	
	if HAS_FOCUS or '--no-fx' in sys.argv:
		return
	
	HAS_FOCUS = target_id
	PAUSE = pause
	
	_entity = ui_dialog.create(18, 7, 'Enemy spotted!')
	
	entities.register_event(_entity, 'delete', lambda e: lose_focus())
	entities.trigger_event(DIRECTOR, 'create_timer', time=120, exit_callback=lambda e: ui_dialog.delete(_entity))
	
	if show_line:
		for x, y in shapes.line(movement.get_position(entity), movement.get_position_via_id(target_id)):
			effects.vapor(x, y, group='effects_freetick', start_alpha=1.0, fade_rate=.01)
Example #3
0
def _bullet_effects(entity, x, y):
	_distance = numbers.distance((x, y), entity['start_position'])
	_target_distance = numbers.distance((x, y), entity['end_position']) + numbers.clip(10 - _distance, 0, 10) 
	_x, _y = movement.get_position(entity)
	_mod = (0.6 - (_distance / 35.0)) + random.uniform(-.1, .1)
	_alpha = numbers.clip(_mod, 0, 1)
	_crash_dist = 60 - (entity['speed'] * 2)
	
	if _alpha > 0:
		effects.vapor(x, y, start_alpha=_alpha)
	
	if _target_distance < 30:
		_size = int(round(2 * (1 - (1 * numbers.clip(numbers.clip(_target_distance, 0, 100)/60.0, 0, 1))))) + random.randint(1, 2)
		
		if _distance > _crash_dist:
			_size = int(round(_size * (_crash_dist/float(_distance))))
		
		if _size > 1:
			effects.light(_x, _y, _size, r=1.3, g=1.3, b=1.3)
Example #4
0
def _bullet_effects(entity, x, y):
    _distance = numbers.distance((x, y), entity['start_position'])
    _target_distance = numbers.distance(
        (x, y), entity['end_position']) + numbers.clip(10 - _distance, 0, 10)
    _x, _y = movement.get_position(entity)
    _mod = (0.6 - (_distance / 35.0)) + random.uniform(-.1, .1)
    _alpha = numbers.clip(_mod, 0, 1)
    _crash_dist = 60 - (entity['speed'] * 2)

    if _alpha > 0:
        effects.vapor(x, y, start_alpha=_alpha)

    if _target_distance < 30:
        _size = int(
            round(2 * (1 - (1 * numbers.clip(
                numbers.clip(_target_distance, 0, 100) / 60.0, 0, 1))))
        ) + random.randint(1, 2)

        if _distance > _crash_dist:
            _size = int(round(_size * (_crash_dist / float(_distance))))

        if _size > 1:
            effects.light(_x, _y, _size, r=1.3, g=1.3, b=1.3)