allowed more rain!

This commit is contained in:
2024-03-23 19:03:49 +01:00
parent d44412c666
commit 5d07477de5
3 changed files with 8 additions and 4 deletions

View File

@@ -1,3 +1,4 @@
using System.Reflection;
using Godot; using Godot;
public partial class SettingsController : VBoxContainer public partial class SettingsController : VBoxContainer

View File

@@ -8,7 +8,7 @@
script = ExtResource("1_k1i8e") script = ExtResource("1_k1i8e")
BrushSize = 1 BrushSize = 1
TextureResolution = 0.25 TextureResolution = 0.25
RainAmount = 0.0 RainAmount = 5.0
[node name="CanvasLayer" type="CanvasLayer" parent="."] [node name="CanvasLayer" type="CanvasLayer" parent="."]
@@ -75,6 +75,6 @@ custom_minimum_size = Vector2(150, 0)
layout_mode = 2 layout_mode = 2
size_flags_horizontal = 8 size_flags_horizontal = 8
size_flags_vertical = 1 size_flags_vertical = 1
max_value = 1.0 max_value = 5.0
step = 0.01 step = 0.01
value = 1.0 value = 1.0

View File

@@ -45,7 +45,10 @@ public class Level {
} }
private void MakeItRain(float rainAmount) { private void MakeItRain(float rainAmount) {
if (GD.Randf() < rainAmount) { int rainDrops = (int)Math.Round(rainAmount);
for (int i = 0; i <= rainDrops; i++) {
if (GD.Randf() < rainAmount)
WritePixel<Water>((int)(GD.Randi() % SizeX), 0, 1); WritePixel<Water>((int)(GD.Randi() % SizeX), 0, 1);
} }
} }