Hide behind the wall


I’m having a hard time trying to figuring out a way to have an hero hide from an enemy view range behind a wall. As you can see bellow, the view range is above the hero, but the enemy should not be able to see him because he is behind a wall.

I can create the view range, no problem, but how can I make the view range not “see” the hero behind the wall?

Does anyone have an insight, tip or idea of how this can be done?


Maybe it is not the best way to do it but what I normally do is constantly shoot objects (like bullets) from the position of the enemy toward the position of the player similar to raycast but since raycast is not available in GDevelop, this is what I do instead. So, if one of these objects is in collision with the player that means the player is visible to the enemy and in case the object is in collision with a wall or out of range, I delete the object and this way the player can not be seen by the enemy if it too far or it is behind a wall.

Yes, I try that. I did not find it to be the best method either.

I was trying to find an more easy/simple way to do it, but so far with no success.

I guess you can do that whit the light and light collider behaivor.