<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>Tile based game help</title>
		<link>http://www.allegro.cc/forums/view/591790</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Sat, 09 Jun 2007 03:53:47 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>im new in c++ programming and i just finished making a tic-tac-toe game with AI.<br />so i decided to start with tile based game, and found a tutorial :</p><p><a href="http://agdn.netfirms.com/main/html/tut_2.htm">http://agdn.netfirms.com/main/html/tut_2.htm</a></p><p>but i dont understand the load map part. what does map.cell contains?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Fishcake)</author>
		<pubDate>Fri, 08 Jun 2007 06:48:24 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Right near the beginning of the code:
</p><div class="source-code snippet"><div class="inner"><pre>   <span class="p">#define GRID_WIDTH      15</span>
   <span class="p">#define GRID_HEIGHT     15</span>

   <span class="k1">typedef</span> <span class="k1">struct</span> WORLD
   <span class="k2">{</span>
      <span class="k1">unsigned</span> <span class="k1">short</span> cell<span class="k2">[</span>GRID_WIDTH<span class="k2">]</span><span class="k2">[</span>GRID_HEIGHT<span class="k2">]</span><span class="k2">;</span>
   <span class="k2">}</span> WORLD<span class="k2">;</span>

   WORLD map<span class="k2">;</span>
</pre></div></div><p>
So map.cell is a 15x15 array of numbers. After loading it contains the ID number of each tile of the map.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (23yrold3yrold)</author>
		<pubDate>Fri, 08 Jun 2007 07:22:05 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>ok, i understand that part, thanks <img src="http://www.allegro.cc/forums/smileys/grin.gif" alt=";D" /> now i found these at <a href="http://awiki.tomasu.org/AllegroTileMaps">http://awiki.tomasu.org/AllegroTileMaps</a></p><div class="source-code"><div class="toolbar"></div><div class="inner"><table width="100%"><tbody><tr><td class="number">1</td><td><span class="k1">struct</span> map</td></tr><tr><td class="number">2</td><td><span class="k2">{</span></td></tr><tr><td class="number">3</td><td>        <span class="k1">struct</span> layer <span class="k3">*</span>data<span class="k2">;</span></td></tr><tr><td class="number">4</td><td>        <span class="k1">int</span> total_layers<span class="k2">;</span></td></tr><tr><td class="number">5</td><td><span class="k2">}</span><span class="k2">;</span></td></tr><tr><td class="number">6</td><td>&#160;</td></tr><tr><td class="number">7</td><td><span class="k1">struct</span> layer</td></tr><tr><td class="number">8</td><td><span class="k2">{</span></td></tr><tr><td class="number">9</td><td>        <span class="k1">int</span> x,y<span class="k2">;</span> <span class="c">// where to start drawing this layer (this should be relative to the map's x and y)</span></td></tr><tr><td class="number">10</td><td>        <span class="k1">struct</span> tile <span class="k3">*</span>data<span class="k2">;</span></td></tr><tr><td class="number">11</td><td>        <span class="k1">int</span> w,h<span class="k2">;</span> <span class="c">// in our game different layers can have different sizes and different tile spacing.</span></td></tr><tr><td class="number">12</td><td>        <span class="k1">int</span> tile_spacing_w,tile_spacing_h<span class="k2">;</span></td></tr><tr><td class="number">13</td><td><span class="k2">}</span><span class="k2">;</span></td></tr><tr><td class="number">14</td><td>&#160;</td></tr><tr><td class="number">15</td><td><span class="k1">struct</span> tile</td></tr><tr><td class="number">16</td><td><span class="k2">{</span></td></tr><tr><td class="number">17</td><td>        <a href="http://www.allegro.cc/manual/BITMAP" target="_blank"><span class="a">BITMAP</span></a> <span class="k3">*</span>pict<span class="k2">;</span></td></tr><tr><td class="number">18</td><td>        <span class="k1">int</span> flags<span class="k2">;</span></td></tr><tr><td class="number">19</td><td>        <span class="k1">int</span> trans<span class="k2">;</span></td></tr><tr><td class="number">20</td><td><span class="k2">}</span><span class="k2">;</span></td></tr></tbody></table></div></div><p>

can anyone write a simple code using these? a <b>complete</b> code that just draw 20x15 map loaded from a text file (no other stuff like scrolling, movement, etc..), with 2 different tiles and 2 layers. none of the tutorials i read actually helped me, so maybe i can understand it by this way. i don&#39;t think its too much for you guys, or is it?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Fishcake)</author>
		<pubDate>Fri, 08 Jun 2007 15:11:23 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>They didn&#39;t help or you didn&#39;t read them?</p><p>What you need is really simple. You should take the time to think about it. But ...</p><p>1st. What size map would you like?<br />2nd. How much of that map are you showing at one time?<br />3rd. How may layers do you need?</p><p>As to your question about load map. Each cell contains an integer value of the tile in the datafile.</p><p>From drawmap<br />p = map.cell[ j ][ i ];</p><p>There are 256 tiles. p is from 0 to 255.</p><p>I&#39;d explain this more, but do a damn search on these forums. I&#39;ve explained this more than once before.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (DanielH)</author>
		<pubDate>Fri, 08 Jun 2007 21:14:58 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
i don&#39;t think its too much for you guys, or is it?
</p></div></div><p>
Well, that was rude. <img src="http://www.allegro.cc/forums/smileys/rolleyes.gif" alt="::)" />
</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
none of the tutorials i read actually helped me, so maybe i can understand it by this way
</p></div></div><p>
You posted links to two excellent Allegro tilemap tutorials that have everything you need to know to do what you asked; you&#39;d better learn to understand it this way or you&#39;re not going to learn much else without forum begging. It&#39;s giving a man a a fish vs. teaching a man to fish; sorry. Take an honest shot at it yourself, and post your work if you have trouble getting it to work.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (23yrold3yrold)</author>
		<pubDate>Fri, 08 Jun 2007 23:20:36 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>23yrold3yrold:</p><p>oops, sorry. didn&#39;t mean to be rude <img src="http://www.allegro.cc/forums/smileys/lipsrsealed.gif" alt=":-X" /><br />i think i need a bit more time on this. maybe i just stick with simple tile based without all the classes and structs, because i just can&#39;t understand how to use them <img src="http://www.allegro.cc/forums/smileys/sad.gif" alt=":(" /></p><p>thanks for answering!</p><p>DanielH:</p><p>i think its too early for me to mess with tile based engine. i dont understand the class and struct part. can&#39;t figure out how to actually use them.</p><p>yea, about the load map, i got it already. and i did do a damn search on the forum for the past 3 days. and yes, i found it <img src="http://www.allegro.cc/forums/smileys/grin.gif" alt=";D" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Fishcake)</author>
		<pubDate>Sat, 09 Jun 2007 03:53:47 +0000</pubDate>
	</item>
</rss>
