I'm experimenting a bit with Sprite Kit. I'm trying to mask an image with an alpha png. This is easy enough but I can't find information on how to mask an image with alpha values. Right now it renders the pixel or it doesn't.
From the docs on SKCropNode it says: If the pixel in the mask has an alpha value of less than 0.05, the image pixel is masked out.
So this is a logical outcome from the way I'm doing this right now:
CGPoint location = CGPointMake(CGRectGetMidX(self.frame), CGRectGetMidY(self.frame));
SKCropNode *cropNode = [SKCropNode node];
SKSpriteNode *sprite = [SKSpriteNode spriteNodeWithImageNamed:@"Spaceship"];
SKSpriteNode *maskImage = [SKSpriteNode spriteNodeWithImageNamed:@"mask5.png"];
[maskImage setName:@"mask"];
[cropNode setMaskNode:maskImage];
[cropNode addChild:sprite];
[cropNode setPosition:location];
[self addChild:cropNode];
The result is that the edges are jagged. Is there a way to mask the image in such way the edges are smooth?
Thanks!