The Child SKSpriteKITnodes in the coordinate system doesn't work well I am trying to move the SKSprite nodes from Top To Bottom But they Get stop in the middle ?
ColorCoin *coin = [[ColorCoin alloc] initWithImageNamed: coinName] ;
SKAction *move = [SKAction moveToY:0 duration: 10];
CGFloat screenWidth = [self dropNode].size.width;
int x = arc4random() % (int) _dropNode.calculateAccumulatedFrame.size.width;
coin.zPosition =0.0;
coin.position = CGPointMake( x, _dropNode.calculateAccumulatedFrame.size.height-30);
coin.name = coinName;
[coin runAction: move];
[[self dropNode] addChild:coin];
The
anchorPoint
of anSKSpriteNode
is(0.5, 0.5)
by default. Therefore, when[self dropNode].position.y == 0
it's correct the the child node will be in the middle of its parentSKSpriteNode
.If you want the coin to move to the bottom of
dropNode
you can either set theanchorPoint
ofdropNode
to(x, 0)
(wherex
is any value in the range 0-1). Or you can changemove
to: