Sprite kit SKSpritenode、父节点和子节点关系

Sprite kit SKSpritenode、父节点和子节点关系,sprite-kit,skspritenode,Sprite Kit,Skspritenode,我正在尝试创建一个父和子精灵节点,并将纹理/动画和xScale添加到子精灵节点,将“physicsBody”添加到父精灵节点(父精灵作为包装,仅适用于物理主体?) 目前我只有SKSpritenode*arrowParentNode这会导致以下错误: "Attempted to add nil node to parent". 下面是代码。如果纹理和动画在孩子身上,我不知道家长会做什么? 我不确定我是否做得对,有人能解释一下吗 我也尝试了\u arrowParentNode=[self arro

我正在尝试创建一个父和子精灵节点,并将纹理/动画和xScale添加到子精灵节点,将“physicsBody”添加到父精灵节点(父精灵作为包装,仅适用于物理主体?)

目前我只有
SKSpritenode*arrowParentNode这会导致以下错误:

"Attempted to add nil node to parent".
下面是代码。如果纹理和动画在孩子身上,我不知道家长会做什么? 我不确定我是否做得对,有人能解释一下吗

我也尝试了
\u arrowParentNode=[self arrowChildNode]
在重新进入场景后,这给了我以下错误:

Attempted to add a SKNode which already has a parent. 
它也没有解决我最初遇到的类似于的问题

提前谢谢

SKSpritenode *arrowParentNode;
.
..
...

-(void) arrowParentNode {

   // _arrowParentNode = [ ? ] //  <-- what goes in here if the textures are in within the child? 
    _arrowParentNode.anchorPoint = CGPointMake(0.2, 0.75);
    _arrowParentNode.physicsBody=[SKPhysicsBody bodyWithRectangleOfSize:_brick.size];
    _arrowParentNode.physicsBody.dynamic =NO;
    _arrowParentNode.physicsBody.affectedByGravity=YES;
    _arrowParentNode.physicsBody.collisionBitMask = pengCategory;
    _arrowParentNode.physicsBody.contactTestBitMask = chickenCategory;
    [self addChild:_arrowParentNode];

}

- (SKSpriteNode *) arrowChildNode {
   SKSpritenode * arrowTexture = [[SKSpriteNode alloc] initWithImageNamed:ARROW_SPR_ARROW0001];

    SKAction *sharkOCAnimation = [SKAction animateWithTextures:ARROW_ANIM_BALL timePerFrame:0.02];

    SKAction *scaleBall = [SKAction scaleTo:-1 duration:0];

    [_arrowParentNode addChild:_arrowTexture];

    return _arrowTexture;
}
SKSpritenode*箭头父节点;
.
..
...
-(void)arrowParentNode{

//_arrowParentNode=[?]/您需要创建一个普通SKNode并分配它:

_arrowParentNode = [SKNode node];
同时将变量声明从SKSpriteNode更改为:

SKNode* _arrowParentNode;