<?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: Filling 2D array.</title>
		<link>http://www.cocos2d-iphone.org/forum/topic/5136</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:07 +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/5136" rel="self" type="application/rss+xml" />

		<item>
			<title>neophit on "Filling 2D array."</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/5136#post-31065</link>
			<pubDate>Mon, 22 Mar 2010 09:45:46 +0000</pubDate>
			<dc:creator>neophit</dc:creator>
			<guid isPermaLink="false">31065@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>@<a href='http://www.cocos2d-iphone.org/forum/profile/8146'>julesv</a>, yup. You can create as many TMX files as you like.
</p></description>
		</item>
		<item>
			<title>julesv on "Filling 2D array."</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/5136#post-30763</link>
			<pubDate>Fri, 19 Mar 2010 06:17:30 +0000</pubDate>
			<dc:creator>julesv</dc:creator>
			<guid isPermaLink="false">30763@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>@<a href='http://www.cocos2d-iphone.org/forum/profile/2782'>neophit</a> I was thinking of tiles, would ti work if I had lots of them for lots of different puzzles?<br />
@<a href='http://www.cocos2d-iphone.org/forum/profile/2995'>randomtruth</a> Thank you :D
</p></description>
		</item>
		<item>
			<title>mhussa on "Filling 2D array."</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/5136#post-30743</link>
			<pubDate>Fri, 19 Mar 2010 00:29:30 +0000</pubDate>
			<dc:creator>mhussa</dc:creator>
			<guid isPermaLink="false">30743@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>@<a href='http://www.cocos2d-iphone.org/forum/profile/2995'>randomtruth</a>: thats a very kind gesture.  It might be better to use the PM mechanism rather than publishing your email on a public forum.
</p></description>
		</item>
		<item>
			<title>neophit on "Filling 2D array."</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/5136#post-30740</link>
			<pubDate>Thu, 18 Mar 2010 23:24:19 +0000</pubDate>
			<dc:creator>neophit</dc:creator>
			<guid isPermaLink="false">30740@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Have you looked at <a href="http://mapeditor.org">Tiled</a>? TMX Maps are <a href="http://www.cocos2d-iphone.org/wiki/doku.php/prog_guide:tiled_maps">supported</a> in cocos2d.
</p></description>
		</item>
		<item>
			<title>randomtruth on "Filling 2D array."</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/5136#post-30738</link>
			<pubDate>Thu, 18 Mar 2010 23:00:56 +0000</pubDate>
			<dc:creator>randomtruth</dc:creator>
			<guid isPermaLink="false">30738@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>It seems like you are having some problems with the basics of objective-c send me an email @ <a href="mailto:skylersaleh@gmail.com">skylersaleh@gmail.com</a> and ill give you some help.
</p></description>
		</item>
		<item>
			<title>julesv on "Filling 2D array."</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/5136#post-30736</link>
			<pubDate>Thu, 18 Mar 2010 22:33:50 +0000</pubDate>
			<dc:creator>julesv</dc:creator>
			<guid isPermaLink="false">30736@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>To tell you the truth I am genuinely confused. I'm 14 and although I have quite a lot of experience with programming in general (Python) I'm finding cocos2D really hard right now :/ I get the main concepts, but it's just where to place my code etc.</p>
<p>Would I remove the nsarray and just declare the int[x][y] instead? Do I actually need to declare anything in the header file?
</p></description>
		</item>
		<item>
			<title>randomtruth on "Filling 2D array."</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/5136#post-30735</link>
			<pubDate>Thu, 18 Mar 2010 22:20:07 +0000</pubDate>
			<dc:creator>randomtruth</dc:creator>
			<guid isPermaLink="false">30735@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>You are definitely on the right track. I would create something like this.<br />
<pre><code>const int MaxX = 10; //amount of X tiles
const int MaxY = 15; //amount of Y tiles
int boards[MaxX][MaxY];</code></pre>
<p>You can manipulate boards[xnumber][ynumber] the exact same way you would handle an integer.<br />
To go through the entire grid you would need to set up an iterator.</p>
<pre><code>int x = 0;// reset variable
while(x&#60;MaxX)
{
int y = 0; // reset variable
while(y&#60;MaxY)
{
int aNumber = boards[x][y]; // gets number at (x,y)
++y;
}
++x;
}</code></pre>
<p>Also if you want to you could make an array of CCSprites by replacing int boards[MaxX][MaxY] with CCSprite * boards[MaxX][MaxY]<br />
then this iterator will give you a sprite instead of an integer.
</p></description>
		</item>
		<item>
			<title>julesv on "Filling 2D array."</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/5136#post-30733</link>
			<pubDate>Thu, 18 Mar 2010 22:09:17 +0000</pubDate>
			<dc:creator>julesv</dc:creator>
			<guid isPermaLink="false">30733@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hello! I'm implementing this (<a href="http://www.puzzle-light-up.com/" rel="nofollow">http://www.puzzle-light-up.com/</a>) game. I've started by making a 120x120 grid placed in centre of my screen. I also created a 2D array. My idea was to make seperate files with lots of puzzles. In the files there would be a notation like this:<br />
0=empty/unlit<br />
1 = lit<br />
2=filled in block with nothing in it<br />
3=filled in block with 1 in it etc.<br />
6 = has light bulb in it</p>
<p>Could you teach me a way to fill this 2D array with a seperate/external file. I was thinking of a loop which fills board[x][y]. Also, if you have any tips on how to represent the array visually after it's loaded please tell me.</p>
<p>Thank you :D
</p></description>
		</item>

	</channel>
</rss>

