#AStarGrid2D setting a layer as an obstacle

7 messages · Page 1 of 1 (latest)

split willow
#

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)?

visual sparrow
#

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?

split willow
drifting lantern
#

You can use multiple AStarGrid2Ds.

sterile radish
#

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

split willow
#

The red block is my temporary enemy sprite I just haven't done much with it yet