<?xml version="1.0" encoding="UTF-8"?><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"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Integrating Flint particles with the Pushbutton Engine</title>
	<atom:link href="http://blog.makeyourflashgame.com/375/integrating-flint-particles-with-the-pushbutton-engine.html/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.makeyourflashgame.com/375/integrating-flint-particles-with-the-pushbutton-engine.html</link>
	<description>where creative people can create flash games together...</description>
	<lastBuildDate>Thu, 02 Sep 2010 05:07:18 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: syndrome</title>
		<link>http://blog.makeyourflashgame.com/375/integrating-flint-particles-with-the-pushbutton-engine.html/comment-page-1#comment-102</link>
		<dc:creator>syndrome</dc:creator>
		<pubDate>Fri, 30 Apr 2010 19:03:13 +0000</pubDate>
		<guid isPermaLink="false">http://blog.makeyourflashgame.com/?p=375#comment-102</guid>
		<description>instead of

nextColor =
  (Math.random()*0xff)*0x010000+
  (Math.random()*0xff)*0x000100+
  (Math.random()*0xff)*0x000001;

you should use

nextColor = (uint(Math.random()*0xff) &lt;&lt; 16) &#124; (uint(Math.random()*0xff) &lt;&lt; 8) &#124; uint(Math.random()*0xff;

bitwise operations are waaay faster
also, Math.random() returns Number, not uint, so if you get

nextColor =
  (0.223885652*0xff)*0x010000+
  (0.887276236*0xff)*0x000100+
  (0.123859423*0xff)*0x000001;

it will evaluate to 
3741505.37281536 + 57921.39268608 + 31.584152865 = 3799458.349654305

which is then casted to uint
3799458 = 0x39F9A2

this is incorrect, because the random RGB color values should equal to 0x39, 0xE2, and 0x1F, respectively (totalling 0x39E21F).

yeah, I&#039;m always like that :)
thanks for the tut.</description>
		<content:encoded><![CDATA[<p>instead of</p>
<p>nextColor =<br />
  (Math.random()*0xff)*0&#215;010000+<br />
  (Math.random()*0xff)*0&#215;000100+<br />
  (Math.random()*0xff)*0&#215;000001;</p>
<p>you should use</p>
<p>nextColor = (uint(Math.random()*0xff) &lt;&lt; 16) | (uint(Math.random()*0xff) &lt;&lt; <img src='http://blog.makeyourflashgame.com/wp-includes/images/smilies/icon_cool.gif' alt='8)' class='wp-smiley' /> | uint(Math.random()*0xff;</p>
<p>bitwise operations are waaay faster<br />
also, Math.random() returns Number, not uint, so if you get</p>
<p>nextColor =<br />
  (0.223885652*0xff)*0&#215;010000+<br />
  (0.887276236*0xff)*0&#215;000100+<br />
  (0.123859423*0xff)*0&#215;000001;</p>
<p>it will evaluate to<br />
3741505.37281536 + 57921.39268608 + 31.584152865 = 3799458.349654305</p>
<p>which is then casted to uint<br />
3799458 = 0x39F9A2</p>
<p>this is incorrect, because the random RGB color values should equal to 0&#215;39, 0xE2, and 0x1F, respectively (totalling 0x39E21F).</p>
<p>yeah, I&#039;m always like that <img src='http://blog.makeyourflashgame.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
thanks for the tut.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

