<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.1" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>cocos2d for iPhone &#187; Tag: AtlasSpriteManager - Recent Topics</title>
		<link>http://www.cocos2d-iphone.org/forum/tags/atlasspritemanager</link>
		<description>A fast, easy to use, free, and community supported 2D game engine</description>
		<language>en-US</language>
		<pubDate>Fri, 10 Feb 2012 04:36:40 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.1</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>http://www.cocos2d-iphone.org/forum/search.php</link>
		</textInput>
		<atom:link href="http://www.cocos2d-iphone.org/forum/rss/tags/atlasspritemanager/topics" rel="self" type="application/rss+xml" />

		<item>
			<title>codeZero on "CCSpriteBatchNode, AtlasSpriteManager is deprecated?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/17817#post-99975</link>
			<pubDate>Mon, 20 Jun 2011 08:05:58 +0000</pubDate>
			<dc:creator>codeZero</dc:creator>
			<guid isPermaLink="false">99975@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I am the beginner for cocos2d. and i got this code about AtlasSpriteManager. then i know that AtlasSpriteManager is already deprecated. i try to change this code.</p>
<pre><code>AtlasSpriteManager *spriteManager = [AtlasSpriteManager spriteManagerWithFile:@&#34;sprites.png&#34; capacity:10];
	[self addChild:spriteManager z:-1 tag:kSpriteManager];

	AtlasSprite *background = [AtlasSprite spriteWithRect:CGRectMake(0,0,320,480) spriteManager:spriteManager];
	[spriteManager addChild:background];
	background.position = CGPointMake(160,240);</code></pre>
<p>into this.</p>
<pre><code>CCSpriteBatchNode *spriteManager = [CCSpriteBatchNode batchNodeWithFile:@&#34;sprites.png&#34; capacity:10];
	[self addChild:spriteManager z:-1 tag:kSpriteManager];

	CCSprite *background = [CCSprite spriteWithFile:spriteManager rect:CGRectMake(0,0,320,480)];
	[spriteManager addChild:background];
	background.position = CGPointMake(160,240);</code></pre>
<p>and i got this warning. it is the way im doing it correct?<br />
<code>warning: incompatible Objective-C types &#39;struct CCSpriteBatchNode *&#39;, expected &#39;struct NSString *&#39; when passing argument 1 of &#39;spriteWithFile:rect:&#39; from distinct Objective-C type</code>
</p></description>
		</item>
		<item>
			<title>JosKoomen on "Newbie: Is the AtlasSpriteManager gone in 0.99.4?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/9751#post-56093</link>
			<pubDate>Tue, 21 Sep 2010 08:11:44 +0000</pubDate>
			<dc:creator>JosKoomen</dc:creator>
			<guid isPermaLink="false">56093@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I'm new to Cocos2d but i like it a lot. I have a long flash history and it gives me a comfortable feeling.<br />
In a tutorial i followed i saw the use of the AtlasSpriteManager but it seems to be gone.</p>
<p>Is it replaced or does the functionallity not excists anymore?<br />
I can see that there is an implementation in CCCompatibility.h</p>
<p>So can i still use it?
</p></description>
		</item>
		<item>
			<title>itlgames on "Stuck in v0.8.2 and want to use Zwoptex? Check here"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/7231#post-42411</link>
			<pubDate>Sat, 19 Jun 2010 18:55:47 +0000</pubDate>
			<dc:creator>itlgames</dc:creator>
			<guid isPermaLink="false">42411@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi, if you happen to be stuck on cocos2d v0.8.2 like me, and can't upgrade to latest versions 0.99.X for any reason (probably something wrong on our code), but still want to use Zwoptex to manage your sprite sheets, here it is a simple solution based on the CCSpriteFrameCache class on v0.99.3:</p>
<p>SpriteManager.h</p>
<pre><code>#<a href='http://www.cocos2d-iphone.org/forum/tags/import'>import</a> &#34;cocos2d.h&#34;

@interface AtlasSpriteManager (SpriteManager) 

NSDictionary *frames;
int formatPlist; 

+(id)spriteManagerWithFile:(NSString*)fileImage plist:(NSString*)plist capacity:(NSUInteger)capacity;
+(id)spriteManagerWithFile:(NSString*) imageFile plist:(NSString*)plist;
+(void)createDictionaryFromPlist:(NSString*)plist;

-(AtlasSprite *)createSprite:(NSString*) imageFileName;

@end</code></pre>
<p>SpriteManager.m:</p>
<pre><code>#<a href='http://www.cocos2d-iphone.org/forum/tags/import'>import</a> &#34;SpriteManager.h&#34;

const int _defaultCapacity = 29;

@implementation AtlasSpriteManager (SpriteManager)

+(id)spriteManagerWithFile:(NSString*)fileImage plist:(NSString*)plist capacity:(NSUInteger)capacity
{
	[AtlasSpriteManager createDictionaryFromPlist:plist];
	return [[[AtlasSpriteManager alloc] initWithFile:fileImage capacity:capacity] autorelease];
}

+(id)spriteManagerWithFile:(NSString*) imageFile plist:(NSString*)plist
{
	[AtlasSpriteManager createDictionaryFromPlist:plist];
	return [[[AtlasSpriteManager alloc] initWithFile:imageFile capacity:_defaultCapacity] autorelease];
}

+(void)createDictionaryFromPlist:(NSString*)plist
{
	NSString *path = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:plist];
	NSDictionary *dict = [NSDictionary dictionaryWithContentsOfFile:path];
	NSDictionary *metadataDict = [dict objectForKey:@&#34;metadata&#34;];

	// get the format
	if (metadataDict != nil) {
		formatPlist = [[metadataDict objectForKey:@&#34;format&#34;] intValue];
	} else {
		formatPlist = 0;
	}

	frames = [dict objectForKey:@&#34;frames&#34;];

	//NSLog(@&#34;SpriteManager.spriteManagerWithFile: %@&#34;, frames);
}

-(AtlasSprite *)createSprite:(NSString*) imageFileName
{
	if(formatPlist == 0) {
		NSDictionary *properties = [frames objectForKey:imageFileName];
		float x = [[properties objectForKey:@&#34;x&#34;] floatValue];
		float y = [[properties objectForKey:@&#34;y&#34;] floatValue];
		float w = [[properties objectForKey:@&#34;width&#34;] floatValue];
		float h = [[properties objectForKey:@&#34;height&#34;] floatValue];
		float ox = [[properties objectForKey:@&#34;offsetX&#34;] floatValue];
		float oy = [[properties objectForKey:@&#34;offsetY&#34;] floatValue];
		//int ow = [[properties objectForKey:@&#34;originalWidth&#34;] intValue];
		//int oh = [[properties objectForKey:@&#34;originalHeight&#34;] intValue];
		//NSLog(@&#34;SpriteManager.createSprite: %@&#34;, properties);

		AtlasSprite *sprite = [AtlasSprite spriteWithRect:CGRectMake(x + ox, y + oy, w, h) spriteManager:self];
		[self addChild:sprite];
		return sprite;

	} else if (formatPlist == 1) {
		NSDictionary *properties = [frames objectForKey:imageFileName];
		CGRect frame = CGRectFromString([properties objectForKey:@&#34;frame&#34;]);
		CGPoint offset = CGPointFromString([properties objectForKey:@&#34;offset&#34;]);
		//CGSize sourceSize = CGSizeFromString([properties objectForKey:@&#34;sourceSize&#34;]);

		frame.origin.x += offset.x;
		frame.origin.y += offset.y;

		AtlasSprite *sprite = [AtlasSprite spriteWithRect:frame spriteManager:self];
		[self addChild:sprite];
		return sprite;

	} else {
		NSAssert(NO,@&#34;cocos2d: WARNING: format is not supported for SpriteManager&#34;);
		return nil;
	}

}

@end</code></pre>
<p>To use it, easy:</p>
<pre><code>AtlasSpriteManager *spriteManager = [AtlasSpriteManager spriteManagerWithFile:@&#34;sprite_sheet.png&#34; plist:@&#34;sprite_sheet.plist&#34;];
[self addChild:spriteManager z:1];
AtlasSprite *spriteAtlas = [spriteManager createSprite:@&#34;file_name.png&#34;];</code></pre></description>
		</item>
		<item>
			<title>trump-card on "AtlasSprite draw method"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/1023#post-6124</link>
			<pubDate>Fri, 31 Jul 2009 05:14:06 +0000</pubDate>
			<dc:creator>trump-card</dc:creator>
			<guid isPermaLink="false">6124@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hello!</p>
<p>I'm trying to override draw method of AtlasSprite. AtlasSprite is derived from CocosNode and CocosNode has draw method. I want to make custom actions in draw method of AtalsSprite. When I derived draw method of Sprite and create custom action in draw then it works. What should I do?<br />
<pre><code>@implementation AtlasSprite2

- (void) draw
{
   [super draw];
}</code></pre></description>
		</item>
		<item>
			<title>abichaz on "AtlasSpriteManager compatibility with latest Xcode"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/7782#post-45513</link>
			<pubDate>Fri, 09 Jul 2010 17:53:01 +0000</pubDate>
			<dc:creator>abichaz</dc:creator>
			<guid isPermaLink="false">45513@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hey,</p>
<p>I am having trouble with using the AtlasSpriteManager in the latest XCODE 3.2.3. It doesn't recognize it. I get the error "AtlasSpriteManager not declared here'. Does it have something to do with the new SDK or do I need to import ne file?</p>
<p>Thanks<br />
Abhinav
</p></description>
		</item>
		<item>
			<title>redsky on "Connection between AtlasAnimation and AtlasSpriteManager?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/186#post-961</link>
			<pubDate>Fri, 19 Jun 2009 07:44:21 +0000</pubDate>
			<dc:creator>redsky</dc:creator>
			<guid isPermaLink="false">961@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Howdy,</p>
<p>I've looked at the code over and over and I'm not seeing how AtlasAnimation knows what sprite manager to reference. I'm assuming I have a fundamental misunderstanding of how things are supposed to work. This code was taken from another post  [ thanks lolcoder ;) ]</p>
<pre><code>// create the player
asMan = [AtlasSpriteManager spriteManagerWithFile:@&#34;dude.png&#34;];

aSprite = [AtlasSprite spriteWithRect:CGRectMake(0, 0, 17, 29) spriteManager:asMan];
[asMan addChild:aSprite z:0];
[aSprite setPosition:cpv(240, 200)];

// create the running animation
runAnimation = [AtlasAnimation animationWithName:@&#34;run&#34; delay:0.2f];
[runAnimation addFrameWithRect: CGRectMake(17, 0, 17, 29) ];
[runAnimation addFrameWithRect: CGRectMake(34, 0, 17, 29) ];
[aSprite addAnimation:runAnimation];</code></pre>
<p>So in the addFrameWithRect methods, how does it know what texture to use those coordinates on?</p>
<p>thanks in advance
</p></description>
		</item>
		<item>
			<title>edge17 on "Possible to always make sprite animation complete on last frame?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/4470#post-26623</link>
			<pubDate>Sun, 14 Feb 2010 11:30:08 +0000</pubDate>
			<dc:creator>edge17</dc:creator>
			<guid isPermaLink="false">26623@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Rightnow I have a sprite running around on the screen across the X-axis (side scroller style). When the sprite reaches the endPosition point, I call [sprite stopAllActions]. When the actions stop, the sprite is displayed in whatever the last frame happened to be. Is there a way to make the whole animation complete so that the sprite is in the "resting" position and not in a "running" position?
</p></description>
		</item>
		<item>
			<title>alibozorgkhan on "Create Animation using AtlasSpriteManager"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3109#post-19131</link>
			<pubDate>Fri, 20 Nov 2009 17:29:59 +0000</pubDate>
			<dc:creator>alibozorgkhan</dc:creator>
			<guid isPermaLink="false">19131@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi all, I am using AtlasSpriteManager and AltasSprite to create frame by fram animation with 1 file. I wanna write something that at first show a simple picture, without any animation and for example when I touch it, it shows some animation and return to the first position and frame. I just can't show the first frame without animation using this code :</p>
<pre><code>Sprite *checker = [Sprite spriteWithFile:@&#34;test.png&#34;];
float frameWidth = [checker boundingBox].size.width / frameNumber;
float frameHeight = [checker boundingBox].size.height;

AtlasSpriteManager *mgr = [AtlasSpriteManager spriteManagerWithFile:fileName];
AtlasSprite *sprite = [AtlasSprite spriteWithRect:CGRectMake(pos.x, pos.y, frameWidth, frameHeight) spriteManager:mgr];
sprite.position = ccp(pos.x, pos.y);
[mgr addChild:sprite];

[layer addChild:mgr];

AtlasAnimation* animation = [AtlasAnimation animationWithName:@&#34;Animation&#34; delay:delay];
assert( animation != nil );

for(int i = 0; i &#60; frameNumber; i++){
        [animation addFrameWithRect:CGRectMake(i * frameWidth, 0, frameWidth,frameHeight)];
}

id action = [Animate actionWithAnimation:animation];
assert( action != nil );

id repeatAction;
repeatAction = [Repeat actionWithAction:action times:repeatNumber];

[sprite runAction:repeatAction];</code></pre>
<p>any idea how to do that? thanx in advance
</p></description>
		</item>
		<item>
			<title>Anny on "AtlasSpriteManager inside NSArray, workable?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3367#post-20684</link>
			<pubDate>Thu, 10 Dec 2009 19:57:26 +0000</pubDate>
			<dc:creator>Anny</dc:creator>
			<guid isPermaLink="false">20684@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi once again,</p>
<p>Seriously progressing on this game engine now, and at a stage where everything so far works in the console, but I've run into a problem when trying to get some visual feedback.</p>
<p>Essentially, I have a very dynamic superclass for my game engine which I subclass to define individual levels, many of which will use several totally different sprite sheets for characters. So, I am using an NSMutableArray to store multiple instances of AtlasSpriteManager, in this format:</p>
<pre><code>NSMutableArray (
    NSArray (
        (NSString*) filename,
        (AtlasSpriteManager*) ASM,
        nil
    )...
)</code></pre>
<p>Loaded character classes contain a value — <code>(NSString*) [class requiredSpriteManager]</code> — that the engine pulls in order to determine which sprite sheet to load its graphics from. In theory this has not been a problem, but my graphics are now not displaying for uncertain reasons.</p>
<p>I believe this the is correct approach:</p>
<pre><code>AtlasSpriteManager* ASM = [AtlasSpriteManager blahblah];
AtlasSprite* AS = [AtlasSprite spriteWithRect: assumedRect spriteManager: ASM];
[ASM addChild: AS];
[self addChild: ASM];</code></pre>
<p>However, as mentioned, since I am loading sprite sheets dynamically, I am doing this instead (where [self sheets] is the NSMutableArray structure described above) on scene load:</p>
<pre><code>NSEnumerator* sms = [[self sheets] objectEnumerator];
NSArray* sm;
int i = 0;
while(( sm = [sms nextObject] ))
{
  [self addChild: [sm objectAtIndex: 1] z: i++];
}</code></pre>
<p>...and then adding AtlasSprites later based on separate events.</p>
<p>Is this totally arse about face and am I screwing this up from the start by trying to be clever with arrays, or is it more likely that I'm getting something else wrong?
</p></description>
		</item>
		<item>
			<title>Sean Carmody on "Problem with Sprite Position on Touch during Animation"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3328#post-20480</link>
			<pubDate>Tue, 08 Dec 2009 07:38:27 +0000</pubDate>
			<dc:creator>Sean Carmody</dc:creator>
			<guid isPermaLink="false">20480@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi,</p>
<p>I've got a few months in with cocos2d, but have just started with animations and I am stuck. I've tried boards and tutorials, but cant find my answer, so I thought I would reach out to the group. If someone has the time to help, it would be appreciated.</p>
<p>I'm using cocos2d v0.7.2 (i realize it is old). The problem is that in my animation, I cannot seem to get the current position of the sprite. I always get the original position of the sprite when it started the animation run.</p>
<p>my animation code:<br />
<pre><code>CGPoint balloonposition1 = ccp(190, 45);
		mgr1 = [AtlasSpriteManager spriteManagerWithFile:item01 capacity:22];
		[self addChild:mgr1 z:1 tag:11];
		id float1 = [MoveBy actionWithDuration:3 position: ccp(5, 325)];
		id float1reset = [MoveBy actionWithDuration:0 position: ccp(-5, -325)];
		id float1_seq = [Sequence actions: float1, float1reset, nil];
		float1_forever = [[RepeatForever actionWithAction:float1_seq] retain];
		balloon1 = [AtlasSprite spriteWithRect:CGRectMake(0, 0, 105, 165) spriteManager: mgr1];
		balloon1.position = ccp(balloonposition1.x, (balloonposition1.y));
		[mgr1 addChild:balloon1 z:1];
		[mgr1 runAction:  float1_forever];</code></pre>
<p>So this works fine and puts the balloon image in the correct place and animates it nicely. However, when I try to grab the moving sprite, it only sees the original "ballonposition1" as location of the balloon. I can grab the balloon and move it, but only if I touch its starting position. Somehow it has an offset, dependent upon where the balloon is in its animation sequence. I would do simple math on the offset, but I cannot find the position of the balloon's current position.</p>
<p>touch code:<br />
<pre><code>- (BOOL) ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *) event
{
	UITouch *touch = [touches anyObject];
	CGPoint point = [touch locationInView: [touch view]];
	point = [[Director sharedDirector] convertCoordinate: point];

	float x = [balloon1 position].x - ([balloon1 contentSize].width)/2;
	float y = [balloon1 position].y - ([balloon1 contentSize].height)/2;
	float w = [balloon1 contentSize].width;
	float h = [balloon1 contentSize].height;
	CGRect touchArea1 = CGRectMake(x, y, w, h);

        if (CGRectContainsPoint(touchArea1, point)) { whoisheld=1;

	if(whoisheld==1) {
		[mgr1 stopAction:float1_forever];
		[self reorderChild:mgr1 z:5];  //make balloon1 go to top
		[balloon1 setPosition:(point)];	//this should jump object center to touch point
                }
		return kEventHandled;
	}</code></pre>
<p>I have similar code on move, etc, which is working fine. The balloon follows the touch point, *but is off by the original offset from the initial touch*.</p>
<p>I must be missing something simple, but I cannot get past this issue.</p>
<p>Thank you for any guidance you can give me.
</p></description>
		</item>
		<item>
			<title>natedood on "AtlasSprite"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/1221#post-7353</link>
			<pubDate>Sun, 09 Aug 2009 16:11:37 +0000</pubDate>
			<dc:creator>natedood</dc:creator>
			<guid isPermaLink="false">7353@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Is it correct that an atlas sprite manager can only have one defined sprite sheet?  </p>
<p>Or is it possible to add other atlas sprites to the same sprite manager?</p>
<p>The reason I'm asking is that I would like the sprites to sometimes overlap each other by z-index, but the z-index of the sprites can change dynamically.</p>
<p>For example, I have a top down view of a level, when a moving char passes behind something, I want their char to appear to be behind the object, however, when they are in front of it, I want them to appear in front of the object.</p>
<p>This seems doable (by re-calculating the moving char's z-index as it moves up or down on Y axis) IF your char is on the same atlas manager since the z-index between the moving and non moving char will be in relation to each other.</p>
<p>The problem lies in that the moving chars will be on a different sprite sheet than the sheet with the objects.</p>
<p>Is the only way around this to put the chars and objects on the same sheet or manager?</p>
<p>Here is an image that may help clarify : <a href="http://dev.webclarity.com/guru/z-prob.jpg" rel="nofollow">http://dev.webclarity.com/guru/z-prob.jpg</a></p>
<p>Let me know If I'm not being clear enough on my description.</p>
<p>Any guidance you can provide is greatly appreciated!
</p></description>
		</item>
		<item>
			<title>derekvanvliet on "Can AtlasSprites be children of any node?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/1378#post-8280</link>
			<pubDate>Mon, 17 Aug 2009 02:39:23 +0000</pubDate>
			<dc:creator>derekvanvliet</dc:creator>
			<guid isPermaLink="false">8280@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Is it true that AtlasSprites can only be children of AtlasSpriteManager nodes? I'm noticing that mine disappear when I child them to anything else, like a layer, for instance.
</p></description>
		</item>
		<item>
			<title>Anny on "AtlasSpriteManager syntax? Not working"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3174#post-19602</link>
			<pubDate>Thu, 26 Nov 2009 21:45:51 +0000</pubDate>
			<dc:creator>Anny</dc:creator>
			<guid isPermaLink="false">19602@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi, first post here. Just started using cocos2d after nightmares trying to compile openFrameworks onto iPhone, and it works wonderfully. I am figuring out components of c2d that I expect to need when I start developing a game proper (I have one in mind).</p>
<p>At the moment I am having some probably easy to resolve trouble with AtlasSprite and/or AtlasSpriteManager. From reading the forum I have gathered that this should work: (Note: I have had no trouble with the ordinary <code>Sprite</code> object, and am just trying to understand <code>AtlasSpriteManager</code> so that I can use it in the game proper.)</p>
<pre><code>AtlasSpriteManager* mgr = [AtlasSpriteManager spriteManagerWithFile: @&#34;bslogo.png&#34;];
AtlasSprite* sprite = [AtlasSprite spriteWithRect: CGRectMake( 0, 0, 424, 67 ) spriteManager: mgr ];

CGSize size = [[Director sharedDirector] winSize];
sprite.position = ccp( size.width/2, size.height/2 );
[mgr addChild: sprite z: 1 ];
[self addChild: sprite z: 1 ];</code></pre>
<p>This builds fine, but when I try to run it I get a SIGABRT response from my device. If I remove the <code>[mgr addChild...</code> line, the app builds AND runs fine, but the sprite doesn't appear. Apparently the <code>[mgr addChild...</code> line is required to display sprites correctly, but if it doesn't work...?</p>
<p>Thanks in advance
</p></description>
		</item>
		<item>
			<title>pgb on "AtlasSpriteManager z-order"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3162#post-19497</link>
			<pubDate>Wed, 25 Nov 2009 22:10:49 +0000</pubDate>
			<dc:creator>pgb</dc:creator>
			<guid isPermaLink="false">19497@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi,<br />
For a game I'm devloping, I have 2 kind of players of sprites: good guy (GG), and bad guy (BG).</p>
<p>Since both have several animations attached, I implemented something similar to what's described here <a href="http://johnehartzog.com/2009/05/using-cocos2d-atlasspritemanager/" rel="nofollow">http://johnehartzog.com/2009/05/using-cocos2d-atlasspritemanager/</a> and I'm sharing the AtlasSpriteManager instance across all the five BGs.</p>
<p>In some game situations, however, the good guy may end up between 2 bad guys, and I would need the Z order to reflect that:<br />
BG - GG - BG</p>
<p>Since both BG share the same AtlasSpriteManager, it seems to me that I cannot do it (based on my tests).<br />
Any suggestion on how to handle this? What's the overhead of having 5 times more AtlasSpriteManagers (for the bad guys) so I can freely swap its depth?</p>
<p>Thank you
</p></description>
		</item>
		<item>
			<title>shw on "AtlasSprite/AtlasSpriteManager usage plus Animation"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3092#post-19028</link>
			<pubDate>Thu, 19 Nov 2009 15:28:14 +0000</pubDate>
			<dc:creator>shw</dc:creator>
			<guid isPermaLink="false">19028@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi there!<br />
I've wrote part of my app successfully using normal Sprites and Animation. But since it includes more and more image files I thought it would be a good idea to rewrite some parts of that app so that it would use AltasSprite.<br />
I used ImageMagick to merge images of the same "control" but different states into a singe image (one file per one control). And started rewriting the parts that used Sprite class to AtlasSprite and AtlasSpriteManager.</p>
<p>I have two problems though:<br />
1. A huge one. Since it would be complicated to operate on main core of the app - I've started testing Atlas* classes on my splash screen scene which just displayed logo and was replaced by the main scene after a second. The thing is - when I use Atlas* classes it doesn't even display it. Here's my code:</p>
<p><code><br />
@implementation SplashScene<br />
- (id) init {<br />
    self = [super init];<br />
    if (self != nil) {<br />
        //Sprite * bg = [Sprite spriteWithFile:@"splash.png"];<br />
	//bg.position = ccp(240, 160);<br />
        //[self addChild:bg z:0];</p>
<p>		mgr = [AtlasSpriteManager spriteManagerWithFile: @"splash.png"];<br />
		sprite = [AtlasSprite spriteWithRect:CGRectMake(0, 0, 200, 200) spriteManager:mgr];<br />
		sprite.position = ccp(10, 10);</p>
<p>		[self addChild: sprite z: 1];</p>
<p>    }<br />
    return self;<br />
}<br />
@end<br />
</code></p>
<p>The commented code with Sprite works, the second one doesn't. Even when I set position to AtlasSpriteManager and add it as a child instead of AtlasSprite itself. All I see is a blank screen. SplashScene is a subclass of the Scene class.</p>
<p>2. Originally when I used Sprite classes I used Animation to change "states" of those sprites.</p>
<p><code><br />
Sprite * spr = [Sprite spriteWithFile: @"somefile.png"];<br />
sprite.position = ccp(10, 10);<br />
Animation * anim = [[Animation alloc] initWithName:@"states" delay:0];<br />
for(int i = 0; i &#60; 3; i++)<br />
{<br />
	Texture2D * t = [[TextureMgr sharedTextureMgr] addImage:[self loadImage: "somefile" withStateNumber:[NSString stringWithFormat:@"%d", i]]];</p>
<p>	[anim addFrameWithTexture:t];<br />
}<br />
[sprite addAnimation: anim];<br />
[anim release];<br />
</code></p>
<p>So I made sprite with the default state of the control, than added rest of the states as an Animation for that sprite. And when I wanted to set change the state i just used</p>
<p><code><br />
[sprite setDisplayFrame: @"states" index: STATE_NUMBER];<br />
</code></p>
<p>But since now every state is in one file instead of separate file for every state - it's impossible to do it that way. Is there some other way to make Animation or is it made some way different with AtlasSprite and it doesn't use Animation for it?
</p></description>
		</item>
		<item>
			<title>gargantuan on "How to subclass AtlasSpriteManager?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3024#post-18702</link>
			<pubDate>Mon, 16 Nov 2009 13:44:47 +0000</pubDate>
			<dc:creator>gargantuan</dc:creator>
			<guid isPermaLink="false">18702@http://www.cocos2d-iphone.org/forum/</guid>
			<description><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>
<p><code><br />
CompoundSprite *cSprite = [CompoundSprite spriteManagerWithFile:@"sprites.png"];<br />
[cSprite makeComplexSprite];<br />
</code></p>
<p>internally, it looks a little like this</p>
<p><code><br />
-(void)makeComplexSprite:<br />
{<br />
        AtlasSprite *sp1 = [[AtlasSprite spriteWithRect:CGRectMake(0, 0, 64, 64)<br />
                                            spriteManager:self] retain];<br />
        AtlasSprite *sp2 = [[AtlasSprite spriteWithRect:CGRectMake(0, 0, 64, 64)<br />
                                            spriteManager:self] retain];<br />
	[self addChild:sp1];<br />
	[self addChild:sp2];<br />
	[sp1 setPosition:CGPointMake(0,0)];<br />
	[sp2 setPosition:CGPointMake(64,0)];<br />
}<br />
</code><code></p>
<p>However, when I run the applications, It crashes with the following exception</p>
<p></code><code><br />
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[AtlasSpriteManager makeComplexSprite]: unrecognized selector sent to instance 0x107e1c0<br />
</code></p>
<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></description>
		</item>
		<item>
			<title>javy on "AtlasSprite not positioned correctly"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/1762#post-11059</link>
			<pubDate>Wed, 09 Sep 2009 06:20:04 +0000</pubDate>
			<dc:creator>javy</dc:creator>
			<guid isPermaLink="false">11059@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I have an AtlasSpriteManager as a property of an custom object.</p>
<p>In the manager I have two AtlasSprites (one of a button unpressed, and another pressed down).  In their instantiation I set their initial position like so:</p>
<p>    // in the init<br />
    withPosition:CGPointMake(50.0, 100.0)</p>
<p>    // elsewhere, in the init method<br />
    sprite.position = newPosition; // the point specified above</p>
<p>I then add the manager as a child of a layer, to be added to a scene, then displayed.<br />
    [self addChild:testButton.spriteManager z:0 tag:kTagSpriteManager];</p>
<p>I then run it in the simulator...</p>
<p>The first sprite is at the proper position.  However, the second appears to have it's x position off by -50, and the y position correct.</p>
<p>The position property in the sprite manager is never changed, nor are the anchor points.  Only the position properties of the sprites are adjusted.</p>
<p>When displaying the x/y positions with nslog, the points are 50.0, 100.0 as specified.</p>
<p>Any insight as to what I'm doing wrong?
</p></description>
		</item>
		<item>
			<title>greyhoundgames on "Z order mixing"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/2940#post-18171</link>
			<pubDate>Wed, 11 Nov 2009 19:59:19 +0000</pubDate>
			<dc:creator>greyhoundgames</dc:creator>
			<guid isPermaLink="false">18171@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>So I am reading on z-order mixing and this is the only way to acomplish it(between texture atlases) that I have found:<br />
<a href="http://johnehartzog.com/2009/05/using-cocos2d-atlasspritemanager/" rel="nofollow">http://johnehartzog.com/2009/05/using-cocos2d-atlasspritemanager/</a></p>
<p>Is this currently the best way to go? It sounds like you will lose some of the magic stuff like effects when you do this, or atleast vastly complicate them. Has any more come of this topic since this article was written back in august?</p>
<p>My current appstore title Sub Hunt had 2 main texture atlases(was written in my own engine) and I could not fit all the explosions art on the same atlas as the units. I also had fire animations on a separate atlas. However fire needs to burn "from" a boat and you would have to have the z of the boat match the z of the fire burning on it. My engine would just swap gl textures when this was needed, but I would get into trouble in cocos2d unless I do the aforementioned trick. Any thoughts?<br />
Because these things were not a constant activity it wasn't a big performance hit but they provided nice visual enhancement when they happened.
</p></description>
		</item>
		<item>
			<title>jhendrix69 on "How do YOU use AtlasSpriteManager?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/2797#post-17311</link>
			<pubDate>Wed, 04 Nov 2009 02:13:50 +0000</pubDate>
			<dc:creator>jhendrix69</dc:creator>
			<guid isPermaLink="false">17311@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>So I'm currently working on a platformer. The main guy has a bunch of different moves and each move uses a different sprite sheet for animation. Same deal with the enemies... </p>
<p>I have a player class and an enemy class which are children of a creature class. </p>
<p>Does it make sense to have an AtlasSpriteManager and action for each for these moves?<br />
E.g. in the init function:</p>
<pre><code>spriteManager1 = [[AtlasSpriteManager spriteManagerWithFile:@&#34;walk_sheet.png&#34;] retain];

spriteManager2 = [[AtlasSpriteManager spriteManagerWithFile:@&#34;attack_sheet.png&#34;] retain];

etc. 

// Create AtlasAnimation object for each move here using for-loop

actionWalk = [[Animate actionWithAnimation:animationWalk] retain];
actionAttack = [[Animate actionWithAnimation:animationAttack] retain];</code></pre>
<p>(actionWalk and actionAttack are type id and are class variables)</p>
<p>Is this the best way to do this? In the end, my player class will probably have 6 ASMs and actions and each enemy instance have 2-3 ASMs and actions... What do you guys suggest?
</p></description>
		</item>
		<item>
			<title>Kaizen on "Low performance with AtlasSprite"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/2830#post-17518</link>
			<pubDate>Thu, 05 Nov 2009 19:32:04 +0000</pubDate>
			<dc:creator>Kaizen</dc:creator>
			<guid isPermaLink="false">17518@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi,</p>
<p>I´m testing cocos2d and I´m having some problems with performance using AtlasSprites. I´m creating a Scene with one Layer and inside the Layer I´m creating some AtlasSprites using the same AtlasSpriteManager for all of them. I tried with 100, 200 and 300 sprites and I´m getting this FPS values:</p>
<p>100 sprites -&#62; 57 FPS<br />
200 sprites -&#62; 32 FPS<br />
300 sprites -&#62; 22 FPS</p>
<p>I´m using the simulator, compiling for 3.0 in Release mode.</p>
<p>What am I doing wrong?
</p></description>
		</item>
		<item>
			<title>neromid on "Does AtlasSpriteManager.position move it&#039;s children?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/915#post-5406</link>
			<pubDate>Sun, 26 Jul 2009 15:42:46 +0000</pubDate>
			<dc:creator>neromid</dc:creator>
			<guid isPermaLink="false">5406@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>The title of this post really reveals everything I have to ask, but it's really bugging me.  I noticed AtlasSpriteManager, like most things, is a subclass of CocosNode, which has, as most everyone knows, a position property.  <strong>If I change the AtlasSpriteManager's position, will the position of it's children be moved as well?</strong>
</p></description>
		</item>
		<item>
			<title>jhendrix69 on "AtlasSprite question"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/2839#post-17549</link>
			<pubDate>Fri, 06 Nov 2009 01:52:47 +0000</pubDate>
			<dc:creator>jhendrix69</dc:creator>
			<guid isPermaLink="false">17549@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi, I had a question about how to use AtlasSprites when I have different animations for my character. Unfortunately I can't fit all my animations on one sheet like in most of the examples here, so I had to use different AtlasSpriteManagers for each one. Since each manager needs to have the sprite as a child, would you add the same sprite as a child to multiple managers? Or do you have to create a separate sprite for each manager? Thanks for any help
</p></description>
		</item>
		<item>
			<title>indy2005 on "AtlasSpriteManager - positioning  (noob)"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/2792#post-17291</link>
			<pubDate>Tue, 03 Nov 2009 20:57:57 +0000</pubDate>
			<dc:creator>indy2005</dc:creator>
			<guid isPermaLink="false">17291@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi,</p>
<p>Noob question.  I am working through AtlasSprites....you create a manager, add the manager to the scene or layer, and then add sprites to the manager.</p>
<p>When you are setting the position of the AtlasSprites - is the position being set relative to the layer the manager was added to - or to the manager itself (which is a subclass of CocosNode so I am guessing can have a position?)...</p>
<p>Thanks</p>
<p>i
</p></description>
		</item>
		<item>
			<title>sankar.balaji on "Loading AtlasSpriteManager in background threads are not working.. Please help.."</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/2679#post-16640</link>
			<pubDate>Tue, 27 Oct 2009 17:24:55 +0000</pubDate>
			<dc:creator>sankar.balaji</dc:creator>
			<guid isPermaLink="false">16640@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi,</p>
<p>   I am doing a game that involves a huge set of character animations (atleast 25 different of them).. for which I am having a lot of spritesheets each weighing around 100KB to 200KB.. And I used to create the AtlasSpriteManagers for these on-demand. But when I tested this in the device, there was lotsa performance hiccups around these animations.. there were frames missing.. game hanging while the images where loading and all..</p>
<p>  So I decided to create a pre-loading and caching technique in which I constantly look ahead and create the possible AtlasSpriteManagers I may need and maintain them in a NSMutableDictionary and take it from there during the animation.. and based on a usageCount variable, I will remove them off this dictionary later and free memory.. And I use the performSelectorInBackground method to call this function 'loadASM' which does this creation of AtlasSpriteManager and storing it in the dictionary.</p>
<p><code><br />
[self performSelectorInBackground:@selector(loadASM:) withObject:fileName];</p>
<p>-(ASMHolder *)loadASM:(NSString *)fileName<br />
{<br />
AtlasSpriteManager *sprMgr = [AtlasSpriteManager spriteManagerWithFile:fileName capacity:40];<br />
ASMHolder *asmHolder = [[ASMHolder alloc] init];<br />
asmHolder.sprMgr = sprMgr; asmHolder.retainCount++;<br />
[asmDict setObject:asmHolder forKey:fileName];</p>
<p>return asmHolder;<br />
}<br />
</code></p>
<p>  But the images dont seem to load if I call this method in the background using performSelectorInBackground.. A white colored box appears where the images are supposed to appear.. However, the AtlasSpriteManager object is created and it is there in the dictionary.. but it is just turning out to blank sprites.. And instead of the background call, if i try calling the method 'loadASM' directly (i.e. [self loadASM:fileName]), the images are loading.. but of course, there is the delay as this is synchronous calling..</p>
<p>  I even tried caching Texture2D objects also instead of the AtlasSpriteManagers, but the result is the same.. </p>
<p>  ( I have also tried addImageAsync of TextureManager.. but that doesnt help my purpose too.. as it does not give the file name it is loading in the callback method's arguments, without which my dictionary cache's key cannot be created..)</p>
<p> Please help..</p>
<p>Thanks<br />
Sankar
</p></description>
		</item>
		<item>
			<title>itsbilly on "Yet another newb atlasSpriteManager question.."</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/2419#post-15121</link>
			<pubDate>Mon, 12 Oct 2009 04:31:42 +0000</pubDate>
			<dc:creator>itsbilly</dc:creator>
			<guid isPermaLink="false">15121@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Can I use an AtlasSpriteManager without a sprite sheet? I'm noticing the ctor taking a sprite sheet, but my images are different sizes and, at the most, I'll have up to 20. Animation will be ~50% of these simply being rotated. I also like the management freedom of single .png files. Not sure how to use these with an AtlasSpriteManager without putting them together.</p>
<p>Also, I care mostly about a smart map telling me x,y coords for a given sprite. I'll also need to perform collision detection (users will be allowed to move some sprites). My first thought was to write a simple list based object for mapping and I could perform collision detection with it. Given my circumstances, would this be a better bet than an AtlasSpriteManager? I just don't want to be missing out on anything good :) Thanks.</p>
<p>~billy
</p></description>
		</item>
		<item>
			<title>rolando on "&quot;Compound&quot; Atlas Sprite?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/83#post-332</link>
			<pubDate>Fri, 12 Jun 2009 17:16:11 +0000</pubDate>
			<dc:creator>rolando</dc:creator>
			<guid isPermaLink="false">332@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>What would be the way to go creating a "compound" AtlasSprite? I tried the following:</p>
<p>create a new node, add some atlas sprites as children (in the position I needed) and add each children to the manager. Then, add the new node to the layer -&#62; error: child already added</p>
<p>creating a new node, and adding the atlas sprites as children, and then adding the node to the manager does not work, since the manager expects an atlasSprite...</p>
<p>Should I create a subclass of AtlasSprite? The idea is to create a single atlasSprite with different tiles from the tilesheet.
</p></description>
		</item>
		<item>
			<title>vinhsteven on "Dimension of Image problem"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/2347#post-14731</link>
			<pubDate>Thu, 08 Oct 2009 02:50:15 +0000</pubDate>
			<dc:creator>vinhsteven</dc:creator>
			<guid isPermaLink="false">14731@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I have a file with size 560x1100, in which has 88 frames with size 70x100. I create animation for Charactor from these frames. If I use file with size 560x1000, everything OK. But with size 560x1100, when I load Charactor, the frame 70x100 appears 4 frames with size 35x50 in it. Could anyone help me? How could I load a file with size &#62;1024 each dimension? Thanks so much.
</p></description>
		</item>
		<item>
			<title>raina11giv on "AtlasSpriteManager"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/1634#post-10219</link>
			<pubDate>Tue, 01 Sep 2009 06:01:20 +0000</pubDate>
			<dc:creator>raina11giv</dc:creator>
			<guid isPermaLink="false">10219@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Should i remove atlasSpriteManager from my gameScene to avoid memory leaks?<br />
If so why can this piece of code cause crash? </p>
<p>	if (m_atlasMngr) {<br />
		[m_atlasMngr stopAllActions];<br />
		[m_playerSprite stopAllActions];<br />
		[m_atlasMngr removeChild:m_playerSprite cleanup:YES];<br />
		[m_gameScene removeChild:m_atlasMngr cleanup:YES];<br />
		m_atlasMngr = nil;<br />
		m_playerSprite = nil;<br />
	}	</p>
<p>It crashes when i'm trying to remove manager from scene.
</p></description>
		</item>
		<item>
			<title>raegtime on "own component dont work :-("</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/1750#post-10971</link>
			<pubDate>Tue, 08 Sep 2009 12:34:07 +0000</pubDate>
			<dc:creator>raegtime</dc:creator>
			<guid isPermaLink="false">10971@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>hi,</p>
<p>i tryed to create a own GUI component with cocos 2d... i haved written a class (extends Sprite) ... this class initialize with graphics and a lable... if I create an instance of my class .. i  can see my component but i can user any functions... i wrote a setLabel function .. but the lable change... </p>
<p>i create a instance with this code:</p>
<p>drop1 = [DropDown init];</p>
<p>//here I call the function but it dont works :-(<br />
[drop1 setCaption:@"Produkt"];</p>
<p>///dropDown.m:</p>
<p>#<a href='http://www.cocos2d-iphone.org/forum/tags/import'>import</a> "DropDown.h"</p>
<p>@implementation DropDown</p>
<p>@synthesize captionLbl;<br />
+ (id) init<br />
{<br />
	if( (self=[super init] ))<br />
	{<br />
		return [[[self spriteWithFile:@"menue_dropdownbtn.png"] addChild:[[self alloc] initActiveState]] addChild:[[self alloc] initLabel]];<br />
	}<br />
}</p>
<p>- (id)initActiveState<br />
{<br />
	activated = [Sprite spriteWithFile:@"menue_dropactiveated.png"];<br />
	[activated setAnchorPoint:ccp(0,0)];<br />
	[activated setPosition:ccp(173,0)];<br />
	[activated setVisible:NO];<br />
	return activated;<br />
}</p>
<p>- (id)initLabel<br />
{<br />
	captionLbl = [Label labelWithString:@"Text" fontName:@"Arial" fontSize:14.0f];<br />
	[captionLbl setAnchorPoint:ccp(0,0)];<br />
	[captionLbl setPosition:ccp(10,5)];<br />
	[captionLbl setRGB:0 :0 :0];<br />
	return captionLbl;<br />
}</p>
<p>- (void)setCaption:(NSString*)text<br />
{<br />
	[captionLbl setString:text];<br />
	NSLog(@"Hallooooo");<br />
}</p>
<p>- (void)activate<br />
{<br />
	[activated setVisible:YES];<br />
	isActive = YES;<br />
}</p>
<p>- (void)deactivate<br />
{<br />
	[activated setVisible:NO];<br />
	isActive = NO;<br />
}</p>
<p>@end</p>
<p>//  DropDown.h<br />
//</p>
<p>//</p>
<p>#<a href='http://www.cocos2d-iphone.org/forum/tags/import'>import</a> &#60;Foundation/Foundation.h&#62;<br />
#<a href='http://www.cocos2d-iphone.org/forum/tags/import'>import</a> "cocos2d.h"</p>
<p>@interface DropDown : Sprite<br />
{<br />
	BOOL isActive;</p>
<p>	@private<br />
	Sprite* activated;<br />
	Label* captionLbl;</p>
<p>}</p>
<p>@property (nonatomic, retain) Label* captionLbl;</p>
<p>+ (id) init;<br />
- (id)initActiveState;<br />
- (id)initLabel;<br />
- (void)setCaption:(NSString*)text;<br />
- (void)activate;<br />
- (void)deactivate;<br />
@end
</p></description>
		</item>
		<item>
			<title>knaecks on "Creating four AtlasSpriteManagers kills the app"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/2213#post-13888</link>
			<pubDate>Wed, 30 Sep 2009 14:46:13 +0000</pubDate>
			<dc:creator>knaecks</dc:creator>
			<guid isPermaLink="false">13888@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi everyone,</p>
<p>I'm searching for some hours now, reading every thread here, but still finding no solution for my Problem. So I hope you guys can help me killing this bug. :)</p>
<p>I've a character with many different Animations. He walks, he jumps, he idles and so on...<br />
For every animation I got a png file with the Sprite-Atlas and a .plist file with the coordinates of the single images.</p>
<p>Now I wrote a function which generates, for each Sprite-Atlas, a new Manager, a new Sprite and a new SpriteAnimation and stores them in a dictionary, which is the return value of this function.</p>
<p>The function is located in my Singelton Manager Class, so I can call it from all my other Classes to generate a new Animation. So the character, the enemies, the world are calling this function.</p>
<p>The returned dictionary will be added to a Dictionary-Property in these objects and the manager will be added as a child to the layer.</p>
<p>Now everytime I need a specific animation I make the Sprite visible and start its Animation.</p>
<p>Three Animations worked fine in one class but the fourth one kills the app. It starts to stutter very hardly. CPU Usage seems to be 100% but only on the devices, NOT in the simulator.</p>
<p>What can be the problem?<br />
Do I realy need a new Manager for every .png Sprite-Atlas?</p>
<p>Thank you very much,</p>
<p>here is an example call:<br />
<pre><code>[self.animationDict addEntriesFromDictionary:[[Manager defaultManager] generateNewAnimaton:@&#34;walk&#34; capacity:32 image:@&#34;walk.png&#34; delay:0.04f width:71 height:64 seq:@&#34;walk.plist&#34;]];

[self addChild:[animationDict valueForKey:@&#34;walkManager&#34;] z:1];</code></pre>
<p>here's the function:</p>
<pre><code>- (NSMutableDictionary*) generateNewAnimaton: (NSString*)name capacity:(int)capacity image:(NSString*)image delay:(float)delay width:(int)width height:(int)height seq:(NSString*)sequence
{
	animationDict = [NSMutableDictionary dictionary];

	AtlasSpriteManager* manager = [AtlasSpriteManager spriteManagerWithFile:image capacity:capacity];
	AtlasAnimation* animation   = [AtlasAnimation animationWithName:name delay:delay];

	NSDictionary* d = [NSDictionary dictionaryWithContentsOfFile:[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:sequence]];

	NSArray* kList = [[d allKeys] sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)]; 

	for( NSString* key in kList )
	{
		NSDictionary* myDict = [d objectForKey:key];

		NSInteger x = [[myDict valueForKey:@&#34;x&#34;] integerValue];
		NSInteger y = [[myDict valueForKey:@&#34;y&#34;] integerValue];
		NSInteger w = [[myDict valueForKey:@&#34;w&#34;] integerValue];
		NSInteger h = [[myDict valueForKey:@&#34;h&#34;] integerValue];

		[animation addFrameWithRect: CGRectMake( x, y, w, h ) ];
	}

	AtlasSprite* sprite;

	sprite = [AtlasSprite spriteWithRect:CGRectMake( 1, 1, width, height ) spriteManager: manager];

	sprite.visible = false;
	sprite.transformAnchor = CGPointMake( 0, 0 );

	[manager addChild:sprite];

	[animationDict setValue:manager   forKey:[name stringByAppendingString:@&#34;Manager&#34;]];
	[animationDict setValue:animation forKey:[name stringByAppendingString:@&#34;Animation&#34;]];
	[animationDict setValue:sprite    forKey:[name stringByAppendingString:@&#34;Sprite&#34;]];

	return animationDict;
}</code></pre></description>
		</item>

	</channel>
</rss>

