<?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: AtlasSprite - Recent Topics</title>
		<link>http://www.cocos2d-iphone.org/forum/tags/atlassprite</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:58 +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/atlassprite/topics" rel="self" type="application/rss+xml" />

		<item>
			<title>j2sighte on "How to set a mask on a Sprite/AtlasSprite Object?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3025#post-18704</link>
			<pubDate>Mon, 16 Nov 2009 13:57:18 +0000</pubDate>
			<dc:creator>j2sighte</dc:creator>
			<guid isPermaLink="false">18704@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I want to set a mask on a Sprite/AtlasSprite Object, so that it just appears in a defined area. I remember UIImage has a function called :setMask. Does there any way that Sprite/AtlasSprite object can do the similar thing?</p>
<p>Thanks!
</p></description>
		</item>
		<item>
			<title>Dunc on "Masks / Progress bars"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/4545#post-27037</link>
			<pubDate>Wed, 17 Feb 2010 16:57:43 +0000</pubDate>
			<dc:creator>Dunc</dc:creator>
			<guid isPermaLink="false">27037@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi all,</p>
<p>I've only been using cocos2d for just over a week now, but I'm very impressed with it so far.  Great community, and I haven't had to do too much surfing to find the answers to my problems so far. However, I've just run into my first dead end... </p>
<p>I am trying to work out how to implement a timer bar for a game I'm working on.  The timer bar needs to be round-ended, and needs to float above the main game layer (ie, sprites can pass behind it).  So I need to somehow create a mask to clip the timer bar sprite to this round-ended shape.</p>
<p>I have searched for solutions, but most seem to relate to rectangular progress bars.  Also, I cant really afford too much in the way of framerate loss, as I have a fair amount of sprites running around.</p>
<p>Can anyone nudge me in the right direction?  I would be eternally grateful ....</p>
<p>Cheers,</p>
<p>D.
</p></description>
		</item>
		<item>
			<title>Jamil on "Scrolling Background"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/485#post-2864</link>
			<pubDate>Mon, 06 Jul 2009 01:41:04 +0000</pubDate>
			<dc:creator>Jamil</dc:creator>
			<guid isPermaLink="false">2864@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hello, newbie here, I've trying searching up and finding as many answers as I can so I don't ask dumb questions but this is one I'm still not sure of. I want to make like a top down view game and basically the ground is larger than the screen so there should be the ability to scroll around. What's the best way to do that?</p>
<p>I've done something like this in the past as a java project. What I did there was have like a "camera" point, all the sprites' positions would be changed as normal, but when drawing, they would be drawn by subtracting their position from the camera so I would get the view I want on screen. I saw a camera point in the CocosNode but don't know if it should be used the same way.</p>
<p>Thanks for your help
</p></description>
		</item>
		<item>
			<title>Bosstone on "Detect which Button has been pressed?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/11531#post-65182</link>
			<pubDate>Tue, 30 Nov 2010 16:35:33 +0000</pubDate>
			<dc:creator>Bosstone</dc:creator>
			<guid isPermaLink="false">65182@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi Folks,</p>
