<?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 Posts</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:21:50 +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" 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-99978</link>
			<pubDate>Mon, 20 Jun 2011 08:15:52 +0000</pubDate>
			<dc:creator>codeZero</dc:creator>
			<guid isPermaLink="false">99978@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Sorry, i know already.<br />
<code>[CCSprite spriteWithBatchNode:spriteManager rect:rect]</code>
</p></description>
		</item>
		<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>itlgames on "Newbie: Is the AtlasSpriteManager gone in 0.99.4?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/9751#post-56159</link>
			<pubDate>Tue, 21 Sep 2010 14:58:15 +0000</pubDate>
			<dc:creator>itlgames</dc:creator>
			<guid isPermaLink="false">56159@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I has more functionality, but it should work in the same way.
</p></description>
		</item>
		<item>
			<title>eshirt on "Newbie: Is the AtlasSpriteManager gone in 0.99.4?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/9751#post-56143</link>
			<pubDate>Tue, 21 Sep 2010 13:07:01 +0000</pubDate>
			<dc:creator>eshirt</dc:creator>
			<guid isPermaLink="false">56143@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Sorry to cross-post, but I'm confused about this too.  I posted something about it here <a href="http://www.cocos2d-iphone.org/forum/topic/9729" rel="nofollow">http://www.cocos2d-iphone.org/forum/topic/9729</a> already, but I guess the question is:</p>
<p>Is CCSpriteBatchNode a rename of CCSpriteSheet, or does it have other functionality/limitations?  I can't seem to get it to work the same way as I used AtlasSpriteManager in 0.8.1.
</p></description>
		</item>
		<item>
			<title>itlgames on "Newbie: Is the AtlasSpriteManager gone in 0.99.4?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/9751#post-56100</link>
			<pubDate>Tue, 21 Sep 2010 09:10:07 +0000</pubDate>
			<dc:creator>itlgames</dc:creator>
			<guid isPermaLink="false">56100@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>It's was renamed to CCSpriteSheet, then I think it was renamed again in last version to CCSpriteBatchNode.
</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-55813</link>
			<pubDate>Sun, 19 Sep 2010 16:32:39 +0000</pubDate>
			<dc:creator>itlgames</dc:creator>
			<guid isPermaLink="false">55813@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>ah yeah, makes sense then.
</p></description>
		</item>
		<item>
			<title>huika on "Stuck in v0.8.2 and want to use Zwoptex? Check here"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/7231#post-55806</link>
			<pubDate>Sun, 19 Sep 2010 14:49:16 +0000</pubDate>
			<dc:creator>huika</dc:creator>
			<guid isPermaLink="false">55806@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I think the good use of the rotate feature in zwoptex is to be able to better use all the available space in the 1024x1024 texture. There are some sprites that are too much tall that would better fit if they were rotated. </p>
<p>I also use the free version, so I'm just imagining it's one of the useful things when using it.</p>
<p>See ya!
</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-55803</link>
			<pubDate>Sun, 19 Sep 2010 14:21:36 +0000</pubDate>
			<dc:creator>itlgames</dc:creator>
			<guid isPermaLink="false">55803@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Yeah, I'm stuck in 0.8.2 yet, will try to update at some point, but in the mean time I'm polishing/optimizing my game.<br />
I was using the free online version of zwoptex, no rotation there.<br />
But why do you think we need rotation? Maybe it's only me but I can't think of a good use of rotation on my sprite frames, whenever I need to reuse the same sprite frame in different orientation, I just flip/rotate in run time.
</p></description>
		</item>
		<item>
			<title>Verisutha on "Stuck in v0.8.2 and want to use Zwoptex? Check here"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/7231#post-55798</link>
			<pubDate>Sun, 19 Sep 2010 13:52:12 +0000</pubDate>
			<dc:creator>Verisutha</dc:creator>
			<guid isPermaLink="false">55798@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Not that I use 0.8.2, but I just wanted to point out that zwoptex also supports rotation.</p>
