added second element type: snow
added simple snow weather
This commit is contained in:
23
Scripts/Elements/Snow.cs
Normal file
23
Scripts/Elements/Snow.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using Godot;
|
||||
|
||||
namespace FOU.Scripts.Elements;
|
||||
|
||||
public class Snow : Solid {
|
||||
public Snow(int x, int y, ref Level level) : base(x, y, ref level) {
|
||||
Color = Colors.White;
|
||||
Color = AddColorVariance(Color);
|
||||
}
|
||||
|
||||
public override bool Update(int currentFrame) {
|
||||
if (!base.Update(currentFrame)) return false;
|
||||
|
||||
Vector2I freePos = Check(this, Vector2I.Down);
|
||||
|
||||
if (freePos != Vector2I.Zero) { // diagonally right
|
||||
Level.Swap(this, freePos);
|
||||
return true;
|
||||
}
|
||||
|
||||
return true; // not necessarily end, subclasses could do some more things
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user