<p>I am new into Cocos2D and I am wondering how to add a Number to a CCMenuItemImage to fetch the button which has been pressed?</p>
<p>I am looping from 1 to 20 and adding images to my view like this:</p>
<pre><code>CCMenu *menu;
		for (i=0; i &#60; count; i++ ){

			if ((i != 0) &#38;&#38; (i % 4 == 0)) row += 1;

		CCMenuItemImage *button = [CCMenuItemImage itemFromNormalImage:@&#34;winziback.png&#34;
														 selectedImage:@&#34;winzi1.png&#34;
																target:self
															  selector:@selector(showSideMenu:)];

		x = (i % 4) * 75 + 100;
		NSLog(@&#34;x = %d&#34;, x);
		y = row * 75;

		menu = [CCMenu menuWithItems:button, nil];
		button.position = ccp(x-211, y-135);
		[self addChild:menu];

		}</code></pre>
<p>Here I log the pressing:</p>
<pre><code>- (void) showSideMenu: (CCMenuItem  *) menuItem
{
	NSLog(@&#34;The first menu was called&#34;);
}</code></pre>
<p>Thanks for any help and advice!</p>
<p>BR,</p>
<p>Stefan
</p></description>
		</item>
		<item>
			<title>JohnM on "Low Resolution Display on Iphone 4"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/9685#post-55705</link>
			<pubDate>Sat, 18 Sep 2010 20:19:52 +0000</pubDate>
			<dc:creator>JohnM</dc:creator>
			<guid isPermaLink="false">55705@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi,</p>
<p>I would like to run my game in low resolution (480x320) mode on Iphone 4.</p>
<p>I have following questions:<br />
<strong>1.</strong> Does Iphone 4 display this low resolution clearly?<br />
I know when we change resolution on LCD monitor, picture is not clear.</p>
<p>What are your experiences, is graphics clear or blurry?</p>
<p>I would like to avoid creating 2 graphics in game, as it takes more time and space in final build.</p>
<p>However, if it results in poor display, I will need to do support it.</p>
<p>Thanks in advance
</p></description>
		</item>
		<item>
			<title>Osiris on "Looking for animation examples"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/1681#post-10551</link>
			<pubDate>Thu, 03 Sep 2009 14:14:12 +0000</pubDate>
			<dc:creator>Osiris</dc:creator>
			<guid isPermaLink="false">10551@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Im looking through the example code and the discussions here and I'm not finding many examples on creating sprite animation.  A nudge in the right direction would be helpful.  I know atlas is better than than just sprites, but my animator sent me a series of 12 images that should go in to a tumbling powerUp and I thought I knew how to pull them easily into an animation - I was wrong :)
</p></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>XyrisKenn on "Separating out game piece classes with Box2D"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/2535#post-15824</link>
			<pubDate>Sun, 18 Oct 2009 15:32:08 +0000</pubDate>
			<dc:creator>XyrisKenn</dc:creator>
			<guid isPermaLink="false">15824@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi, </p>
<p>I'm trying to separate my Box2D game elements (Cocos2D 0.8.2) from the main game scene in Obj-C, but have been coming up against a wall for the last week trying to solve this. I hope someone can identify something I'm missing.</p>
<p>I'm trying to have touch and Box2D specs for player pieces in their own class, and have them plug into to the b2 game world in 'Game.m':</p>
<p>--------<br />
Test.h:</p>
<pre><code>#<a href='http://www.cocos2d-iphone.org/forum/tags/import'>import</a> &#60;Foundation/Foundation.h&#62;
#<a href='http://www.cocos2d-iphone.org/forum/tags/import'>import</a> &#34;Box2D.h&#34;

@class Game; // referencing the main game layer class

@interface Test : NSObject {
	@private
		Game *game;
		b2World *world;
		b2Body *body;
		b2BodyDef *bodyDef;
		b2CircleDef *shapeDef;
}

- (void)addPiece:(Test *)aTest;

@property (nonatomic, retain) Game *game;

@property (nonatomic, assign) b2Body *body;

@property (nonatomic, assign) b2BodyDef *bodyDef;

@property (nonatomic, assign) b2CircleDef *shapeDef; // keep getting &#34;error:&#39;shapeDef&#39; was not declared in this scope.

@end</code></pre>
<p>Test.mm:</p>
<pre><code>#<a href='http://www.cocos2d-iphone.org/forum/tags/import'>import</a> &#34;Test.h&#34;     //error: ISO C++ forbids declaration of &#39;b2CircleDef&#39; with no type
#<a href='http://www.cocos2d-iphone.org/forum/tags/import'>import</a> &#34;Game.h&#34;

@implementation Test

- (void)dealloc {
	delete bodyDef;
	delete shapeDef;
	[self setBody:nil];
	[self setBodyDef:nil];
	[self setShapeDef:nil];
	[super dealloc];
}

- (id)init {
	if(self = [super init]) {
		[self setBodyDef:new b2BodyDef];
		[self setShapeDef:new b2CircleDef];
		[self shapeDef]-&#62;density = 2.0f;
		[self shapeDef]-&#62;restitution = 0.75f;
		[self m_radius:32.0f];
	}
	return self;
}

- (void)addPiece {

	[super addPiece];

	[self setBody:[[self game] world]-&#62;CreateBody([self bodyDef])];
	[self body]-&#62;SetFixture([self shapeDef]);
	//[self body]-&#62;SetUserData((void) *)self); // haven&#39;t added atlasSprite code yet

}

@synthesize game;

@synthesize body;

@synthesize bodyDef;

@synthesize shapeDef;

@end</code></pre>
<p>'Game.h' has @class Test stated<br />
'Game.mm' has #<a href='http://www.cocos2d-iphone.org/forum/tags/import'>import</a> "Test.h"</p>
<p>Thanks for any help.
</p></description>
		</item>
		<item>
			<title>Wayfarer on "Confusion on Sprites"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/8423#post-48898</link>
			<pubDate>Tue, 03 Aug 2010 19:27:54 +0000</pubDate>
			<dc:creator>Wayfarer</dc:creator>
			<guid isPermaLink="false">48898@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Alright, so I am just so confused.  I've read a lot, but so far I haven't figured out how I should do sprites in my game.  From what I gather, I have 3 options,</p>
<p>CCSprite<br />
Atlas Sprites<br />
Sprite Sheets</p>
<p>However, when I was starting my new project, I was given a warning saying:</p>
<p><code>CCSpriteSheet *sheet; //This is deprecated</code></p>
<p>Well, in that case I can't use that.  Which must mean Atlas Sprites are the way to go.  But in the cocos2D test project, I didn't see the AtlasSpriteTest at all... and looking at some other tests (like the touches test) they just create a CCSprite using the Texture Cache.</p>
<p>So I am very confused at this point.  What is the best practice for making Sprites?  I've been using CCSprite for a while, but if Atlas Sprites are the better decision, where did the test file go?  Where can I learn about them to use them, because I don't know where to start.  Thanks.
</p></description>
		</item>
		<item>
			<title>JohnM on "IPhone and IPod Touch memory"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/7845#post-45895</link>
			<pubDate>Mon, 12 Jul 2010 19:06:33 +0000</pubDate>
			<dc:creator>JohnM</dc:creator>
			<guid isPermaLink="false">45895@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi,</p>
<p>I have 5 spritesheets, each of 1024x1024 size, with 16bit graphics. All graphics will be in memory at same time.</p>
<p>1. How much IPhone 3G has available memory for graphics? So I am asking for slowest Iphone model and IPod 2nd generation.<br />
2. Will I have an issue since graphics is spread out on 5 large spritesheets. </p>
<p>Thanks
</p></description>
		</item>
		<item>
			<title>JohnM on "Graphics preparing for tmx map"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/7702#post-45073</link>
			<pubDate>Wed, 07 Jul 2010 10:01:15 +0000</pubDate>
			<dc:creator>JohnM</dc:creator>
			<guid isPermaLink="false">45073@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi,</p>
<p>Making graphics for tmx maps can be teddious job.<br />
Moreover, I have read that some artifacts can happen.<br />
For example, we have tile size 32x32.</p>
<p>I have read that graphics picture must be adjusted, so that actuall size will be 34x34 and this one pixel from each side is added to prevent artifacts in game.<br />
1. How to prepare graphics for tmx map. Is there some easy solution? For example I have graphics in texture 1024x1024. Is there some way to automatically fix it?<br />
2. Do I have to manually edit each tile in png graphics and add this 1 pixel (so that I copy neighbouring pixels) or there is some automatic way to do it easily. If all has to be done manualy, it is painful process.<br />
3. This above questions were for game background. What about with sprites that are not part of tmx map graphcis? Are they also need to be fixed same way?</p>
<p>As far as I understand, this is very painfull process in preparing graphics for the game.<br />
Could you give some guidance in this and enlight the way how to do it?</p>
<p>Thanks
</p></description>
		</item>
		<item>
			<title>edge17 on "CCSpriteSheet and zOrdering"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/6986#post-41000</link>
			<pubDate>Wed, 09 Jun 2010 21:37:25 +0000</pubDate>
			<dc:creator>edge17</dc:creator>
			<guid isPermaLink="false">41000@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I've been reading a lot of threads and come across lots of great info, but haven't been able to come up with a workable solution.</p>
<p>I have sprites from 2 different sprite sheets which need to be ordered in relation to eachother. Since they're children of different nodes, i'm going to have z-ordering issues.</p>
<p>Everything was fine initially because I was using normal CCSprites, not CCSpriteSheets but was having severe performance issues. The performance issues got addressed by porting everything to the CCSpriteSheet, but now I have ordering issues :)</p>
<p>According to this site -<br />
<a href="http://allseeing-i.com/Performance-tips-for-Cocos2d-for-iPhone" rel="nofollow">http://allseeing-i.com/Performance-tips-for-Cocos2d-for-iPhone</a></p>
<p>I can play around with the vertexZ property in a CCNode to affect the actual render order of the sprites, but I'm guessing this isn't recommended. I don't have any weird transparency though. (I did try to play with changing the vertexZ of a few random sprites, but it didn't appear to actually do anything)</p>
<p>My question is, given the ordering requirement I have, what are (if any) my options besides using CCSprites or CCSpriteSheets? If it makes any difference, I'm using v0.99.3 of cocos2d. I haven't really explored AtlasSprites yet, mainly because I don't think I understand how they differ from CCSpriteSheets.</p>
<p>As always, thanks in advance!
</p></description>
		</item>
		<item>
			<title>foogy on "Weird performance problem with CCTextureAtlas"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/5805#post-34525</link>
			<pubDate>Sun, 18 Apr 2010 19:45:24 +0000</pubDate>
			<dc:creator>foogy</dc:creator>
			<guid isPermaLink="false">34525@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I'm using 0.99.2-RC on iPad (Device).<br />
I have only one big texture (2048x2048) in a CCTextureAtlas.</p>
<p>If I setDisplayFPS to draw FPS the game run at 50-60fps.<br />
The weird thing now: if I don't setDisplayFPS, the frame rate drop radically, Instrument give me 15-20fps.</p>
<p>I'm trying ton pin point how drawing the FPS on the screen can make such a difference in the frame rate.<br />
I checked out drawNumberOfQuads... can it be related to VBO?<br />
I tried to disable CC_TEXTURE_ATLAS_USES_VBO, but I get around 25fps, so VBO is definitely the way to go, in my case at least.
</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>db82 on "setColor / opacity bug"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3888#post-23271</link>
			<pubDate>Thu, 14 Jan 2010 14:54:41 +0000</pubDate>
			<dc:creator>db82</dc:creator>
			<guid isPermaLink="false">23271@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi</p>
<p>When I use setColor on an AtlasSprite the colour changes fine.</p>
<p>But if I then apply opacity to the sprite, the sprite reverts back to it's original color.</p>
<p>This only happens on the iphone, I don't get this bug when running in the simulator.</p>
<p>Can anyone help with this?</p>
<p>I'm using cocos2d 0.8.2</p>
<p>Thanks for any help!
</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>jrtb on "Random PNG borders with transparent AtlasSprites"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/4306#post-25727</link>
			<pubDate>Sat, 06 Feb 2010 15:12:06 +0000</pubDate>
			<dc:creator>jrtb</dc:creator>
			<guid isPermaLink="false">25727@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi all :)</p>
<p>I've got a problem I'm hoping you can help with. I'm using Cocos2d<br />
0.8.2 and rendering 10 AtlasSprites with a common AtlasSpriteManager.<br />
As you can see from this screenshot (taken from an iPhone), 9<br />
of the butterflies render with correct transparency. </p>
<p><img src="http://jrtb.com/photo-19.jpg" /></p>
<p>The 10th renders with a border. Sometimes the number with a border is greater. It's<br />
unpredictable.</p>
<p>I've read through the FAQ on this and have applied all the suggestions in it at:<br />
<a href="http://www.cocos2d-iphone.org/wiki/doku.php/faq#my_png_doesn_t_look_like_in_photoshop" rel="nofollow">http://www.cocos2d-iphone.org/wiki/doku.php/faq#my_png_doesn_t_look_like_in_photoshop</a><br />
But without any success. I can make all of them have borders by using:<br />
[sprite setBlendFunc: (ccBlendFunc) { GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA }];<br />
The core issue that I wanted to get your input on is why it would<br />
render 9 of them correctly and the 10th with a border, all other<br />
things being equal.</p>
<p>Is there a known issue that would cause this and that I can correct?</p>
<p>Thanks! :)</p>
<p>James
</p></description>
		</item>
		<item>
			<title>sunshineDev on "Loading my Sprites is taking too long"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/4009#post-24022</link>
			<pubDate>Fri, 22 Jan 2010 22:06:50 +0000</pubDate>
			<dc:creator>sunshineDev</dc:creator>
			<guid isPermaLink="false">24022@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi everyone,</p>