<p>I didn't see it in you code.  Although i could have missed it, and it may be only in the purchased version that it supports rotation.
</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-55796</link>
			<pubDate>Sun, 19 Sep 2010 13:23:08 +0000</pubDate>
			<dc:creator>itlgames</dc:creator>
			<guid isPermaLink="false">55796@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>If anyone was using this class, I recommend update with following code, as it was preventing to use multiple sprite sheets, stupid me used a static class variable to store the frames, so here it goes the new update:</p>
<pre><code>#<a href='http://www.cocos2d-iphone.org/forum/tags/import'>import</a> &#34;cocos2d.h&#34;

@interface SpriteManager : AtlasSpriteManager {
	int formatPlist;
	NSDictionary *frames;
}

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

-(CGRect)createRectangle:(NSString*) imageFileName;
-(AtlasSprite *)createSprite:(NSString*) imageFileName className:(NSString *)className;

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

const int _defaultCapacity = 29;

@implementation SpriteManager

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

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

-(id)initWithFile:(NSString *)fileImage plist:(NSString*)plist capacity:(NSUInteger)capacity
{
	self = [super initWithFile:fileImage capacity:capacity];

	[self createDictionaryFromPlist:plist];

	return self;
}

-(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;] retain];

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

-(CGRect)createRectangle:(NSString*) imageFileName
{
	if(formatPlist == 0) {
		NSDictionary *properties = [frames objectForKey:imageFileName];
		//NSLog(@&#34;SpriteManager.createSprite: %@&#34;, properties);

		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];

		return CGRectMake(x, y, w, h);

	} else if (formatPlist == 1) {
		NSDictionary *properties = [frames objectForKey:imageFileName];
		//NSLog(@&#34;SpriteManager.createSprite: %@&#34;, properties);

		CGRect frame = CGRectFromString([properties objectForKey:@&#34;frame&#34;]);
		//CGPoint offset = CGPointFromString([properties objectForKey:@&#34;offset&#34;]);
		//CGSize sourceSize = CGSizeFromString([properties objectForKey:@&#34;sourceSize&#34;]);

		return frame;

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

-(AtlasSprite *)createSprite:(NSString*) imageFileName;
{
	return [AtlasSprite spriteWithRect:[self createRectangle:imageFileName] spriteManager:self];
}

-(void) dealloc {
	[frames release];
	[super dealloc];
}

@end</code></pre>
<p>If any problems please let me know.
</p></description>
		</item>
		<item>
			<title>itlgames on "AtlasSprite draw method"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/1023#post-55740</link>
			<pubDate>Sun, 19 Sep 2010 00:20:20 +0000</pubDate>
			<dc:creator>itlgames</dc:creator>
			<guid isPermaLink="false">55740@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Ok, forget my question, managed to alter the <strong>draw</strong> method on the <strong>AtlasSpriteManager</strong>.
</p></description>
		</item>
		<item>
			<title>itlgames on "AtlasSprite draw method"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/1023#post-55720</link>
			<pubDate>Sat, 18 Sep 2010 22:36:05 +0000</pubDate>
			<dc:creator>itlgames</dc:creator>
			<guid isPermaLink="false">55720@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi, sorry to jump on this old thread, but I am trying to do exactly the same, I'm finally porting all my sprites to a sprite sheet, before on my sprites subclass I overwrote the draw method so I could draw a bouncing box around, note I'm working with isometric so the default cocos2d debug bouncing box is not what I needed, I do draw an isometric 3d rectangle enclosing my objects so I could debug the collision and stuff, like the image:</p>
<p><img src="http://www.itlgames.com/trace.jpg" alt="" /></p>
<p>So Steve, are you saying this is not possible to do? I am stuck on 0.8.2 so using old AtlasManager / AtlasSprite.
</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-47432</link>
			<pubDate>Fri, 23 Jul 2010 11:10:54 +0000</pubDate>
			<dc:creator>itlgames</dc:creator>
			<guid isPermaLink="false">47432@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Cool, let me know if you have any problems.
</p></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>agorsky on "Stuck in v0.8.2 and want to use Zwoptex? Check here"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/7231#post-45483</link>
			<pubDate>Fri, 09 Jul 2010 13:58:06 +0000</pubDate>
			<dc:creator>agorsky</dc:creator>
			<guid isPermaLink="false">45483@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>thanks<br />
i try that now. I have same constraints, stucked in 0.82 and i updated to 0.99 but had lot of performance problems. So get back to 0.82.
</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-42495</link>
			<pubDate>Sun, 20 Jun 2010 09:28:47 +0000</pubDate>
			<dc:creator>itlgames</dc:creator>
			<guid isPermaLink="false">42495@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Ok, found an easy solution, using Zwoptex just be sure before exporting the texture/coordinates, you untrim all images, select all images, then go to Modify &#62; Untrim Selected Images.<br />
Basically Zwoptex trim by default any 100% transparent border left on the images, and adds the offsets. If we untrim all images, then offsets will be zero, so we can just use the code I posted above. Remember use the updated SpriteManager.m on the third post, where we ignore the offsets.
</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-42424</link>
			<pubDate>Sat, 19 Jun 2010 21:07:10 +0000</pubDate>
			<dc:creator>itlgames</dc:creator>
			<guid isPermaLink="false">42424@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Ok, I figured out the problem, I need to draw the sprite on the x/y coordinates plus the x/y offsets. So I guess I need to create a category of Sprite again to add the offsets when drawing. It's actually what id does the CCSprite in v0.99.3 I think.
</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-42420</link>
			<pubDate>Sat, 19 Jun 2010 19:38:12 +0000</pubDate>
			<dc:creator>itlgames</dc:creator>
			<guid isPermaLink="false">42420@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Sorry, just to update we do need to use the offset and the original size as well, not sure yet how, tryign to figure out. Will psot update as soon as I am 100% sure. Or if anyone has an idea, please share!
</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-42415</link>
			<pubDate>Sat, 19 Jun 2010 19:20:19 +0000</pubDate>
			<dc:creator>itlgames</dc:creator>
			<guid isPermaLink="false">42415@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Umm, I may be wrong, but I think we can ignore the offset, definitively I dind't need it on my first tests:</p>
<p>SpriteManager.m:<br />
<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];
		AtlasSprite *sprite = [AtlasSprite spriteWithRect:CGRectMake(x, y, 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></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-42414</link>
			<pubDate>Sat, 19 Jun 2010 19:15:59 +0000</pubDate>
			<dc:creator>itlgames</dc:creator>
			<guid isPermaLink="false">42414@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I just added the offsets as well, as I forgot, not 100% sure it's right to be honest, need to do some more testing, but I think it should be fine.</p>
<p>And in case you don't know Zwoptex, check here:<br />
<a href="http://zwoptexapp.com/" rel="nofollow">http://zwoptexapp.com/</a>
</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>SwizzerSweet on "Connection between AtlasAnimation and AtlasSpriteManager?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/186#post-27636</link>
			<pubDate>Mon, 22 Feb 2010 17:39:48 +0000</pubDate>
			<dc:creator>SwizzerSweet</dc:creator>
			<guid isPermaLink="false">27636@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Animation Documentation is a weakness in the docs right now, I'll see what I can cook up eventually.
</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-26660</link>
			<pubDate>Sun, 14 Feb 2010 19:54:04 +0000</pubDate>
			<dc:creator>edge17</dc:creator>
			<guid isPermaLink="false">26660@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Thanks, that's the function I was trying to use. It kept crashing, but that's because I didn't realize you have to call addAnimation manually. Thanks for your help!</p>
<p>Is there any particular reason why, when you animate a sprite, the animation isn't automatically added to the animation dictionary in AtlasSprite? If I'm animating a sprite, I would intuitively think that the animation should be added automatically.</p>
<pre><code>AtlasSpriteManager *mgr = [AtlasSpriteManager spriteManagerWithFile:@&#34;spritesheet.png&#34; capacity:100];
[self addChild:mgr z:0 tag:101];

AtlasSprite *sprite = [AtlasSprite spriteWithRect:CGRectMake(0, 205, 50, 44) spriteManager: mgr];

AtlasAnimation *animation = [AtlasAnimation animationWithName:@&#34;run3&#34; delay:0.06f];
for(int i=0;i&#60;8;i++) {
	int x= i % 5;
	int y= 1;
	[animation addFrameWithRect: CGRectMake(x*50, y*205, 50, 44) ];
}
[sprite addAnimation:animation];
[mgr addChild:sprite z:1 tag:102];</code></pre></description>
		</item>
		<item>
			<title>gaminghorror on "Possible to always make sprite animation complete on last frame?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/4470#post-26642</link>
			<pubDate>Sun, 14 Feb 2010 15:48:08 +0000</pubDate>
			<dc:creator>gaminghorror</dc:creator>
			<guid isPermaLink="false">26642@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Can't you just use a method like</p>
<pre><code>-(void) setDisplayFrame: (NSString*) animationName index:(int) frameIndex</code></pre>
<p>to set the "resting" animation when the sprite stops?</p>
<p>But i assume you want the action to run until end when the sprite stops, is that it? In that case don't call stopAllActions but wait till the animation is done (i'm not sure if there are ways to find this out). Or stopAllActions and then restart the animation again but with the current frame of the animation as starting frame and without looping the animation. But i don't know if CCSprite supports any of this, as i haven't worked with animations much yet.
</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>edge17 on "Connection between AtlasAnimation and AtlasSpriteManager?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/186#post-26589</link>
			<pubDate>Sun, 14 Feb 2010 00:39:43 +0000</pubDate>
			<dc:creator>edge17</dc:creator>
			<guid isPermaLink="false">26589@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I know this is a pretty old thread, but I've got the same question. I'm pretty new to Cocos2d (but not to ObjC, etc). Could someone please explain this to me. What's the connection between AtlasAnimation and AtlasSpriteManager?
</p></description>
		</item>
		<item>
			<title>carolight on "Create Animation using AtlasSpriteManager"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3109#post-26043</link>
			<pubDate>Tue, 09 Feb 2010 03:21:41 +0000</pubDate>
			<dc:creator>carolight</dc:creator>
			<guid isPermaLink="false">26043@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Perhaps it's because it's now called CCSpriteSheet?</p>
<p>Read the 0.99 notes, and they will tell you about the Sprite / AtlasSprite merge:</p>
<p><a href="http://www.cocos2d-iphone.org/wiki/doku.php/release_notes:0_99_0_rc" rel="nofollow">http://www.cocos2d-iphone.org/wiki/doku.php/release_notes:0_99_0_rc</a>
</p></description>
		</item>
		<item>
			<title>arutema on "Create Animation using AtlasSpriteManager"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3109#post-25944</link>
			<pubDate>Mon, 08 Feb 2010 09:30:41 +0000</pubDate>
			<dc:creator>arutema</dc:creator>
			<guid isPermaLink="false">25944@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>why i cant declare AtlasSpriteManager in my project i am using 9 version
</p></description>
		</item>
		<item>
			<title>Anny on "AtlasSpriteManager inside NSArray, workable?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3367#post-20697</link>
			<pubDate>Thu, 10 Dec 2009 21:49:33 +0000</pubDate>
			<dc:creator>Anny</dc:creator>
			<guid isPermaLink="false">20697@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Ok. It turns out that the thing was working perfectly. My mistake was loading a black sprite onto the default black background.</p>
<p>FML.
</p></description>
		</item>

	</channel>
</rss>

