title: iOS7 SpriteKit how to group animations of two or more sprite node children?
body: <p><strong>How can I create a SpriteKit animation for a node with multiple children and animate actions on multiple parts of the node as a group?</strong> </p>
  
  <p>I have the following node structure:</p>
  
  <ul>
  <li>Bird has children nodes for body, tail, head, etc </li>
  <li>Head has child nodes of upper beak, lower beak, etc</li>
  </ul>
  
  <p>In the example below, I want to animate the entire bird with all children bending down to pick up a seed. During bending down, the bird opens its beak to eat the seed. Notice that the beak is not a child of the bird, it's a child of the head node.</p>
  
  <pre><code>//body does this action
      SKAction* bendDown = [SKAction rotateToAngle:M_PI*0.3 duration:lookUpTiming];
  
  //beak does this action
      SKAction* openBeak = [SKAction rotateToAngle:-M_PI*0.175 duration:beakDuration + arc4random()%20/100.0];
  
  //I need both actions to be  played together as a group:
      SKAction* bendAndOpenBeak = [SKAction group:@[bendDown, openBeak]];
  
  
      //if I call this, the body will perform both actions. 
      [self runAction:bendAndOpenBeak completion:^{
  
      }];
  </code></pre>
  
  <p>Here's the code that I can run on the head node to have it's children perform an action using <code>runAction:onChildWithName:</code> However, I need to run this as a group with the body (a parent of a parent) node</p>
  
  <pre><code>-(SKAction*)openBeak
  {
      float angleUp = -M_PI*0.175;
      float duration = beakDuration + arc4random()%20/100.0;
  
      SKAction* rotateUp = [SKAction rotateToAngle:angleUp duration:duration];
      rotateUp.timingMode = SKActionTimingEaseOut;
  
      SKAction* rotateDown = [SKAction rotateToAngle:-angleUp duration: duration];
      rotateUp.timingMode = SKActionTimingEaseOut;
  
  
     return  [SKAction group:@[[SKAction runAction:rotateUp onChildWithName:@"beakUpper"],
                        [SKAction runAction:rotateDown onChildWithName:@"beakLower"] ]];
  
  }
  </code></pre>