<p>I am having issues when I first load my sprites. I am using about 30 8bit PNGs. The problem is that the part of the application that uses Cocos2d is not the main view, it is contained within another view that loads after the user navigates to it.</p>
<p>The application behaves perfectly in the simulator, but when I go to test on the device, it takes a long time when I first navigate to it. After that, everything is fine.</p>
<p>Any ideas on what I can do to solve this issue?</p>
<p>Thanks in advance!
</p></description>
		</item>
		<item>
			<title>iphonemobdev on "Slowdown problem with game on iPhone 3G"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3850#post-23041</link>
			<pubDate>Tue, 12 Jan 2010 08:44:29 +0000</pubDate>
			<dc:creator>iphonemobdev</dc:creator>
			<guid isPermaLink="false">23041@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi,</p>
<p>I just finished one game and it works fine but having one problem with FTP. I am getting 38-42 FPS constantly but some times it goes down to 15-20 FPS for 2-3 seconds and return to normal fps. It doesn't have any problem on iPod Touch but i am getting this problem on iphone. </p>
<p>First i have developed game without sprite-sheet and there was no problem that time. then i used sprite-sheet in project and then after i am getting this problem. So did i missed something related to remove all the atlassprite or clean up atlasmanager.</p>
<p>Anyone has idea about this.</p>
<p>Rgds,<br />
Iphone Dev.
</p></description>
		</item>
		<item>
			<title>Obiwahn on "AtlasSprite Scale Performance"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3839#post-22994</link>
			<pubDate>Mon, 11 Jan 2010 21:19:39 +0000</pubDate>
			<dc:creator>Obiwahn</dc:creator>
			<guid isPermaLink="false">22994@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi there,</p>
