added falling sand - dirt actually

This commit is contained in:
2023-10-16 15:41:33 +02:00
parent 8a6004af24
commit fe40e33d36
6 changed files with 113 additions and 19 deletions

View File

@@ -3,7 +3,18 @@
namespace FOU.Scripts.Elements;
public class Dirt : Solid {
public Dirt() {
public Dirt(int x, int y, ref Level level) : base(x, y, ref level) {
Color = Colors.Brown;
}
public override bool Update(int currentFrame) {
if (!base.Update(currentFrame)) return false;
if (CheckBelow(X, Y)) {
_level.Swap(this, X, Y+1);
}
return true;
}
}