title: applying masks to SKEmitterNodes
body: <p>May be some one can give me a hand… I’m trying to add a couple of SKEmitterNodes in their own SKCropNodes.</p>
  
  <p>My code:</p>
  
  <pre><code>    // left emitter node
      NSString *path = [[NSBundle mainBundle] pathForResource:@"LeftParticle" ofType:@"sks"];
      SKEmitterNode *lEmitterNode = [NSKeyedUnarchiver unarchiveObjectWithFile:path];
  
      // left crop node
      SKSpriteNode *lMask = [SKSpriteNode spriteNodeWithColor:[UIColor blackColor] size:CGSizeMake(self.size.width/2, self.size.height)];
      [lMask setAnchorPoint:CGPointZero];
      SKCropNode *lCropNode = [SKCropNode node];
      lCropNode.maskNode = lMask;
  
      // move the left emitter under the mask
      lEmitterNode.position = CGPointMake(CGRectGetMinX(lMask.frame) + lMask.size.width / 2, self.size.height);
  
      [lCropNode addChild:lEmitterNode];
      [self addChild:lCropNode];
  
  
  
      // right emitter node
      path = [[NSBundle mainBundle] pathForResource:@"RightParticle" ofType:@"sks"];
      SKEmitterNode *rEmitterNode = [NSKeyedUnarchiver unarchiveObjectWithFile:path];
  
      // right crop node
      SKSpriteNode *rMask = [SKSpriteNode spriteNodeWithColor:[UIColor greenColor] size:CGSizeMake(self.size.width/2, self.size.height)];
      [rMask setAnchorPoint:CGPointZero];
      rMask.position = CGPointMake(rMask.size.width, 0);
      SKCropNode *rCropNode = [SKCropNode node];
      rCropNode.maskNode = rMask;
  
      // move the right emitter under the mask
      rEmitterNode.position = CGPointMake(CGRectGetMinX(rMask.frame) + rMask.size.width / 2, self.size.height);
  
      [rCropNode addChild:rEmitterNode];
      [self addChild:rCropNode];
  </code></pre>
  
  <p>And this is the result:</p>
  
  <p><img src="https://i.stack.imgur.com/Edk08.png" alt="enter image description here"></p>
  
  <p>As you can see, my red particles render under the left mask... Why?</p>
  
  <p>I’ve tried to reduce the size of mask with:</p>
  
  <pre><code>    lMask.xScale = lMask.yScale = 0.9;
      rMask.xScale = rMask.yScale = 0.9;
  </code></pre>
  
  <p>And this is the result:</p>
  
  <p><img src="https://i.stack.imgur.com/amWLN.png" alt="enter image description here"></p>
  
  <p>I presume it’s a problem with render buffer, or may be it’s something about zPosition, or a bug, or may be I’m really lost. </p>
  
  <p>Thnx</p>