Added counter script to count ducks (and other things)

This commit is contained in:
2025-07-10 23:58:33 +02:00
parent 480d149ede
commit c7d56301fc
6 changed files with 72 additions and 4 deletions
+3 -1
View File
@@ -13,6 +13,7 @@ public partial class MVPDuck : Node2D
[Export] private AnimationPlayer _animationPlayer;
[Export] private string _flapAnimationName = "flapFlap";
[Signal] public delegate void DuckCollectedEventHandler();
public void TransferToTargetAfterDelay()
{
@@ -29,7 +30,8 @@ public partial class MVPDuck : Node2D
public async void MoveAfterDelay()
{
await ToSignal(GetTree().CreateTimer(1.0f), "timeout"); // 1.0f seconds
Position = _penTarget.GlobalPosition; // Now this works!
Position = _penTarget.GlobalPosition;
EmitSignal(SignalName.DuckCollected);
}