This commit is contained in:
2023-12-02 20:10:19 +01:00
parent 7db4ba3c2a
commit 6308195224
2 changed files with 6 additions and 9 deletions

View File

@@ -47,15 +47,14 @@ public class Element {
protected virtual void Tick() {
Vector2I randomDirection = RandomDirectionDown();
if (Level.IsEmpty(Position + Vector2I.Down)) {
if (Level.IsEmpty(Position + Vector2I.Down))
Level.Swap(this, Position + Vector2I.Down);
} else if (Level.IsEmpty(Position + randomDirection)) {
else if (Level.IsEmpty(Position + randomDirection))
Level.Swap(this, Position + randomDirection);
} else if (Level.IsEmpty(Position + randomDirection * VERTICAL_OPPOSITE)) {
else if (Level.IsEmpty(Position + randomDirection * VERTICAL_OPPOSITE))
Level.Swap(this, Position + randomDirection * VERTICAL_OPPOSITE);
}
if (GD.Randi() % MAX_DIFFUSE_SPEED > DiffuseSpeed) return; // ascend slower

View File

@@ -23,15 +23,13 @@ public class Water : Solid {
if (randomDirection.Y != 0)
randomDirection *= Vector2I.Left * (int)(GD.Randi() % MAX_VERTICAL_SPREAD);
if (Level.IsEmpty(Position + Vector2I.Down)) {
if (Level.IsEmpty(Position + Vector2I.Down))
Level.Swap(this, Position + Vector2I.Down);
} else if (Level.IsEmpty(Position + randomDirection)) {
else if (Level.IsEmpty(Position + randomDirection))
Level.Swap(this, Position + Vector2I.Right * randomDirection);
} else if (Level.IsEmpty(Position + randomDirection)) {
else if (Level.IsEmpty(Position + randomDirection))
Level.Swap(this, Position + Vector2I.Right * randomDirection * VERTICAL_OPPOSITE);
}
}
}