I'm trying to set the orange half blocks in image 2 as impassable terrain for the A* pathfinding and I know to use set_point_solid but I'm trying to call the layer with this function I found instead of noting each cell individually like the tutorial I found said to do.
What is the proper format of the code in the first image and what do i put in where it says (int layer)?
#AStarGrid2D setting a layer as an obstacle
7 messages · Page 1 of 1 (latest)
Godot 4 Tilemap is layered. Just put the layer of the tilemap you're using
Though if you're using AStarGrid2D where are you going to use that Tilemap method?
The layer is what I can't figure out how to reference. And I don't quite understand your question. The tile map is how I put down the tiles. Can I not use that with A*?
You can use multiple AStarGrid2Ds.
get_used_cells(0) will work if you use only 1 layer in your tile map.
However, this function only give you coordinates of the used cells, you will not be able to set the orange half block as impassable terrain with this function only
I was going to use that function in tandem with A*s set_point_solid if that's possible I just wasn't sure how to properly format the "call used coordinates of layer" function into it. But the green blocks are the base layer and meant to be the ground for now and the orange blocks are above meant to represent obstacles
The red block is my temporary enemy sprite I just haven't done much with it yet