<p>is there any decent impact on performance in using scaled AtlasSprites, if any? I.e. is it much slower if I use sprites that are scaled to 0.8 than 1.0 scaled sprites.</p>
<p>Background: I have enemies of different size but the same texture. I wonder if it is necessary to have a seperate texture (i.e. 128x128 and 32x32 of the same image) for my enemies or if I can be lazy and just use one big image.
</p></description>
		</item>
		<item>
			<title>svk on "RenderTexture vs AtlasSprite"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3846#post-23025</link>
			<pubDate>Tue, 12 Jan 2010 05:47:03 +0000</pubDate>
			<dc:creator>svk</dc:creator>
			<guid isPermaLink="false">23025@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi all.<br />
Somebody probably has already asked such question, but I failed to find it.<br />
What I need to do is create holes in objects in runtime. I was planning to do this using RenderTexture. But my objects are implementet as AtlasSprite. So I'm interested how can I use AtlasSprite with RenderTexture? It's clear for me how it works with Sprites (begin - [sprite visit] - end). But AtlasSprite doesn't have draw function implemented since it is drawn by its manager. Should I render whole AtlasSpriteManager into RenderTexture?<br />
I guess this will resolve my problem, but I'm afraid of performance in this case - AtlasSpriteManager can be quite big in my game...</p>
<p>Any ideas?<br />
Thanks in advance.
</p></description>
		</item>
		<item>
			<title>laxcat on "Alternative to Sprites for 2000+ On-screen Animations"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3236#post-20027</link>
			<pubDate>Tue, 01 Dec 2009 20:26:08 +0000</pubDate>
			<dc:creator>laxcat</dc:creator>
			<guid isPermaLink="false">20027@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I'm working on an app for a client that takes your photo and does what is essentially a mosaic effect. We were then planning on performing dynamic animations to transition these "blocks" in and out of the screen. The problem is there are 2400 of them (the image mosaic is 40 x 60 blocks), and my edge phone just can't quite handle 2400 atlas animations at once. (It drops to 5fps or so.)</p>
