Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | PowerPotato |
Hi folks:
I have a code fragment where I need to connect and disconnect a signal with parameters.
After read Object — Godot Engine (latest) documentation in English I found that the preferred way to do this is using the next sintax:
player.Hit.Connect(OnPlayerHit, new Godot.Collections.Array {"sword", 100 });
My code look like this:
private void HealthCharacter(Node body)
{
if (body is Character)
{
Character character = body as Character;
character.IsInvulnerable = true;
// if (Timer.IsConnected())
// {
Timer.Timeout.Connect(OnDoHealth, new Godot.Collections.Array { character });
// }
Timer.Start();
}
}
But this do not compile throwing the next error:
Health.cs(38,19): El evento 'Timer.Timeout' solo puede aparecer a la izquierda de += o -=.
This translate to:
The 'Timer.Timeout' event can only appear to the left of += or -=.
So I really don’t know how could I connect and disconnect signals with parameters on the new Godot