Assume I have 2 Sprites with size of 500x500. assume I create one of the sprites a parent of the other and place the other sprite in the position of 250,250, I will see the two sprites while the second sprite is over the size of its parent.
What I want to accomplish is to avoid that. I want that a parent node will clip the child sprites. so in my example, I should see only 250x250 of its original size.
Thanks . That is working. But the real reason I need it is to somehow control the size of the clipping node in real time. I am trying to implement a progress bar with animated solid fill and I wish to make the bar size changed. SetContentSize does not work on a sprite with an action so I tried using stencil.
Stencil does work but I can not change in real time.
If the progress bar is rectangular, try using a LayerColour instead of DrawNode. That way you can simply use setContentSize to change it’s size as needed (including in an Action). Otherwise, you’d have to keep clearing and redrawing the DrawNode.