Hello. tell me how to make vision for an NPC with obstacles.
Example in the picture.
Now the left NPC sees the right one, but the right one is behind the wall, that is, the left one should not see the right one.
For vision, I do this: there is a viewArea sprite (in the image it is red), I check the viewArea collision with the NPC sprite, if true, then the NPC sees another NPC, but how to beat if there is a wall between them?