<p>The obvious solutions would be to either reduce the number of blocks (sprites), or to perform an animation that doesn't require each of the 2400 objects to be unique. Unfortunately changing the resolution is not a great option at this point. (Read: the client has demanded it.) Changing the app so it doesn't require unique animations for each block is possible but not ideal. Our team really likes the animation effect. (It runs fine on a 3GS!) And even more than that we like the flexibility of the atlasanimation, allowing us to possibly come up with other animations easily.</p>
<p>So here's the question. Looking at what's possible with particle systems and other apps out there, it seems that what we want should be possible, but the atlassprite/atlasanimation system (and maybe even cocos2d) is probably just not designed for it. What are some other things within cocos2d that I should be looking at? Is there a way to maybe batch some of these calls together a little bit? Should I be using something other than atlassprites/atlasanimations? Would the particle system even be an option?</p>
<p>Some more info:<br />
• I've done a couple of iPhone apps at this point, but I'm still super new to Objective-C and this is my first time working with cocos2d.<br />
• There are technically only 15 unique animations, because there are only 15 different colors of blocks. Could there be a way to leverage that to fewer graphics calls?</p>
<p>Thanks in advance!
</p></description>
		</item>
		<item>
			<title>Kevin on "How to track extra data with an AtlasSprite"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3671#post-22133</link>
			<pubDate>Fri, 01 Jan 2010 01:29:08 +0000</pubDate>
			<dc:creator>Kevin</dc:creator>
			<guid isPermaLink="false">22133@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I am new to Cocos2d and am having problems with one concept. In my game I have pieces scrolling across the screen that the player can grab. This part is easy. I randomly spawn a piece and scroll it with an action. The problem is figuring out what piece the user grabbed. My gut said subclass AtlasSprite but the AtlasSpriteManager wouldn't take the subclass as a child. Am I doing something wrong and/or what is the recommend way to track data about an AtlasSprite?
