Im Making a game that has map editing and I want to have NPC’s move only on the sidewalk. How do I get them to only be able to move forward and if they detect something other than a sidewalk they turn? Do I need to create a second TileMapLayer only for sidewalks?
When all the tiles except sidewalks have collision, the only tiles the npc can walk on is the sidewalk. Collisions with the non-sidewalk tiles will keep them on the sidewalk.
As for detecting collision and turning, you can raycast to find a clear path or randomly turn left/right after colliding during move_and_slide().