If you have multiple sprites for dunes, add them all to a family Dunes, and then in my code example replace "Hill" with "Dunes".
What my code does - when a tank is hit, it checks if there is any hill/dune sprite in this point. And if this hill is on a layer higher than tank, or on the same layer with tank, but above the tank on z-axis, then the hit is cancelled. (because the tank is hidden by the hill)