Search code examples
iphoneobjective-cios6cocos2d-iphone

how to visible the portion sprite


I want to visible portion of sprite while on touching screen.

when i touch on the spriteModelHair touch location should be visibel and rest of the part of the sprite should be not visible.] spriteModelHair = [CCSprite spriteWithFile:@"hair001.png" rect:CGRectMake(0, 0, 450, 612)]; spriteModelHair.position = ccp(winSize.width/2, winSize.height/2+25); spriteModelHair.visibel = No; [self addChild:spriteModelHair z:2];


Solution

  • Get the RGBA data of each pixel and each pixel's position on the screen. If the location of your touch is the same as one of the pixel's locations (or in a predefined area around the touch) change that pixel's alpha to 0 or something.