title: How to subclass AtlasSpriteManager in Cocos2d?
body: <p>I need to create some compound sprites that will all move and rotate together. Since it's possible to change the position and rotation of an AtlasSpriteManager I've been trying to subclass so I can create a bunch of shortcuts like</p>
  
  <pre><code>CompoundSprite *cSprite = [CompoundSprite spriteManagerWithFile:@"sprites.png"];
  [cSprite makeComplexSprite];
  </code></pre>
  
  <p>internally, it looks a little like this</p>
  
  <pre><code>-(void)makeComplexSprite
  {
          AtlasSprite *sp1 = [[AtlasSprite spriteWithRect:CGRectMake(0, 0, 64, 64)       
                               spriteManager:self] retain];
          AtlasSprite *sp2 = [[AtlasSprite spriteWithRect:CGRectMake(0, 0, 64, 64) 
                               spriteManager:self] retain];
  
      [self addChild:sp1];
      [self addChild:sp2];
  
  
      [sp1 setPosition:CGPointMake(0,0)];
      [sp2 setPosition:CGPointMake(64,0)];
  
  }
  </code></pre>
  
  <p>However, when I run the applications, It crashes with the following exception</p>
  
  <pre><code>Terminating app due to uncaught exception 'NSInvalidArgumentException', 
  reason: '*** -[AtlasSpriteManager makeComplexSprite]: unrecognized selector sent to 
  instance 0x107e1c0
  </code></pre>
  
  <p>Also, if I remove all the code inside 'MakeComplexSprite' and make it do nothing, I also get the same problem. </p>
  
  <p>It's looking like AtlasSpriteManager just doesn't like to be sub classed. Is this the case? If so, why, and how could I work around it?</p>
  
  <h2><strong>UPDATE:</strong></h2>
  
  <p>I've found a workaround, by creating an NSObject that contains an atlasSpriteManager. It does the trick, but I would still like to subclass AtlasSpriteManager if possible. I appear to be implementing this exaclty as you describe. I'm creating an instance like this </p>
  
  <pre><code>CompoundSprite *cSprite = [CompoundSprite spriteManagerWithFile:@"file.png"]; 
  [cSprite makeBox]; 
  </code></pre>
  
  <p>which... now I think about it, means that cSprite is still an AtlasSpriteManager since that's what is being returned. hmmmm. Ho do I change that? </p>