experimental water

This commit is contained in:
Lilith Schier 2026-08-28 16:44:15 +02:00
parent a563a3967f
commit 9eb3951361
12 changed files with 231 additions and 32 deletions

View file

@ -3,7 +3,7 @@ namespace Dancer;
[Meta(typeof(IAutoNode))]
public sealed partial class Rain : Sprite2D
{
[Export] private float Speed { get; set; } = 10;
[Export] private Vector2 Movement { get; set; } = new(0, 10);
public override void _Notification(int what) => this.Notify(what);
@ -14,12 +14,11 @@ public sealed partial class Rain : Sprite2D
public void OnProcess(double delta)
{
Position += new Vector2(0, Speed * (float)delta);
var textureHeight = Texture.GetHeight();
if (Position.Y > textureHeight)
{
Position -= new Vector2(0, textureHeight);
}
var position = Position;
position += Movement * (float)delta;
var textureSize = Texture.GetSize();
position = position.PosMod(textureSize);
Position = position;
}
}