I have a tiled environment in my game. Now I want to show shadows of the characters in the level, but the shadow should only be visible on the underground, not on the background. This would be easy if I had only straight environments, but I have multiple slopes with varying inclination.
I somehow need to mask the shadow sprite with the underground tiles.
So far I have a possible solution for this problem, which doesn’t seem statisfying to me.
I could generate the shadows for each frame on a separate texture and overlay the shadow texture on top of my environment. The problem is that i already have several thousand tiles and I would need to redraw them just for the shadows.