I have a couple of enemies with a shoot signal that I want to connect to a level scene
in the enemy scene:
signal shoot(pos, direction)
func trigger_attack():
shoot.emit(position, Vector2.RIGHT)
(trigger attack will be called via the AnimationPlayer)
but now I am confused how to connect this signal to the parent. From what I have read so far I think I need to create a callable:
func _ready():
for enemy in $Enemies.get_children():
var callable = Callable(self, "create_bullet").bind("arg1", "arg2")
enemy.connect("shoot", callable)
func create_bullet(arg1, arg2):
print(arg1)
print(arg2)
This does call a signal but always has the same arguments (arg1 and arg2) but I want to attach the signal only once and then call it with different arguments. How can I do that? Or am I getting something wrong?