You might not have heard of this before.
I have 3 sprite layers if you will (not layers, but 3 sprites with different z values). Anyways, we will call them (tree, cloud, sun). Now tree is always to be in the background. The cloud, will travel horizontally across the screen in front of tree, with it's child the sun, completely hidden behind it.
Now the cloud needs to have transparency, because the tree needs to be seen through the cloud. However, the sun needs to remain hidden behind the cloud, despite this.
Is there any way to do this?