add: Selectable Tile Map Layer/Mouse Controlled Camera

This commit is contained in:
h z
2025-02-26 20:17:37 +00:00
parent 92770d3425
commit 8df4ebb6d5
6 changed files with 145 additions and 8 deletions

View File

@@ -0,0 +1,12 @@
using Godot;
namespace Polonium.Extensions;
public static class LinqExtensions
{
public static T RandomSelect<T>(this IEnumerable<T> source)
{
T[] s = source.ToArray();
return s[GD.Randi() % s.Length];
}
}

View File

@@ -33,8 +33,13 @@ public static class Utils
{
if (!fname.EndsWith(".png"))
continue;
AnimatedTextureCache[path].SetFrameTexture(f, ResourceLoader.Load<Texture2D>(fname));
AnimatedTextureCache[path].SetFrameTexture(f, ResourceLoader.Load<Texture2D>($"{path}/{fname}"));
f += 1;
}
AnimatedTextureCache[path].SetFrames(f + 1);
AnimatedTextureCache[path].SetOneShot(false);
AnimatedTextureCache[path].SetSpeedScale(4);
}
return AnimatedTextureCache[path];
@@ -44,6 +49,7 @@ public static class Utils
return null;
}
}
}
#pragma warning restore CS0618
#pragma warning restore CS0168