</p></description>
		</item>
		<item>
			<title>pgb on "Pause and resume animation"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3539#post-21514</link>
			<pubDate>Tue, 22 Dec 2009 12:47:15 +0000</pubDate>
			<dc:creator>pgb</dc:creator>
			<guid isPermaLink="false">21514@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi,<br />
In my game, I have several AtlasSprites and AtlasAnimations.</p>
<p>I need to be able to save the state of the game, and later resume it, but I can't find a way to get the current frame of the AtlasAnimation, in order to later restore it.</p>
<p>Is this possible to do? How is everyone else handling this case?
</p></description>
		</item>
		<item>
			<title>CJ on "Wondering why using a SpriteSheet makes no difference in performance... (0.9tr)"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3385#post-20810</link>
			<pubDate>Sat, 12 Dec 2009 05:15:29 +0000</pubDate>
			<dc:creator>CJ</dc:creator>
			<guid isPermaLink="false">20810@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Well I was all excited because I managed to jam literally every graphic for a given level into a single texture so now I can just have one SpriteSheet with many atlas sprites as children and reap all the performance benefits thereof...</p>
<p>Or so I thought...</p>
<p>After scratching my head for a few hours and tweaking things, I cannot get the atlas version to perform any better than the non atlas version.</p>
<p>So I made a test project using the Cocos template and just swapped in this code for the HelloWorld's init:</p>
<pre><code>- (id) init
{
	self = [super init];
	if(self != nil){
		BOOL useAtlas						= NO;
		NSUInteger numSprites				= 256;
		CCTexture2D *spriteTexture			= [[CCTextureCache sharedTextureCache] addImage:@&#34;Default.png&#34;];
		CCNode *spriteSheet					= [CCSpriteSheet spriteSheetWithTexture:spriteTexture capacity:numSprites];
		[self addChild:spriteSheet];
		if(!useAtlas){
			[self removeChild:spriteSheet cleanup:YES];
			spriteSheet						= self;
		}

		CCSprite *aButton;
		float mnX	= 40.0f;
		float anY	= 40.0f;
		float incX	= 10.0f;
		float incY	= 10.0f;
		float anX	= mnX;
		CGRect texRect	= CGRectMake(0.0f, 160.0f, 80.0f, 80.0f);
		for(int i=1; i&#60;=numSprites; i++){
			if(useAtlas){
				aButton		= [[(CCSpriteSheet *)spriteSheet createSpriteWithRect:texRect] retain];
			}else{
				aButton		= [[CCSprite alloc] initWithTexture:spriteTexture rect:texRect];
			}
			aButton.position					= ccp(anX, anY);
			[spriteSheet addChild:aButton];

			[aButton release];
			anX	+= incX;
			if(anX &#62;= 280.0f){
				anX	= mnX;
				anY += incY;
			}
		}
	}
	return self;
}</code></pre>
<p>And if I toggle the value of useAtlas to YES I get the same FPS. I really think I should be getting 60fps with this number of sprites all being rendered in batch, but both cases render at around 12-15fps on the device. Lowering the number of sprites brings up the frame rate as expected, BUT it changes by the same amount whether using the atlas or just parenting under the layer.</p>
<p>Notes:<br />
 - Toggling Compile for Thumb makes no difference<br />
 - Toggling compress PNG makes no difference</p>
<p>Please if you see anything striking that I missed, point it out :) I have just recently switched to the new 0.9 api so I may have missed something with the new AtlasSprite -&#62; CCSprite transition.
</p></description>
		</item>
		<item>
			<title>bdittmer on "CCSprite child &quot;lags&quot; behind parent (.9-beta)"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3432#post-21035</link>
			<pubDate>Tue, 15 Dec 2009 15:10:10 +0000</pubDate>
			<dc:creator>bdittmer</dc:creator>
			<guid isPermaLink="false">21035@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hey all, I just upgraded a project to .9-beta and immediately went to test out the SpriteSheet grandchildren functionality.  I was able to get the child added, but when I start animating &#38; moving the parent (there is an animation and MoveTo action running on it) the child seems to "lag" behind it, e.g. the position on the child isn't updating quickly enough so it doesn't look like a static element attached to is parent (this is for a health bar).  This is happening in the 3.1.2 simulator and I have not tried it on the device yet.  Below is the relevant code:</p>
