예제 #1
0
파일: effects.py 프로젝트: penny64/r3-tdw
def _muzzle_flash_move(entity):
	_direction = movement.get_direction(entity)
	_nx, _ny = numbers.velocity(_direction, 1)
	
	movement.push(entity, _nx, _ny, time=3)
예제 #2
0
파일: effects.py 프로젝트: penny64/r3-tdw
def fire(x, y, amount):
	_blood = _create(x, y)
	_x, _y = (int(round(x)), int(round(y)))
	
	flags.register(_blood)
	timers.register(_blood)
	
	entities.trigger_event(_blood, 'set_flag', flag='alpha', value=amount)
	entities.trigger_event(_blood, 'set_flag', flag='alpha_max', value=amount)
	entities.trigger_event(_blood, 'set_char', char=' ')

	_color = list(display.get_color_at('tiles', _x, _y))
	_color[0] = numbers.interp_velocity(_color[0], random.choice([constants.FIRE_1, constants.FIRE_2, constants.FIRE_3]), amount)
	_color[1] = numbers.interp_velocity(_color[1], random.choice([constants.FIRE_1, constants.FIRE_2, constants.FIRE_3]), amount)
	
	for c in range(len(_color)):
		for i in range(len(_color)):
			_color[c][i] = int((round(_color[c][i])))
	
	#display._set_char('tiles', _x, _y, random.choice([',', '.', '^']), _color[0], _color[1])
	entities.register_event(_blood, 'tick', _tick_fire)
	entities.register_event(_blood, 'position_changed', lambda e, x, y, **kwargs: char(x, y, flags.get_flag(e, 'alpha')))
	entities.trigger_event(_blood, 'create_timer', time=120, repeat=-1, repeat_callback=lambda e: movement.push(e,
	                                                                                                            random.randint(-1, 1),
	                                                                                                            random.randint(-1, 1),
	                                                                                                            time=1))
	entities.trigger_event(_blood, 'set_fore_color', color=_color[0])
	entities.trigger_event(_blood, 'set_back_color', color=_color[1])
	entities.trigger_event(_blood, 'set_position', x=_x, y=_y)
	
	#light(_x, _y, random.randint(5, 7), r=1.5, g=.1, b=.1)

	return _blood