<?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; Topic: Naming Sprites using Variables OR how to use Atlas Sprites????</title>
		<link>http://www.cocos2d-iphone.org/forum/topic/2805</link>
		<description>A fast, easy to use, free, and community supported 2D game engine</description>
		<language>en-US</language>
		<pubDate>Fri, 10 Feb 2012 01:55:16 +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/topic/2805" rel="self" type="application/rss+xml" />

		<item>
			<title>FlamingPineapples on "Naming Sprites using Variables OR how to use Atlas Sprites????"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/2805#post-17441</link>
			<pubDate>Thu, 05 Nov 2009 01:25:16 +0000</pubDate>
			<dc:creator>FlamingPineapples</dc:creator>
			<guid isPermaLink="false">17441@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>@<a href='http://www.cocos2d-iphone.org/forum/profile/727'>Kahless</a> Thank You SOO much for that - Just before your post I headed to atlasSprites and that is what this uses...</p>
<p>@<a href='http://www.cocos2d-iphone.org/forum/profile/1500'>trsills</a> - i just left it at that - i can see that the way I was trying to do it was wrong....
</p></description>
		</item>
		<item>
			<title>Tim on "Naming Sprites using Variables OR how to use Atlas Sprites????"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/2805#post-17407</link>
			<pubDate>Wed, 04 Nov 2009 21:44:59 +0000</pubDate>
			<dc:creator>Tim</dc:creator>
			<guid isPermaLink="false">17407@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hmm, what exactly are the errors?  I have this working in my app and was lifted from the AccelViewportTest sample code where in the init it has the following:</p>
