From 84f1d487666efe08cfe95647978e41c592f58742 Mon Sep 17 00:00:00 2001 From: vaporvee Date: Tue, 15 Nov 2022 17:54:20 +0100 Subject: [PATCH] Made an location Vector2 array for all tiles of an specific ID --- src/TilemapForeground.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/TilemapForeground.cs b/src/TilemapForeground.cs index 1cab738..1b44f94 100644 --- a/src/TilemapForeground.cs +++ b/src/TilemapForeground.cs @@ -1,5 +1,6 @@ using Godot; using System; +using System.Linq; public class TilemapForeground : TileMap { @@ -20,10 +21,10 @@ public class TilemapForeground : TileMap public void ReplaceStaticTiles(int CellID) { - Godot.Collections.Array allcells = GetUsedCellsById(CellID); //why isnt it just a normal array wtf - for(int i = 0; i < allcells.Count; i++) + Vector2[] allcells = GetUsedCellsById(CellID).OfType().ToArray(); + for(int i = 0; i < allcells.Length; i++) { - GD.Print(allcells[i]); //needs a bit more stuff + GD.Print(allcells[i]); //now you can get the coordination to spawn a replacement node and get x and y seperately for removing this tile } } }