using Godot; namespace FOU.Scripts.Elements; public class Element { public Color Color = Colors.Black; public int X; public int Y; protected Level _level; private int _lastUpdate = -1; public Element(int x, int y, ref Level level) { X = x; Y = y; _level = level; } /// /// base update method, checks if anything is to do at all /// /// /// false if there is nothing to do public virtual bool Update(int currentFrame) { if (_lastUpdate == currentFrame) return false; // already updated this frame _lastUpdate = currentFrame; return true; } public override string ToString() { return $"{X}:{Y}"; } protected bool CheckBelow(int x, int y) { if (y+1 >= _level.SizeY) return false; if (_level.Get(x, y+1).GetType() == GetType()) return false; return true; } }