<p>(Inside my Enemy class, which subclasses CCSprite)</p>
<p>	healthBar = [CCSprite spriteWithTexture:self.spriteSheet.texture rect:[[CCSpriteFrameCache sharedSpriteFrameCache] rectByName:@"healthbar1.png"]];<br />
	healthBar.anchorPoint = ccp(0,0);<br />
	healthBar.position = ccp(-10,0);</p>
<p>	healthBar.honorParentTransform &#38;= ~CC_HONOR_PARENT_TRANSFORM_ROTATE;<br />
	healthBar.honorParentTransform &#38;= ~CC_HONOR_PARENT_TRANSFORM_SCALE;</p>
<p>	[self addChild:healthBar z:1];</p>
<p>The rectByName: method on CCSpriteFrameCash is something I added as a convenience method.  Any help is most appreciated!
</p></description>
		</item>
		<item>
			<title>Talisman on "Changing directions whilst JumpBy"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/3202#post-19782</link>
			<pubDate>Sun, 29 Nov 2009 13:53:37 +0000</pubDate>
			<dc:creator>Talisman</dc:creator>
			<guid isPermaLink="false">19782@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I am quite a newbie to Cocos2D so please bear with me. It seems that I'm missing some basic understanding of actions. I searched this and other forums for days now but just couldn't find the missing link. Here's what I'm trying to do.</p>