<pre><code>for (int n=0; n&#60;NUM_GROSSINIS; n++) {
  CGPoint pos = ccp((randfloat())*cloudsSize.x, (randfloat())*cloudsSize.y);
  grossini[n] = [self addNewSpritePosition:pos scale:0.15];
  [grossini[n] runAction:[Repeat actionWithAction:[RotateBy actionWithDuration:.5f*(n%5) angle:(n&#62;NUM_GROSSINIS/2)?360:-360 ] times:100000]];
		}</code></pre></description>
		</item>
		<item>
			<title>Kahless on "Naming Sprites using Variables OR how to use Atlas Sprites????"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/2805#post-17406</link>
			<pubDate>Wed, 04 Nov 2009 21:41:44 +0000</pubDate>
			<dc:creator>Kahless</dc:creator>
			<guid isPermaLink="false">17406@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>You might want to have a look at the tweejump source code, it sounds similar to what you are trying to achieve.</p>
<p><a href="http://github.com/haqu/tweejump" rel="nofollow">http://github.com/haqu/tweejump</a>
</p></description>
		</item>
		<item>
			<title>FlamingPineapples on "Naming Sprites using Variables OR how to use Atlas Sprites????"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/2805#post-17399</link>
			<pubDate>Wed, 04 Nov 2009 20:31:52 +0000</pubDate>
			<dc:creator>FlamingPineapples</dc:creator>
			<guid isPermaLink="false">17399@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Basically I am trying to make a platform where the platforms fall from the top and make their way to the bottom - They would start off plenty, then fewer as timed progressed - I would Like to make their positions random.<br />
I am using a timer which ticks every fifth of a second</p>
<p>trsills - I tried that example and all my code does is turn up errors - either im doing something wrong - or it doesn't work (I have defined count as an int... But any reference to mySprite[ANYVariable] comes up with an error...</p>
<p>I'll look into those atlasSprites now - and hope they help me...<br />
Thanks...
</p></description>
		</item>
		<item>
			<title>Tim on "Naming Sprites using Variables OR how to use Atlas Sprites????"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/2805#post-17380</link>
			<pubDate>Wed, 04 Nov 2009 16:18:06 +0000</pubDate>
			<dc:creator>Tim</dc:creator>
			<guid isPermaLink="false">17380@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Actually, I think what he's looking for might be something like this:</p>
<p><code>Sprite *mySprite[5];</code></p>
<p>Then I add the additional sprites with a loop and incrementing counter...</p>
<p>	<code>mySprite[count] = [Sprite spriteWithFile:@&#34;somesprite.png&#34;];</code></p>
<p>I'll defer to Steve and the guys though cause this may be wrong but this is what I used to create additional sprites on the fly.
</p></description>
		</item>
		<item>
			<title>Steve Oldmeadow on "Naming Sprites using Variables OR how to use Atlas Sprites????"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/2805#post-17358</link>
			<pubDate>Wed, 04 Nov 2009 14:02:19 +0000</pubDate>
			<dc:creator>Steve Oldmeadow</dc:creator>
			<guid isPermaLink="false">17358@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>You can also assign a numeric "tag" to a sprite and retrieve the sprite from the node it is added to using that tag so you probably don't even need to do what you think you need to do.</p>
<p>It might help if you give us the big picture of what you are trying to do.
</p></description>
		</item>
		<item>
			<title>Codemattic on "Naming Sprites using Variables OR how to use Atlas Sprites????"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/2805#post-17355</link>
			<pubDate>Wed, 04 Nov 2009 13:14:52 +0000</pubDate>
			<dc:creator>Codemattic</dc:creator>
			<guid isPermaLink="false">17355@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>"I am trying to add a series of sprites named "spritebasic" with a number attached to the end "</p>
<p>let me guess, you come from an Actionscript background? You cant make variable names like that in ObjectiveC, you could use a c array or NSArray or NSDictionary to hold your Sprites and access them that way.
</p></description>
		</item>
		<item>
			<title>bradparks on "Naming Sprites using Variables OR how to use Atlas Sprites????"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/2805#post-17353</link>
			<pubDate>Wed, 04 Nov 2009 12:43:50 +0000</pubDate>
			<dc:creator>bradparks</dc:creator>
			<guid isPermaLink="false">17353@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>hey there.... Cocos2d comes with lots of examples itself... Definitely has samples on AtlasSprites.... The "Readme before posting" post mentions how to load any of the examples (must be over 50) that come with Cocos2d....</p>
<p><a href="http://www.cocos2d-iphone.org/forum/topic/3" rel="nofollow">http://www.cocos2d-iphone.org/forum/topic/3</a></p>
<p>Here's specifically how to run any of the example code:<br />
<a href="http://www.cocos2d-iphone.org/wiki/doku.php/faq?s=drag&#038;s=active&#038;s=target#how_to_run_the_tests" rel="nofollow">http://www.cocos2d-iphone.org/wiki/doku.php/faq?s=drag&#038;s=active&#038;s=target#how_to_run_the_tests</a></p>
<p>And an AtlasSprite example is in the Cocos2d source.. It's main file is called "AtlasSpriteTest.m"....</p>
<p>And if you're ever trying to find an example for how to do something in Cocos, use the following tip to search the Cocos project:<br />
<a href="http://www.cocos2d-iphone.org/forum/topic/3#post-16500" rel="nofollow">http://www.cocos2d-iphone.org/forum/topic/3#post-16500</a>
</p></description>
		</item>
		<item>
			<title>FlamingPineapples on "Naming Sprites using Variables OR how to use Atlas Sprites????"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/2805#post-17349</link>
			<pubDate>Wed, 04 Nov 2009 07:55:46 +0000</pubDate>
			<dc:creator>FlamingPineapples</dc:creator>
			<guid isPermaLink="false">17349@http://www.cocos2d-iphone.org/forum/</guid>
			<description><br /></description>
		</item>
		<item>
			<title>FlamingPineapples on "Naming Sprites using Variables OR how to use Atlas Sprites????"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/2805#post-17348</link>
			<pubDate>Wed, 04 Nov 2009 07:50:20 +0000</pubDate>
			<dc:creator>FlamingPineapples</dc:creator>
			<guid isPermaLink="false">17348@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Edit:<br />
i can't find tutorials on Atlas Sprites (Which is what I
<ul>THINK</ul>
 should be able to solve my question below).<br />
Could you please help me determine whether Atlas is the way to go, or if another method is better?<br />
Either way - If you could - just point me in the right direction - Tutorials would be the best</p>
<p>Thanks....</p>
<p>-------------------------</p>
<p>Original Question Below:</p>
<p>I am trying to add a series of sprites named "spritebasic" with a number attached to the end - platforms</p>
<p>In my code I have the following</p>
<p>		Sprite * ("spritebasic" + spritenovalue) = [Sprite spriteWithFile:@"spriteblue.png"];</p>
<p>How should I refer to this when I am dealing with the sprite, and how should I unload this?</p>
<p>Or is there an  easier way?<br />
I have googled for ages and have come up with Tilemaps - but are unsure how to implement them...</p>
<p>Or is there a better function for this???</p>
<p>----------------------------</p>
<p>Edit: I think I may have found the answer: AtlasSprites - but from what I have looked at they seem best for animation???</p>
<p>ANY help is appreciated
</p></description>
		</item>

	</channel>
</rss>

