Hello all.
I've been trying to put together a very small isometric scene inspired from old-school RPGS for the past 2 weeks.
So far, I've been able to implement a very basic A* pathfinding and a circle around the player that serves as a field of view for the player.
However, I'd like to have a field of view that could be blocked by walls and obstacles, where only the "clear" tiles could be seen, a bit like this :

I could find two implementations of that in Gdscript.
The first one : [https://github.com/Zireael07/Veins-of-the-Earth-Godot/blob/master/FOV_gen.gd] asks for a 2d array of int as source for the calculations.
I could find some resources about creating a 2d array, but is there a way to create one and automatically feed it all the values inside get_used_cells()
?
The second script : [https://github.com/matt-kimball/godot-mrpas] has simpler functions, but they all ask for Vector2 variables to function properly.
Here is a function of the script, that asks for a Vector for a position.
func set_transparent(position : Vector2, transparent: bool) -> void:
if _in_bounds(position):
_transparent_cells[position.y][position.x] = transparent
And I get almost the same problem with get_used_cells
with effectively contains Vector2 for each of the tiles but is an array. I tried creating a small function that iterates through it and returns every value, but it doesn't work.
TLDR :
1) Is there a way to create a 2d array with all the values inside get_used_cells()
that wouldn't require one hour of manual input?
2)How to properly give a function a Vector2 variable contained inside get_used_cells()
, instead of the actual array?
Sorry for the lenghty post.