<?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: A Simple Game Engine Using Random</title>
	<atom:link href="http://www.taterboy.com/blog/2008/12/a-simple-game-engine-using-random/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.taterboy.com/blog/2008/12/a-simple-game-engine-using-random/</link>
	<description>FLASH :: FLEX :: AIR :: ILLUSTRATION :: ANIMATION :: WEB DEVELOPMENT</description>
	<lastBuildDate>Thu, 15 Dec 2011 05:16:59 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
	<item>
		<title>By: taterboy</title>
		<link>http://www.taterboy.com/blog/2008/12/a-simple-game-engine-using-random/comment-page-1/#comment-199</link>
		<dc:creator>taterboy</dc:creator>
		<pubDate>Wed, 03 Dec 2008 18:06:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.taterboy.com/blog/?p=49#comment-199</guid>
		<description>I re-read your first comment from the other post, then did some code updates, you can download a new source file here.
http://www.taterboy.com/blog/downloads/GameRandom2.zip

1. Added more to the objHolderArr, so it is a three row/six column grid. This is a visual gird that is easier for us visual people to understand.

2. Added the button into the ball Object with the dispatch event code, this is really the best way to handle the click.

3. Added some score code and the code to remove the ball when it is clicked. It is now almost a fully functioning game.

You will notice that code to remove the ball is almost an exact copy of most of the code from the activeChecker function. Normally I would make a new function with just the code that is the same and call it from both places. this will help if there is a bug or an update to keep the code clean. Again, this is nice to have, a best practice but will not make or break the game.

