I use the following code block and when I debug I see that SKShapeNode's accumulated frame is now {{-160.03586, -42.431793}, {470.03586, 519.50903}}
instead of something like {{0,0}, {100,300}}
.
If I comment out this whole particle code, accumulatedFrame
is meaningful again.
I need it to be meaningful as I use nodesAtPoint
in touchesBegan
. Any nonsense value causes nodesAtPoint
to find irrelevant nodes too as accumulatedFrame is now weird for all and they all intersect...
I use the following code block and I couldn't find out the problem. What do I miss here?
NSString *path = [[NSBundle mainBundle] pathForResource:@"MyParticle" ofType:@"sks"];
SKEmitterNode *particles = [NSKeyedUnarchiver unarchiveObjectWithFile:path];
particles.position = CGPointMake(_selectedNode.frame.size.width/2, _selectedNode.frame.size.height/2);
[particles runAction:[SKAction sequence:@[[SKAction waitForDuration:.2],
[SKAction fadeAlphaTo:0 duration:0.2],
[SKAction removeFromParent]]] completion:^{
[particles removeFromParent];
}];
[_selectedNode addChild:particles];