Rubikant, here is what I would do in your case!
a. First, I would determine the visibility box of the shotgun blast. To do this, I need these information:
- Position of the character
- Distance between character and the wall
- The image (spritesheet-right?) dimensions.
b. Based on this, I would calculate how much of the shotgun blast is going to be needed to drawn. Or, if we are going to be fancy, it would determine how much *distance* will the shotgun blast have "available" to it.
So from this point forward, you can do two things with it:
- Shorten the hitbox of your attack
- Shorten the displayed effect (OR scale the effect to be visible on a distance less than initially planned).
If you go for a rough solution, you can say that if you shoot, and you can determine that there is an obstacle within your target and your hitbox, then you will miss/deal no damage. If you go for an elegant solution, you incorporate hitboxes with every single bullet check, and make the hitbox suspectible to such obstacles.*
*Or alternatively, do not even calculate it based on bullets+obstacles, but simply have a "line of sight" check only being updated when you or your enemies move
I hope this mess helps you in any way
(Edit: Jobbs's idea is great as well! If you simply spawn some smoke at your gun and spawn a bunch of bullets, then it will be up to your collision engine to let the bullets only travel towards the wall and end their journey there.)