I know, just get it to work for now, you can clean up the code later, nuff said.
Good luck.</description>
		<content:encoded><![CDATA[<p>I re-read your first comment from the other post, then did some code updates, you can download a new source file here.<br />
<a href="http://www.taterboy.com/blog/downloads/GameRandom2.zip" rel="nofollow">http://www.taterboy.com/blog/downloads/GameRandom2.zip</a></p>
<p>1. Added more to the objHolderArr, so it is a three row/six column grid. This is a visual gird that is easier for us visual people to understand.</p>
<p>2. Added the button into the ball Object with the dispatch event code, this is really the best way to handle the click.</p>
<p>3. Added some score code and the code to remove the ball when it is clicked. It is now almost a fully functioning game.</p>
<p>You will notice that code to remove the ball is almost an exact copy of most of the code from the activeChecker function. Normally I would make a new function with just the code that is the same and call it from both places. this will help if there is a bug or an update to keep the code clean. Again, this is nice to have, a best practice but will not make or break the game.</p>
<p>I know, just get it to work for now, you can clean up the code later, nuff said.<br />
Good luck.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: taterboy</title>
		<link>http://www.taterboy.com/blog/2008/12/a-simple-game-engine-using-random/comment-page-1/#comment-198</link>
		<dc:creator>taterboy</dc:creator>
		<pubDate>Wed, 03 Dec 2008 06:47:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.taterboy.com/blog/?p=49#comment-198</guid>
		<description>If you only have one bug, you may need the random stuff, there is nothing to randomize except for where and when it shows up. If you do not need it, skip it.

The configuration code works for this sample and may not work for your game, but the concept is still valid. The idea is to have controls built into your code, so that you can tweak things during testing. A simple example would be a speed variable.

Say you test the game and it is too fast or too slow, instead of searching through the code and finding all the places that you hard coded the speed, you could have one speed variable. By changing one number, you can effect how the game plays until it feels right. As the games get more complex, you can add more configuration hooks into your code. But do not let this hold you up. It does not stop the game from working, it is a good practice, but not essential.

In the sample, I can add remove, objects, changes scores, control how long they stay on screen all in the config section of the code. try messing with the delay and timeInc variables.

For the clicking event. In this example code you could add it into this area

//******* add code here to initiate your visual objects.
var tempBO:ballObj = new ballObj();
tempBO.x = slotObj.xCoor;
tempBO.y = 20;
tempBO.objIDStr = arrLoc.toString();
tempBO.objScoreStr = levelArr[arrLoc].score;
tempBO.objTypeStr = levelArr[arrLoc].obj;
addChild(tempBO);

just add a line.
tempBO.addEventListener(MouseEvent.CLICK, clickHandler);


Then add a function called clickhandler.
function clickhandler(ev:MosueEvent)
{
   //handle click event
}

If there are issues with the click event not firing consistently when clicking on the bug, then you may need to add a button into the Ball Object (action script file),
(You will have to import any classes for the button or SimpleButton) Add an event listener to the button, then in the handler add this line. dispatchEvent(new Event(&quot;BUG_EVENT&quot;,true);

Then back in the fla add a listener, addEventListener(&quot;BUG_EVENT&quot;,bugHandler); then add a function called bugHandler,

Sorry if I am throwing too much info at you each time, if you need more specific answers it really helps to see some code or have more details for the game play. If you want to share that with me offline, use the contact link at that top of the page and I will get back to you through email.</description>
		<content:encoded><![CDATA[<p>If you only have one bug, you may need the random stuff, there is nothing to randomize except for where and when it shows up. If you do not need it, skip it.</p>
<p>The configuration code works for this sample and may not work for your game, but the concept is still valid. The idea is to have controls built into your code, so that you can tweak things during testing. A simple example would be a speed variable.</p>
<p>Say you test the game and it is too fast or too slow, instead of searching through the code and finding all the places that you hard coded the speed, you could have one speed variable. By changing one number, you can effect how the game plays until it feels right. As the games get more complex, you can add more configuration hooks into your code. But do not let this hold you up. It does not stop the game from working, it is a good practice, but not essential.</p>
<p>In the sample, I can add remove, objects, changes scores, control how long they stay on screen all in the config section of the code. try messing with the delay and timeInc variables.</p>
<p>For the clicking event. In this example code you could add it into this area</p>
<p>//******* add code here to initiate your visual objects.<br />
var tempBO:ballObj = new ballObj();<br />
tempBO.x = slotObj.xCoor;<br />
tempBO.y = 20;<br />
tempBO.objIDStr = arrLoc.toString();<br />
tempBO.objScoreStr = levelArr[arrLoc].score;<br />
tempBO.objTypeStr = levelArr[arrLoc].obj;<br />
addChild(tempBO);</p>
<p>just add a line.<br />
tempBO.addEventListener(MouseEvent.CLICK, clickHandler);</p>
<p>Then add a function called clickhandler.<br />
function clickhandler(ev:MosueEvent)<br />
{<br />
   //handle click event<br />
}</p>
<p>If there are issues with the click event not firing consistently when clicking on the bug, then you may need to add a button into the Ball Object (action script file),<br />
(You will have to import any classes for the button or SimpleButton) Add an event listener to the button, then in the handler add this line. dispatchEvent(new Event(&#8220;BUG_EVENT&#8221;,true);</p>
<p>Then back in the fla add a listener, addEventListener(&#8220;BUG_EVENT&#8221;,bugHandler); then add a function called bugHandler,</p>
<p>Sorry if I am throwing too much info at you each time, if you need more specific answers it really helps to see some code or have more details for the game play. If you want to share that with me offline, use the contact link at that top of the page and I will get back to you through email.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: June</title>
		<link>http://www.taterboy.com/blog/2008/12/a-simple-game-engine-using-random/comment-page-1/#comment-197</link>
		<dc:creator>June</dc:creator>
		<pubDate>Wed, 03 Dec 2008 04:49:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.taterboy.com/blog/?p=49#comment-197</guid>
		<description>Sorry about this. My last question. do i put all the code in the fla and AS file, it will work?Because i would like to solve it out if ii could do the ading of the function clicking of the bug myself. Thank you. Because when i put it in it will have errors. thank you and sorry about it</description>
		<content:encoded><![CDATA[<p>Sorry about this. My last question. do i put all the code in the fla and AS file, it will work?Because i would like to solve it out if ii could do the ading of the function clicking of the bug myself. Thank you. Because when i put it in it will have errors. thank you and sorry about it</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: June</title>
		<link>http://www.taterboy.com/blog/2008/12/a-simple-game-engine-using-random/comment-page-1/#comment-196</link>
		<dc:creator>June</dc:creator>
		<pubDate>Wed, 03 Dec 2008 04:41:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.taterboy.com/blog/?p=49#comment-196</guid>
		<description>I&#039;m really very thankful for your help. I still have some problem that require your explanation. Firstly, if i only have an item for my game, do i still need to do the random part? If my game include clicking on the to have the score recorded, do i put the code in the As file or the fla file?As for the part building config data for engine i really do not understand. Really my apologise because i&#039;m quite a newbie to AS3. Even my AS2 isn&#039;t that good either. Once again, really thankful of your help.</description>
		<content:encoded><![CDATA[<p>I&#8217;m really very thankful for your help. I still have some problem that require your explanation. Firstly, if i only have an item for my game, do i still need to do the random part? If my game include clicking on the to have the score recorded, do i put the code in the As file or the fla file?As for the part building config data for engine i really do not understand. Really my apologise because i&#8217;m quite a newbie to AS3. Even my AS2 isn&#8217;t that good either. Once again, really thankful of your help.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

