Sprite disappear with opacity

Hi everyone!

I want an sprite of my game to disappear gradually and I use opacity for that, but there is a problem:

for example there are the first sprite (a human) and its child (clothes) and when I change the human opacity (cascadeEnabled = true) - its clothes disappears too (as I need), but during the time of disappearing the user can see human body which is supposed to be hidden by the clothes.
What can you advise? I need all the sprites to disappear as if they were one texture. How could I do something like this?

I’m guessing here, but could you add both sprites as children to a Node, and set the opacity of the node?

No, it does not work, I think there must be somthing with clip graphic

why not use setVisible(false) as the last step of your fading?

The only solution I can think of is rendering both sprites to a RenderTexture and then replacing your sprites with that, and fading that.

Did I misunderstand what the OP wants? Doesn’t he want to change the opacity, and then have the Sprite be gone?

I believe what he wants is to fade out a person and its clothes, both being separate sprites, and they want the sprite to retain the same appearance while fading, besides the actual change in opacity. But when you fade 2 sprites - one on top of the other - the sprite underneath can be seen. A problem I have experienced before myself (although I can’t remember my solution.)

1 Like

That makes sense. Thanks for clarifying. Your idea about swapping sprites with render texture is interesting. So you would do this each frame?

If it was animated, I guess you would have to. I tried blending functions, but they seem to take the opacity into account rather than using the source image, unless there’s functions I haven’t thought of.