title: sprite not rotating correctly (cocos2d)
body: <p>I have a turret on top of a tank base, both inside the same sprite sheet with frames correctly specified. When i build and run the project, I want the turret to rotate along the anchor point of the center of the tank. The turret is a child of the tank so that they will stay together when moving. However, when I try to rotate it, the turret seems to set its anchor point somewhere far off into the distance, like this:<img src="https://i.stack.imgur.com/1fUAX.png" alt="enter image description here"><img src="https://i.stack.imgur.com/3h7iK.png" alt="enter image description here"></p>
  
  <p>This is my init:</p>
  
  <pre><code>- (id)initWithLayer:(HelloWorldLayer *)layer type:(int)type hp:(int)hp {
  
  NSString *spriteFrameName = [NSString stringWithFormat:@"tank%d_base.png", type];    
  if ((self = [super initWithSpriteFrameName:spriteFrameName])) {
      _layer = layer;
      _type = type;
      self.hp = hp;
      _turret = [CCSprite spriteWithSpriteFrameName:[NSString stringWithFormat:@"tank%d_turret.png", type]];
      _turret.anchorPoint = ccp(0.5, 0.25);
      [self scheduleUpdateWithPriority:-1];
      [self addChild:_turret];
       _turret.position = ccp(40, 50);
  }
  
  return self;
  }
  </code></pre>
  
  <p>and I rotate the sprite here (I use a 360 degree shooting range)</p>
  
  <pre><code>- (void)shootToward:(CGPoint)targetPosition {
  
  //CGPoint offset = ccpSub(targetPosition, self.position);
  float x = abs(targetPosition.x) - self.position.x;
  float y = abs(targetPosition.y) - self.position.y;
  float angle;
  float angleDegrees;
  if (x &lt; 0 &amp;&amp; y &gt; 0) {
      angle = atanf(y/x);
      angleDegrees = -CC_RADIANS_TO_DEGREES(angle) - 90;
  }
  else if (x &lt; 0 &amp;&amp; y &lt; 0) {
      angle = atanf(y/x);
      angleDegrees = -CC_RADIANS_TO_DEGREES(angle) - 90;
  }
  else if (x &gt; 0 &amp;&amp; y &lt; 0) {
      angle = atanf(y/x);
      angleDegrees = 90 - CC_RADIANS_TO_DEGREES(angle);
  }
  else if(x &gt; 0 &amp;&amp; y &gt; 0) {
      angle = atanf(y/x);
      angleDegrees = 90 - CC_RADIANS_TO_DEGREES(angle);
  }
  switch (_layer.rotateInt) {
      case 0:
          angleDegrees = angleDegrees;
          break;
      case 1:
          angleDegrees = angleDegrees+ 180;
          break;
      case 2:
          angleDegrees = angleDegrees;
          break;
      case 3:
          angleDegrees = angleDegrees + 90;
          break;
      case 4:
          angleDegrees = angleDegrees - 90;
          break;
      default:
          break;
  }
  
  NSLog(@"%f",angleDegrees);
  _turret.rotation = angleDegrees;
  </code></pre>