From e653f23a42a49fc6d295c06e80f6a43997ea4c1e Mon Sep 17 00:00:00 2001 From: rogo Date: Thu, 1 May 2025 23:01:42 +0200 Subject: [PATCH] dirt shall only move downwards --- Scenes/SettingsController.cs | 2 -- Scripts/Elements/Element.cs | 8 ++++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/Scenes/SettingsController.cs b/Scenes/SettingsController.cs index c195317..fe603ca 100644 --- a/Scenes/SettingsController.cs +++ b/Scenes/SettingsController.cs @@ -1,5 +1,3 @@ -using System.Reflection; -using FOU.Scripts; using Godot; public partial class SettingsController : VBoxContainer diff --git a/Scripts/Elements/Element.cs b/Scripts/Elements/Element.cs index 92fea11..bb09478 100644 --- a/Scripts/Elements/Element.cs +++ b/Scripts/Elements/Element.cs @@ -82,11 +82,11 @@ public class Element{ if (Chunk.IsEmpty(Position + Vector2I.Down)) Chunk.Swap(this, Position + Vector2I.Down); - else if (Chunk.IsEmpty(Position + randomDirection)) - Chunk.Swap(this, Position + randomDirection); + else if (Chunk.IsEmpty(Position + Vector2I.Down + randomDirection)) + Chunk.Swap(this, Position + Vector2I.Down + randomDirection); - else if (Chunk.IsEmpty(Position + randomDirection * VERTICAL_OPPOSITE)) - Chunk.Swap(this, Position + randomDirection * VERTICAL_OPPOSITE); + else if (Chunk.IsEmpty(Position + Vector2I.Down + randomDirection * VERTICAL_OPPOSITE)) + Chunk.Swap(this, Position + Vector2I.Down + randomDirection * VERTICAL_OPPOSITE); // density check if (Chunk.Get(Position + Vector2I.Down)?.Density < Density)