diff --git a/Scenes/main.tscn b/Scenes/main.tscn
index b1e603c..59b5472 100644
--- a/Scenes/main.tscn
+++ b/Scenes/main.tscn
@@ -6,8 +6,9 @@
[node name="Main" type="Node2D"]
script = ExtResource("1_k1i8e")
-BrushSize = 0
-TextureResolution = 0.25
+DebugVisualization = true
+BrushSize = 2
+TextureResolution = 0.35
RainAmount = 5.0
[node name="CanvasLayer" type="CanvasLayer" parent="."]
diff --git a/Scripts/Chunk.cs b/Scripts/Chunk.cs
index b9207b9..26b62a2 100644
--- a/Scripts/Chunk.cs
+++ b/Scripts/Chunk.cs
@@ -15,7 +15,6 @@ public class Chunk {
private readonly Image image;
private readonly int sizeX;
private readonly int sizeY;
- private int frame;
public Chunk(int x, int y, int index) {
Index = index;
@@ -37,10 +36,9 @@ public class Chunk {
for (int x = 0; x < sizeX; x++) {
for (int y = 0; y < sizeY; y++) {
if (Elements[x,y] != null)
- Elements[x,y].Update(frame);
+ Elements[x,y].Update();
}
}
- frame++;
// TODO: enable rain again
// MakeItRain(_main.RainAmount);
}
@@ -127,7 +125,5 @@ public class Chunk {
what.Active = true;
swapTo.Active = true;
- what.LastMove = frame;
- swapTo.LastMove = frame;
}
}
diff --git a/Scripts/Elements/Element.cs b/Scripts/Elements/Element.cs
index 405ec86..3b9185e 100644
--- a/Scripts/Elements/Element.cs
+++ b/Scripts/Elements/Element.cs
@@ -13,7 +13,7 @@ public class Element {
public int DiffuseSpeed = 10;
public const int MAX_DIFFUSE_SPEED = 100;
- public const int STEPS_UNTIL_INACTIVE = 100;
+ public const int STEPS_UNTIL_INACTIVE = 500;
protected const float MAX_COLOR_VARIANCE = 0.1f;
protected static readonly Vector2I VERTICAL_OPPOSITE = new Vector2I(-1, 1);
@@ -24,12 +24,14 @@ public class Element {
public Element(Element e) {
Position = e.Position;
Chunk = e.Chunk;
+ LastMove = Engine.GetFramesDrawn();
}
public Element(int x, int y, Chunk chunk) {
Position.X = x;
Position.Y = y;
Chunk = chunk;
+ LastMove = Engine.GetFramesDrawn();
}
public bool Active {
@@ -49,11 +51,11 @@ public class Element {
///
///
/// false if there is nothing to do
- public virtual bool Update(int currentFrame) {
+ public virtual bool Update() {
if (!Active) return false;
- if (LastUpdate == currentFrame) return false; // already updated this frame
- LastUpdate = currentFrame;
+ if (LastUpdate == Engine.GetFramesDrawn()) return false; // already updated this frame
+ LastUpdate = Engine.GetFramesDrawn();
return true;
}
diff --git a/Scripts/Elements/Liquid.cs b/Scripts/Elements/Liquid.cs
index ea2d7a7..1d40ae6 100644
--- a/Scripts/Elements/Liquid.cs
+++ b/Scripts/Elements/Liquid.cs
@@ -7,9 +7,9 @@ public abstract class Liquid : Element {
protected Liquid(int x, int y, ref Chunk chunk) : base(x, y, chunk) { }
- public override bool Update(int currentFrame) {
- if (!base.Update(currentFrame)) return false;
- if (LastMove + STEPS_UNTIL_INACTIVE < currentFrame) Active = false;
+ public override bool Update() {
+ if (!base.Update()) return false;
+ if (LastMove + STEPS_UNTIL_INACTIVE < Engine.GetFramesDrawn()) Active = false;
Tick();
diff --git a/Scripts/Elements/Solid.cs b/Scripts/Elements/Solid.cs
index 55b8107..0257ed4 100644
--- a/Scripts/Elements/Solid.cs
+++ b/Scripts/Elements/Solid.cs
@@ -5,9 +5,9 @@ namespace FOU.Scripts.Elements;
public abstract class Solid : Element {
protected Solid(int x, int y, ref Chunk chunk) : base(x, y, chunk) { }
- public override bool Update(int currentFrame) {
- if (!base.Update(currentFrame)) return false;
- if (LastMove + STEPS_UNTIL_INACTIVE < currentFrame) Active = false;
+ public override bool Update() {
+ if (!base.Update()) return false;
+ if (LastMove + STEPS_UNTIL_INACTIVE < Engine.GetFramesDrawn()) Active = false;
Tick();