<p>I have a main character (==AtlasSprite) who does a leap whenever he hits a platform (==Tile in a Tilemap). He should "ignore" the platforms while jumping UP, but react to platforms when falling DOWN again. After the jump is finished and there is no platform under his feet, he should continue to fall until he reaches the next platform. And of course you can change his X-direction all the time.</p>
<p>So: I tried to create a retained JumpBy Action that looked like this:<br />
<code>id jumpAction = [[JumpBy actionWithDuration:1.5 position:ccp(0 ,0) height:200 jumps:1] retain];</code></p>
<p>This Action is run on the maincharacter whenever his feet touch the top of a platform:<br />
<code>[mainCharacter runAction:jumpAction];</code></p>
<p>My questions:</p>
<p>1. How can I change my maincharacter's X-position while he is doing this jump? It seems to me that whenever this Action is running, I cannot control the main sprite's X coordinate because the action sort of overwrites that.</p>
<p>2. How can I find out when the maincharacter reached the top of his jump? I need to do the platform-collsions ONLY when he falls down. It seems to me that AtlasSprites have no velocity so they don't real "know" in which direction they are moving at all.</p>
<p>3. How do I implement the "falling" of the maincharacter after his jump is finished? I guess the easiest way would be to just decrease his Y-position statically every tick if he is not jumping. But that would require to know, exactly how fast he was moving down at the end of the JumpBy-Action (which again, I cannot figure out).</p>
<p>I know this sounds all very newbie, please be kind ;)
</p></description>
		</item>
		<item>
			<title>moakesy on "Best method for bullet sprites and atlasSprites"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/2243#post-14058</link>
			<pubDate>Fri, 02 Oct 2009 10:16:20 +0000</pubDate>
			<dc:creator>moakesy</dc:creator>
			<guid isPermaLink="false">14058@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hey guys,</p>
<p>I've been using Cocos2D for a while now, plodding along doing things in my own way. I'm coming to the point now where I want to make better games and want to make sure the methods I use are the correct etc.</p>
<p>First of all bullets. If I have say a side scrolling shooter game where the player controls a ship that can shoot bullets, the way I have done this in the past is created 10 bullet sprites when the layer starts and just keep repositioning them everytime they go off screen, putting them in a queue ready to be fired again. Is this the most memory efficient way of doing things or should I be creating a new sprite each time and kill it afterwards? If so how would I do that?</p>
<p>Secondly, I'm just getting to grips with using AtlasSprites. One concern I am having with them is knowing when to create them. With sprites in the past I have initialized them in the header file and allocated them when the layer starts, this is because there are a few different functions that will use the sprite, such my collision detections etc. Is it OK to do this with AtlasSprites or should I be doing something different.</p>
<p>Thanks a lot guys, the forums have been a huge huge help with my game dev, so thanks.</p>
<p>Moakesy
</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>javy on "How to animate &amp; move sprites with proper timing?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/2857#post-17683</link>
			<pubDate>Sat, 07 Nov 2009 05:28:22 +0000</pubDate>
			<dc:creator>javy</dc:creator>
			<guid isPermaLink="false">17683@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I have an animation of 4 (possibly more) frames in an AtlasSprite.  I want to display each frame, and also move the sprite after each frame is displayed.</p>
<p>My current thoughts on how to do this:</p>
<p>1.  I could use a scheduler, check each frame, and update the position.</p>
<p>2.  I could make each frame an individual animation, then an action, and add it to a sequence.  Then move the sprite via MoveTo.  Would be troublesome in larger animation sequences.</p>
<p>Any suggestions?</p>
<p>Thanks!
</p></description>
		</item>

	</channel>
</rss>

