7-9-25 3:44am

This commit is contained in:
2025-07-09 03:44:11 -04:00
parent 70fe41e07a
commit 00c0cfcff7
19 changed files with 268 additions and 36 deletions

View File

@@ -44,7 +44,8 @@ public partial class Marble : RigidBody2D
TrySelect();
TryAim();
TryLaunch();
TryMovement();
TryMovement(delta);
}
public void ProcessOnBump(Node2D body)
@@ -112,7 +113,7 @@ public partial class Marble : RigidBody2D
}
}
public void TryMovement()
public void TryMovement(double delta)
{
if (LinearVelocity.Length() > 0 && !Sleeping)
{
@@ -125,6 +126,18 @@ public partial class Marble : RigidBody2D
if (Moving)
{
ProcessOnMovement();
Vector2 Scroll = -LinearVelocity / 100;
Sprite2D sprite = (Sprite2D)GetNode("Sprite2D");
ShaderMaterial material = (ShaderMaterial)sprite.Material;
float CurrentScrollX = (float)material.GetShaderParameter("scroll_x");
material.SetShaderParameter("scroll_x", (CurrentScrollX + Scroll.X * (float)delta) % 1.0f);
float CurrentScrollY = (float)material.GetShaderParameter("scroll_y");
material.SetShaderParameter("scroll_y", (CurrentScrollY + Scroll.Y * (float)delta) % 1.0f);
if (Sleeping)
{
Moving = false;