How to get the CocosSharp CCClippingNode to hide its child in Android

tisquiptisquip BWMember

Hie. I'm new to cocosharp and i am trying to get the same effect as was posted here. Basically I need a segment of a hidden sprite to be revealed at a position where a user touches, the end result is that based on where the users finger is touching the segment of the hidden sprite at that position is revealed. I found this answer understandable and so tried rewriting it in cocossharp, however unless i have written the code wrong, then the CCClippingNode may not be functioning in Android as well because its not hiding its child. I understand already that the CCClipingNode may still not be working for iOS but I never came across any posts of anyone who had issues on Android. Could someone please assist me, I dont understand the CCRenderTexture solution that was also proposed. My code is below, have I done something wrong ? Please assist

protected override void AddedToScene()
{
        base.AddedToScene();

        drawNodeMain = new CCDrawNode();
        clippingNodeMain = new CCClippingNode(drawNodeMain);
        AddChild(clippingNodeMain);
        clippingNodeMain.AlphaThreshold = 0.0f;

     spriteFamilyPhoto = new CCSprite("familyphoto");
        clippingNodeMain.AddChild(spriteFamilyPhoto);

        var size = spriteFamilyPhoto.BoundingBox.Size;
        clippingNodeMain.ContentSize = size;
        spriteFamilyPhoto.Position = new CCPoint(size.Width / 2, size.Height / 2);

        // Register for touch events
        var touchListener = new CCEventListenerTouchOneByOne();
        touchListener.OnTouchBegan = OnTouchBegan;
        AddEventListener(touchListener, this);
}

private bool OnTouchBegan(CCTouch touch, CCEvent touchEvent)
{
     var p = touch.Location;
        drawNodeMain.DrawSolidCircle(p, 20, new CCColor4F(1, 1, 1, 1));

        return true;
}
Sign In or Register to comment.