added density
code improvements
This commit is contained in:
@@ -4,8 +4,8 @@ namespace FOU.Scripts.Elements;
|
||||
|
||||
public class Water : Solid {
|
||||
public Water(int x, int y, ref Level level) : base(x, y, ref level) {
|
||||
Color = Colors.Blue;
|
||||
Color = AddColorVariance(Color);
|
||||
Color = AddColorVariance(Colors.Blue);
|
||||
Density = 1;
|
||||
}
|
||||
|
||||
public override bool Update(int currentFrame) {
|
||||
@@ -17,9 +17,8 @@ public class Water : Solid {
|
||||
}
|
||||
|
||||
protected override void Tick() {
|
||||
int randomDirection = 1;
|
||||
if (GD.Randi() % 2 != 0)
|
||||
randomDirection *= -1;
|
||||
int randomDirection = GD.Randi() % 2 != 0 ? 1 : -1;
|
||||
randomDirection *= GD.Randi() % 2 != 0 ? 1 : 2;
|
||||
|
||||
if (Level.IsEmpty(Position + Vector2I.Down)) {
|
||||
Level.Swap(this, Position + Vector2I.Down);
|
||||
@@ -31,5 +30,8 @@ public class Water : Solid {
|
||||
Level.Swap(this, Position + Vector2I.Right*randomDirection);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user