SKCropNode precision problems

47 Views Asked by At

I am developing a game in which I require several images to be overlaid in order to allow the player to choose the colour of their plane. I do this using the following code:

SKCropNode *cropper = [SKCropNode node];

SKSpriteNode *mask = [SKSpriteNode spriteNodeWithImageNamed:planeImageName];

SKTexture *texture = [SKTexture textureWithImageNamed:@"Camo"];

SKSpriteNode *paint = [SKSpriteNode spriteNodeWithTexture:texture];

SKSpriteNode *outline = [SKSpriteNode spriteNodeWithImageNamed:planeOutlineImageName];
outline.size = CGSizeMake(mask.size.width, mask.size.height);


LRHeroPlane *hero = [LRHeroPlane spriteNodeWithColor:[UIColor clearColor] size:CGSizeMake(5, 5)];

[hero addChild:cropper];
[cropper addChild:paint];
[cropper setMaskNode:mask];
[hero addChild:outline];

Where planeOutlineImageName and planeImageName are strings which can be used to find the images in my asset catalogue, and hero is the root node. When I add this to my scene, however, the camouflage paint goes beyond the borders of the outline, leaving the full plane looking messy and unprofessional. Below are the images used: (The actual images are .pdf but I converted them to .png to include them in this post)

Picture with name <code>planeImageName</code> Camo paint Picture with name <code>planeOutlineImageName</code> resulting plane

Does anybody know why this is happening? Any help is much appreciated.

0

There are 0 best solutions below