added color variance

This commit is contained in:
2023-10-17 14:33:21 +02:00
parent 31dbbbf070
commit 43d121d4da
4 changed files with 18 additions and 14 deletions

View File

@@ -6,6 +6,9 @@ public class Dirt : Solid {
public Dirt(int x, int y, ref Level level) : base(x, y, ref level) {
Color = Colors.Brown;
Color.R += (GD.Randf() - 1) * MaxColorVariance;
Color.G += (GD.Randf() - 1) * MaxColorVariance;
Color.B += (GD.Randf() - 1) * MaxColorVariance;
}
public override bool Update(int currentFrame) {
@@ -14,7 +17,7 @@ public class Dirt : Solid {
Vector2I freePos = Check(this, Vector2I.Down + Vector2I.Right);
if (freePos != Vector2I.Zero) { // diagonally right
_level.Swap(this, freePos);
Level.Swap(this, freePos);
return true;
}