Currently in my game, the player is able to shoot an orb somewhere and where it lands, it spawns a sprite in with some scripts. I am able to use the Tile Maps Z index property to make it goes behind walls, but right now if the player shoots it at a wall that's on the edge of the map, it goes outside.
Here is what I mean,
Example A:

Player shoots a projectile, it hits the wall and goes behind it when needed.
Example B:

Player shoots projectile at edge wall, you can see it go out of the boundaries a bit, which is want I don't want.
I'm using Godot 3, can anyone help me find a solution for this?