<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Dauntless.be &#187; Uncategorized</title>
	<atom:link href="http://www.dauntless.be/category/uncategorized/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dauntless.be</link>
	<description></description>
	<lastBuildDate>Thu, 06 Oct 2011 11:50:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
		<item>
		<title>Oops!</title>
		<link>http://www.dauntless.be/2011/07/oops/</link>
		<comments>http://www.dauntless.be/2011/07/oops/#comments</comments>
		<pubDate>Sun, 17 Jul 2011 20:35:14 +0000</pubDate>
		<dc:creator>Dauntless</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.dauntless.be/?p=115</guid>
		<description><![CDATA[Looks like my little A* doesn&#8217;t always generate the shortest path if you are able to walk diagonally. (If your characters can only walk vertically/horizontally, you&#8217;re safe from potentially walking a few extra tiles!) I&#8217;m using the Manhattan heuristic which is good if you can only move horizontal or vertical, but it&#8217;s double as large [...]]]></description>
			<content:encoded><![CDATA[<p>Looks like my little A* doesn&#8217;t always generate the shortest path if you are able to walk diagonally. (If your characters can only walk vertically/horizontally, you&#8217;re safe from potentially walking a few extra tiles!)</p>
<p>I&#8217;m using the Manhattan heuristic which is good if you can only move horizontal or vertical, but it&#8217;s double as large as what you would expect it to be if you can move diagonally. That means that sometimes, a shorter path will not be looked at, because the algorithm guesses that it would be a worse path than the current one.</p>
<p>The good news: it&#8217;s an easy fix. If by the time you are reading this v1.3 isn&#8217;t out yet:</p>
<p>In DataTiles.as, change the setH method:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> setH<span style="color: #000000;">&#40;</span>end<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Point</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">:</span> <span style="color: #0033ff; font-weight: bold;">void</span>
<span style="color: #000000;">&#123;</span>
<span style="color: #0033ff; font-weight: bold;">this</span>.h = <span style="color: #004993;">Math</span>.<span style="color: #004993;">abs</span><span style="color: #000000;">&#40;</span>end.<span style="color: #004993;">x</span> <span style="color: #000000; font-weight: bold;">-</span> <span style="color: #004993;">position</span>.<span style="color: #004993;">x</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">*</span> _standardCost <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #004993;">Math</span>.<span style="color: #004993;">abs</span><span style="color: #000000;">&#40;</span>end.<span style="color: #004993;">y</span> <span style="color: #000000; font-weight: bold;">-</span> <span style="color: #004993;">position</span>.<span style="color: #004993;">y</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">*</span> _standardCost;
<span style="color: #0033ff; font-weight: bold;">this</span>.f = <span style="color: #0033ff; font-weight: bold;">this</span>.h <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #0033ff; font-weight: bold;">this</span>.g;
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>becomes</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> setH<span style="color: #000000;">&#40;</span>end<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Point</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">:</span> <span style="color: #0033ff; font-weight: bold;">void</span>
<span style="color: #000000;">&#123;</span>
<span style="color: #0033ff; font-weight: bold;">this</span>.h = <span style="color: #004993;">Math</span>.<span style="color: #004993;">max</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Math</span>.<span style="color: #004993;">abs</span><span style="color: #000000;">&#40;</span>end.<span style="color: #004993;">x</span> <span style="color: #000000; font-weight: bold;">-</span> <span style="color: #004993;">position</span>.<span style="color: #004993;">x</span><span style="color: #000000;">&#41;</span>, <span style="color: #004993;">Math</span>.<span style="color: #004993;">abs</span><span style="color: #000000;">&#40;</span>end.<span style="color: #004993;">y</span> <span style="color: #000000; font-weight: bold;">-</span> <span style="color: #004993;">position</span>.<span style="color: #004993;">y</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">*</span> _standardCost;
<span style="color: #0033ff; font-weight: bold;">this</span>.f = <span style="color: #0033ff; font-weight: bold;">this</span>.h <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #0033ff; font-weight: bold;">this</span>.g;
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>That is, of course, only if you are able to walk diagonally.</p>
<p>This will be fixed in v1.3.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dauntless.be/2011/07/oops/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Minor update: v1.1</title>
		<link>http://www.dauntless.be/2010/09/minor-update-v1-1/</link>
		<comments>http://www.dauntless.be/2010/09/minor-update-v1-1/#comments</comments>
		<pubDate>Sat, 04 Sep 2010 23:35:29 +0000</pubDate>
		<dc:creator>Dauntless</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.dauntless.be/?p=108</guid>
		<description><![CDATA[I&#8217;ve added a minor update to Astar. There was a little memory leak in getDataTile() which has now been fixed. Thanks to Mario Benedek for pointing this out! You can get the latest version on the A* page.]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve added a minor update to Astar. There was a little memory leak in getDataTile() which has now been fixed.</p>
<p>Thanks to Mario Benedek for pointing this out!</p>
<p>You can get the latest version on <a href="http://www.dauntless.be/astar">the A* page</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dauntless.be/2010/09/minor-update-v1-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TextField.setSelection without clicking</title>
		<link>http://www.dauntless.be/2010/09/textfield-setselection-without-clicking/</link>
		<comments>http://www.dauntless.be/2010/09/textfield-setselection-without-clicking/#comments</comments>
		<pubDate>Fri, 03 Sep 2010 21:05:44 +0000</pubDate>
		<dc:creator>Dauntless</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[setSelection]]></category>
		<category><![CDATA[TextField]]></category>

		<guid isPermaLink="false">http://www.dauntless.be/?p=98</guid>
		<description><![CDATA[If you want to select a certain part of a textfield you use TextField.setSelection. This will only work however if you put it inside a click handler of the textfield. Why? Because when you click on your textfield it receives focus, which is necessary for setSelection to work. Solution? First assign focus to the textfield [...]]]></description>
			<content:encoded><![CDATA[<p>If you want to select a certain part of a textfield you use <strong>TextField.setSelection</strong>. This will only work however if you put it inside a click handler of the textfield.</p>
<p><strong>Why?</strong> Because when you click on your textfield it receives focus, which is necessary for setSelection to work.</p>
<p><strong>Solution?</strong> First assign focus to the textfield manually and then call setSelection:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #004993;">stage</span>.<span style="color: #004993;">focus</span> = tf;
tf.<span style="color: #004993;">setSelection</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">0</span>, <span style="color: #000000; font-weight:bold;">5</span><span style="color: #000000;">&#41;</span>;</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.dauntless.be/2010/09/textfield-setselection-without-clicking/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Minor update: v1.1</title>
		<link>http://www.dauntless.be/2009/11/minor-update-v11/</link>
		<comments>http://www.dauntless.be/2009/11/minor-update-v11/#comments</comments>
		<pubDate>Mon, 09 Nov 2009 16:57:35 +0000</pubDate>
		<dc:creator>Dauntless</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.dauntless.be/?p=80</guid>
		<description><![CDATA[The AstarPath was supposed to be iterated through like this: while&#40;myPath.hasNext&#40;&#41;&#41; &#123; trace&#40;myPath.getNext&#40;&#41;&#41;; &#125; But since a lot of people don&#8217;t like doing it this way, I&#8217;ve added a simple toArray() method to the AstarPath class. The method does what it says: It returns the inner array that the AstarPath uses.]]></description>
			<content:encoded><![CDATA[<p>The AstarPath was supposed to be iterated through like this:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #0033ff; font-weight: bold;">while</span><span style="color: #000000;">&#40;</span>myPath.hasNext<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
	<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span>myPath.getNext<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>But since a lot of people don&#8217;t like doing it this way, I&#8217;ve added a simple toArray() method to the AstarPath class. The method does what it says: It returns the inner array that the AstarPath uses.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dauntless.be/2009/11/minor-update-v11/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

