MVP duck setup

This commit is contained in:
2025-07-09 22:40:03 +02:00
parent 2429958741
commit 8c18688a69
11 changed files with 420 additions and 384 deletions
@@ -0,0 +1 @@
uid://dnipeibppjirs
+36
View File
@@ -0,0 +1,36 @@
using System.Threading.Tasks;
using Godot;
namespace Babushka.scripts.CSharp.Common.Temp;
/// <summary>
/// Temporary Duck behaviour to make sure we can use them in the first showcase
/// </summary>
public partial class MVPDuck : Node2D
{
[Export] private Node2D _penTarget;
[Export] private int _transferDelayMs;
[Export] private AnimationPlayer _animationPlayer;
[Export] private string _flapAnimationName = "flapFlap";
public void TransferToTargetAfterDelay()
{
MoveAfterDelay();
PlayAnimation();
}
private void PlayAnimation()
{
_animationPlayer.CurrentAnimation = _flapAnimationName;
_animationPlayer.Play();
}
public async void MoveAfterDelay()
{
await ToSignal(GetTree().CreateTimer(1.0f), "timeout"); // 1.0f seconds
Position = _penTarget.GlobalPosition; // Now this works!
}
}
@@ -0,0 +1 @@
uid://7m1rt7agb6rm