<?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>BrianGriggs.com &#187; Flash</title>
	<atom:link href="http://briangriggs.com/category/flash/feed/" rel="self" type="application/rss+xml" />
	<link>http://briangriggs.com</link>
	<description>Tallest librarian in the world</description>
	<lastBuildDate>Tue, 15 May 2012 18:44:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Adobe Illustrator: Live Trace</title>
		<link>http://briangriggs.com/2011/07/07/adobe-illustrator-live-trace/</link>
		<comments>http://briangriggs.com/2011/07/07/adobe-illustrator-live-trace/#comments</comments>
		<pubDate>Fri, 08 Jul 2011 00:31:32 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Tech How To]]></category>

		<guid isPermaLink="false">http://briangriggs.com/?p=1596</guid>
		<description><![CDATA[In an earlier post I mentioned random skills that librarians pick up (graphic design, video editing, archery). I&#8217;m helping a friend convert a bitmap into a vector. Bitmaps get all jagged and pixelly when you stretch them beyond their proportions. Vectors use math (it&#8217;s all about the rays and line segments) to stretch pictures without [...]]]></description>
			<content:encoded><![CDATA[<p>In <a href="http://briangriggs.com/2011/07/05/hopekids-how-you-can-help-part-2-in-kind-donations/">an earlier post</a> I mentioned random skills that librarians pick up (graphic design, video editing, <a href="http://briangriggs.com/2008/04/10/on-target-with-john-flanagan/">archery</a>). I&#8217;m helping a friend convert a bitmap into a vector. Bitmaps get all jagged and pixelly when you stretch them beyond their proportions. Vectors use math (it&#8217;s all about the rays and line segments) to stretch pictures without the pixellation. If you&#8217;ve ever drawn in Flash, you&#8217;ve drawn using vectors.</p>
<p>I was about to manually trace the bitmap in Adobe Illustrator and then save it as a vector when I noticed the Live Trace feature.</p>
<p><strong>Note: This is using Adobe CS2.</strong></p>
<p>How to use it:</p>
<ol>
<li>Click on the layer with your image.</li>
<li>In the menu bar, click on &#8216;Object&#8217;, then &#8216;Live Trace&#8217;, then &#8216;Show Adjusted Image&#8217;.<br />
<a href="http://briangriggs.com/wp-content/uploads/2011/07/Screen-shot-2011-07-07-at-5.19.43-PM.png"><img src="http://briangriggs.com/wp-content/uploads/2011/07/Screen-shot-2011-07-07-at-5.19.43-PM.png" alt="" title="Screen shot 2011-07-07 at 5.19.43 PM" width="454" height="360" class="alignnone size-full wp-image-1597" /></a></li>
<li>Click on your image and then click on the &#8216;Live Trace&#8217; button.<br />
<a href="http://briangriggs.com/wp-content/uploads/2011/07/Screen-shot-2011-07-07-at-5.28.55-PM.png"><img src="http://briangriggs.com/wp-content/uploads/2011/07/Screen-shot-2011-07-07-at-5.28.55-PM.png" alt="" title="Screen shot 2011-07-07 at 5.28.55 PM" width="343" height="27" class="alignnone size-full wp-image-1598" /></a></li>
<li>It will take a bit to trace automatically. You can then click on &#8216;Object&#8217;, then &#8216;Live Paint&#8217;, then &#8216;Make&#8217; to make a new image using vectors. This allows you to edit the new image like any other Illustrator file.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://briangriggs.com/2011/07/07/adobe-illustrator-live-trace/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>You Make Me Sick!</title>
		<link>http://briangriggs.com/2011/04/04/you-make-me-sick/</link>
		<comments>http://briangriggs.com/2011/04/04/you-make-me-sick/#comments</comments>
		<pubDate>Mon, 04 Apr 2011 22:12:09 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Science]]></category>
		<category><![CDATA[Scratch]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://briangriggs.com/?p=1441</guid>
		<description><![CDATA[The winners of the STEM video game challenge have been announced. The professional developer prize went to Filament Games for their web-based You Make Me Sick! It&#8217;s made in Flash and is a good example of a simple game done right. Here are the student winners.]]></description>
			<content:encoded><![CDATA[<p>The winners of the STEM video game challenge have been announced.</p>
<p>The professional developer prize went to Filament Games for their web-based <a href="http://www.filamentgames.com/project_files/GILS/BV/DOE/Game/frame.html" target="_blank">You Make Me Sick!</a> It&#8217;s made in Flash and is a good example of a simple game done right.</p>
<p><a href="http://www.stemchallenge.org/winners/Default.aspx">Here are the student winners</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://briangriggs.com/2011/04/04/you-make-me-sick/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Verb Volley and the History of Oregon Trail</title>
		<link>http://briangriggs.com/2011/01/21/verb-volley-and-the-history-of-oregon-trail/</link>
		<comments>http://briangriggs.com/2011/01/21/verb-volley-and-the-history-of-oregon-trail/#comments</comments>
		<pubDate>Fri, 21 Jan 2011 18:34:10 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[Assignments]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Game]]></category>
		<category><![CDATA[Historical]]></category>

		<guid isPermaLink="false">http://briangriggs.com/?p=1342</guid>
		<description><![CDATA[I was reading an article about the history of the Oregon Trail video game and learned that it was the result of two Math teachers and a History teacher being roommates. All three were in their first years of teaching and wanted a way to grab students&#8217; attentions when learning about western expansion in the [...]]]></description>
			<content:encoded><![CDATA[<p>I was reading <a href="http://www.citypages.com/2011-01-19/news/oregon-trail-how-three-minnesotans-forged-its-path/">an article about the history of the Oregon Trail video game</a> and learned that it was the result of two Math teachers and a History teacher being roommates. All three were in their first years of teaching and wanted a way to grab students&#8217; attentions when learning about western expansion in the United States. </p>
<p>They programmed the whole thing in two weeks. That&#8217;s what reminded me of Verb Volley, a game I created one Fall Break to help my students review parts of speech.</p>
<p>Here&#8217;s my game:<br />
<object width="550" height="480"><param name="movie" value="http://briangriggs.com/wp-content/uploads/2011/01/verbvolley.swf"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://briangriggs.com/wp-content/uploads/2011/01/verbvolley.swf" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="550" height="480"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://briangriggs.com/2011/01/21/verb-volley-and-the-history-of-oregon-trail/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Obama&#8217;s STEM Video Game Challenge</title>
		<link>http://briangriggs.com/2010/09/20/obamas-stem-video-game-challenge/</link>
		<comments>http://briangriggs.com/2010/09/20/obamas-stem-video-game-challenge/#comments</comments>
		<pubDate>Mon, 20 Sep 2010 17:02:42 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Future Professionals]]></category>
		<category><![CDATA[Game]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://briangriggs.com/?p=1163</guid>
		<description><![CDATA[This past week President Obama announced the STEM Video Game Challenge to encourage students to pursue math and science through engaging activities. The contest will be accepting submissions from October 12 to January 5. The entries can either be a game design on paper or a playable game. There is a $50,000 prize pool for [...]]]></description>
			<content:encoded><![CDATA[<p>This past week President Obama announced the <a href="http://www.stemchallenge.org/youthprize/Default.aspx" target="_blank">STEM Video Game Challenge</a> to encourage students to pursue math and science through engaging activities. The contest will be accepting submissions from October 12 to January 5. The entries can either be a game design on paper or a playable game. There is a $50,000 prize pool for students and it provides some great opportunities for careers in video game design.</p>
<p>Future Professionals, this is what we&#8217;re going to tackle first. Check out <a href="http://scratch.mit.edu/" target="_blank">Scratch</a> from MIT. It&#8217;s like an intro program to Flash and actually has some pretty decent scripting. (It&#8217;s free, too, which is always nice.)</p>
<p>Here&#8217;s how the judges will be determining the winners:</p>
<blockquote><p>Submissions will be judged on a combination of fun and balanced gameplay, creative vision and incorporation of Science TEchnology and Math (STEM) concepts in game design and play experience.</p></blockquote>
<p><a href="http://scratch.mit.edu/projects/talleslibrarian/1308930">Click here</a> for a game that took me ten minutes to create. In no way does it meet the STEM requirements but it does illustrate a tiny bit of what Scratch does (that would take me much longer to do in Flash ActionScript.)</p>
<p>Try and get the face to the flower. Click on the green flag to get the party started. Arrow keys move the smiley.</p>
]]></content:encoded>
			<wfw:commentRss>http://briangriggs.com/2010/09/20/obamas-stem-video-game-challenge/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Re-posting: Creating a quiz game using ActionScript</title>
		<link>http://briangriggs.com/2010/03/31/re-posting-creating-a-quiz-game-using-actionscript/</link>
		<comments>http://briangriggs.com/2010/03/31/re-posting-creating-a-quiz-game-using-actionscript/#comments</comments>
		<pubDate>Wed, 31 Mar 2010 21:49:28 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Future Professionals]]></category>
		<category><![CDATA[Game]]></category>

		<guid isPermaLink="false">http://briangriggs.com/?p=908</guid>
		<description><![CDATA[Today we&#8217;ll be looking at how to make a button-based game. We&#8217;ll need to run in ActionScript 2. The exciting part is that these games will be able to be put into the teachers&#8217; SmartBoard software. Imagine the school playing a game you created. Setting up the Project Open a new Flash document. Click on [...]]]></description>
			<content:encoded><![CDATA[<p>Today we&#8217;ll be looking at how to make a button-based game. We&#8217;ll need to run in ActionScript 2. The exciting part is that these games will be able to be put into the teachers&#8217; SmartBoard software. Imagine the school playing a game you created.</p>
<blockquote><ol>
<strong>Setting up the Project</strong></p>
<li>Open a new Flash document.</li>
<li>Click on Layer 1, Frame 1. Add a <em>stop();</em> action to stop the playhead.</li>
<li>On a new line in the code, establish a variable to hold the score.<br />
The code so far:<br />
<code>stop();<br />
score=0;</code><br />
We set up the score variable here so we can change it as the user gets questions right.</li>
<li>Create a new layer in frame 1.</li>
<li>Create text as a title for your game (so the user isn&#8217;t staring at a white screen).</li>
<p><strong>Making a Button</strong></p>
<li>That&#8217;s great, but we need a way to get past this screen. We&#8217;ll need a button. Click on <strong>Insert->New Symbol</strong> and choose &#8216;Button&#8217;.</li>
<li>Buttons have an Up, Over, Down, and Hit. Up is its natural state. Over is if some hovers a mouse over the button. Down is what it looks like when it gets clicked. Hit is the Hit Zone &#8211; if you want a bigger area to register if it&#8217;s been clicked on or not. Normally Hit is the size of a box around the button.</li>
<li>Make a keyframe in each area to change the states of the buttons (what they look like). Notice that you can insert multiple layers.</li>
<li>Drag that button onto the stage.</li>
<li>The button is clickable, but it doesn&#8217;t know what else to do. With the button selected (blue highlight around it), open up the ActionScript for that button.</li>
<p><strong>Telling the Program to go to the Next Part</strong></p>
<li>Type <em>on(</em> . Remember from previous lessons that when we see the parentheses, it means the function is calling/looking for a variable. Most modern versions of Flash will try and guess which one you want. Select <em>press</em>. (When someone clicks the button, it goes. You could choose <em>release</em> and the user could click and hold and then go when the user releases the mouseclick.)</li>
<li>Add a funky bracket ( <em>{</em> is called a brace, to be technical) to start your list of commands.<br />
The code should now be:<br />
<code>on(press) {</code></li>
<li>Start a new line to maintain style.</li>
<li>Type in <em>gotoAndPlay(2);</em> Notice that the &#8216;A&#8217; and the &#8216;P&#8217; are capitalized. Also look at how the function calls a variable &#8211; the number &#8217;2&#8242; &#8211; to tell the game to go to  frame 2.<br />
The code now is:<br />
<code>on(press) {<br />
gotoAndPlay(2);<br />
}</code></li>
<li>If you run the program right now, when you click, it will go to frame 2 (or even just consider frame 1 the end of the movie if you haven&#8217;t added anything yet to frame 2) but then loop back to frame 1. We need to put a <em>stop(); </em>code  in frame 2 just like we did for frame 1. <strong>You&#8217;ll need to insert a blank keyframe</strong> and then click on the ActionScript arrow.</li>
<li>Once you&#8217;ve added the <em>stop();</em>, on a different layer create text with your question.</li>
<p><strong>Use the Same Button Multiple Times to Make Your Life Easier</strong></p>
<li>We need buttons for our answers. If we create one button in the Flash library, we can then drag it in multiple times and not have to re-do animations. Create that button.</li>
<li>Drag the button from the library onto the stage. Create a text box next to the button that has an answer.</li>
<li>Drag the button from the library <strong>again</strong> onto the stage for the second answer. Put a text box next to the button with an answer.</li>
<p><strong>Checking for the Wrong Answer</strong></p>
<li>Click on the button next to the wrong answer to select it (blue outline).</li>
<li>Let&#8217;s add some code for the wrong answer. Let&#8217;s add a <em>gotoAndPlay(3);</em> to the button (with the <em>on(press)</em> and all that) to take the user to frame 3, which is where we&#8217;ll mock them for getting the wrong answer. (Mock them nicely and politely.)</li>
<li>Make sure to add a <em>stop();</em> code in frame 3 to avoid the jumping loop. You&#8217;ll need to insert a blank keyframe.</li>
<li>Create your end of game screen. Be nice and include a button to take us back to frame 1.</li>
<p><strong>Checking for the Right Answer</strong></p>
<li>Let&#8217;s say the user got the question right. Go back to frame 2 and edit the ActionScript for the correct answer button.</li>
<li>Send the user to the next question &#8211; frame 4 &#8211; with a <em>gotoAndPlay(4); </em>What&#8217;s different this time, though, is that we need to add to the score. On a new line in the ActionScript type in <em>score = score + 10; </em> We just took the score and added 10 points to it. (It will still complete the rest of your list of commands &#8211; but to keep it straight in the minds of the humans who may be reading over your code later, add to the score first and then put in the <em>goto</em>.<br />
The code should look like:<br />
<code>on(press){<br />
	gotoAndPlay(4);<br />
	score = score + 10;<br />
}</code></li>
<p><strong>Displaying a Score</strong></p>
<li>On frame 2, create a new layer. Let&#8217;s label what the user is looking at. Create a text box somewhere on the screen that says &#8216;Score&#8217;. If it&#8217;s on it&#8217;s own layer and it&#8217;s own keyframe, it will constantly say &#8216;Score&#8217; throughout the whole program. </li>
<li>Now let&#8217;s show the actual score. Click on the tool to make a text box, but instead of creating a text box, just click where you want to show the score.</li>
<li>In the Properties at the bottom of the work area, change it from Static to Dynamic text. Dynamic and Static are just like with characters in a story &#8211; dynamic changes, static stays the same.</li>
<li>In that text&#8217;s Properties, there&#8217;s a place called &#8216;Var: &#8216; with an input box next to it. Type in <em>score</em>. It will now show the value for <em>score</em>. Make sure that you don&#8217;t put this in frame 1, because frame 1 is where we initialize/set up the variable.</li>
<p><strong>Thoughts to Enhance the Game</strong></p>
<li>You can add to <em>score</em> whenever the user clicks on the right answer button. You can subtract from <em>score</em>  when a user gets the wrong answer.</li>
<li>You can add as many buttons as you like &#8211; you don&#8217;t just have to have two questions.</li>
<li>Not all buttons need to be easily seen. You could say &#8220;Click on the duck&#8221; but have the Up be blank and have the Over show a duck. The user would have to roll around the screen to try and find the right button.</li>
<li>You can create a variable called <em>whichframe</em> to control which frame a <em>gotoAndPlay</em> goes to. Instead of <em>gotoAndPlay(4);</em> it could be <em>gotoAndPlay(whichframe);</em> </li>
</ol>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://briangriggs.com/2010/03/31/re-posting-creating-a-quiz-game-using-actionscript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Isometric Game: Going to the Next Frame</title>
		<link>http://briangriggs.com/2010/03/10/isometric-game-going-to-the-next-frame/</link>
		<comments>http://briangriggs.com/2010/03/10/isometric-game-going-to-the-next-frame/#comments</comments>
		<pubDate>Wed, 10 Mar 2010 21:45:53 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Future Professionals]]></category>
		<category><![CDATA[Game]]></category>

		<guid isPermaLink="false">http://briangriggs.com/?p=895</guid>
		<description><![CDATA[We&#8217;ve got the countdown showing on the hero for our game. If you weren&#8217;t at Future Professionals when we did that, here&#8217;s the link. Let&#8217;s check when the variable scarytimer gets to zero. When it does, we&#8217;ll have the Flash movie go to frame two. Find the line of code in the onEnterFrame function where [...]]]></description>
			<content:encoded><![CDATA[<p>We&#8217;ve got the countdown showing on the hero for our game. If you weren&#8217;t at Future Professionals when we did that, <a href="http://briangriggs.com/2010/02/24/isometric-game-displaying-the-timer/">here&#8217;s the link</a>.</p>
<p>Let&#8217;s check when the variable <em>scarytimer</em> gets to zero. When it does, we&#8217;ll have the Flash movie go to frame two. </p>
<p>Find the line of code in the onEnterFrame function where you decrease <em>scarytimer</em>.<br />
<code>scarytimer--;</code></p>
<p>Underneath it, check to see if it&#8217;s less than 0.<br />
<code>scarytimer--;<br />
	if(scarytimer<0){<br />
		gotoAndStop(2);<br />
		scarytimer=0;<br />
	}</code></p>
<p>The gotoAndStop means that we don't have to put a stop(); code in frame 2. It reduces the amount of typing you have to do.</p>
<p>Notice that I added a line to set scarytimer to 0. Instead of going into the negatives, it's now an ominous emptiness.</p>
<p>Now draw/type a message on the stage in frame 2 that lets the player know that time has run out.</p>
<p>That's if they lose. But what if they win?</p>
<p>Find the line that says<br />
<code>if(canvas.map[hero.y][hero.x] == 101){<br />
	trace("Exit");<br />
	}</code></p>
<p>Change:<br />
<code>trace("Exit");</code></p>
<p>to<br />
<code>gotoAndStop(3);<br />
scarytimer=1000;</code></p>
<p>On frame 3 create a message that lets them know they win. Make sure that frame 3 has a new keyframe so frame 2's message doesn't show up.</p>
]]></content:encoded>
			<wfw:commentRss>http://briangriggs.com/2010/03/10/isometric-game-going-to-the-next-frame/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Isometric Game: Displaying the Timer</title>
		<link>http://briangriggs.com/2010/02/24/isometric-game-displaying-the-timer/</link>
		<comments>http://briangriggs.com/2010/02/24/isometric-game-displaying-the-timer/#comments</comments>
		<pubDate>Wed, 24 Feb 2010 17:05:02 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Game]]></category>

		<guid isPermaLink="false">http://briangriggs.com/?p=877</guid>
		<description><![CDATA[If you have missed a couple of sessions, check here. If you&#8217;ve been here the whole time, let&#8217;s continue. Open up the Flash file we&#8217;ve been working on. Edit your hero movieclip. Add a textbox above the hero&#8217;s head. Change the textbox from &#8216;Static&#8217; to &#8216;Dynamic&#8217;. For the instance name, type scarytimer. For the Var:, [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://i936.photobucket.com/albums/ad207/tallestlibrarian/Picture1-4.png" border="0" alt="Photobucket"><br />
<a href="http://briangriggs.com/2010/02/10/continuing-with-the-maze-game-in-flash-beat-the-clock/">If you have missed a couple of sessions, check here</a>.</p>
<p>If you&#8217;ve been here the whole time, let&#8217;s continue.</p>
<ol>
<li>Open up the Flash file we&#8217;ve been working on.</li>
<li>Edit your hero movieclip.</li>
<li>Add a textbox above the hero&#8217;s head.</li>
<li>Change the textbox from &#8216;Static&#8217; to &#8216;Dynamic&#8217;.</li>
<li>For the instance name, type <em>scarytimer</em>.</li>
<li>For the <em>Var:</em>, type _root.scarytimer. (_root lets us know that the variable exists on the main level of the stage and not just privately with the movieclip).</li>
<li>If you don&#8217;t want the timer text to be selectable by a mouse, make sure the &#8216;Ab&#8217; button is not selected.</li>
</ol>
<p>A variation on this would be to create a new tile with the timer on it and spread those tiles throughout your maze.</p>
<p>Your dynamic text settings should look something like this:<br />
<a href="http://s936.photobucket.com/albums/ad207/tallestlibrarian/?action=view&#038;current=Picture2-6.png" target="_blank"><img src="http://i936.photobucket.com/albums/ad207/tallestlibrarian/Picture2-6.png" border="0" alt="Photobucket"></a></p>
]]></content:encoded>
			<wfw:commentRss>http://briangriggs.com/2010/02/24/isometric-game-displaying-the-timer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Continuing with the Maze Game in Flash: Beat the Clock!</title>
		<link>http://briangriggs.com/2010/02/10/continuing-with-the-maze-game-in-flash-beat-the-clock/</link>
		<comments>http://briangriggs.com/2010/02/10/continuing-with-the-maze-game-in-flash-beat-the-clock/#comments</comments>
		<pubDate>Wed, 10 Feb 2010 18:59:32 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Future Professionals]]></category>
		<category><![CDATA[Game]]></category>

		<guid isPermaLink="false">http://briangriggs.com/?p=854</guid>
		<description><![CDATA[We&#8217;re going to add a simple timer to our maze game that we&#8217;ve been working on. (If you&#8217;ve missed a few sessions, start here.) We want the timer to start at 1000 and count down to the player&#8217;s imminent doom. To set up the initial value for the timer, let&#8217;s create a variable called scarytimer. [...]]]></description>
			<content:encoded><![CDATA[<p>We&#8217;re going to add a simple timer to our maze game that we&#8217;ve been working on. (If you&#8217;ve missed a few sessions, <a href="http://briangriggs.com/2010/01/26/isometric-game-engine/">start here</a>.)</p>
<p>We want the timer to start at 1000 and count down to the player&#8217;s imminent doom.</p>
<p>To set up the initial value for the timer, let&#8217;s create a variable called <em>scarytimer</em>.<br />
<code>var scarytimer:Number=1000;</code></p>
<p>Put that code at the very top, outside of any functions. If a variable is defined in a function, other functions will see it as undefined. So, at the top of the AcionScript, type in:<br />
<code>var scarytimer:Number=1000;</code><br />
right above where you see<br />
<code>var tiles:Object = new Object({width:52, height:26});</code></p>
<p>The player will start with 1000 loops to be able to get to tile101, <a href="http://briangriggs.com/2010/02/01/a-hero-stepping-on-a-tile/">tile101 being our special tile from last time</a>.</p>
<p>Now we need the player&#8217;s doom.</p>
<p>In the onEnterFrame function, we need to subtract from <em>scarytimer</em> each time the game loops in a frame.</p>
<p>Way back in the olden days when I programmed stone tablets for pterodactyls, we would write <em>scarytimer=scarytimer-1</em> to subtract gradually from the variable with each loop. </p>
<p>ActionScript has simplified it with the code:<br />
<code>scarytimer--;</code><br />
The two minuses tell ActionScript to subtract one increment from the variable.</p>
<p>Put <code>scarytimer--; </code>right above where you see <code>input();</code></p>
<p>Variables get tricky when trying to determine what value they have. Run a trace on the variable to have the computer tell you what value <em>scarytimer</em> has.</p>
<p><code>scarytimer--;<br />
trace(scarytimer);</code></p>
<p>Now the code will decrease <em>scarytimer</em> and then spit out its value to you.</p>
<p><strong>Run your file right now to make sure your variable works. If it doesn&#8217;t, everything else will get nasty quickly.</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://briangriggs.com/2010/02/10/continuing-with-the-maze-game-in-flash-beat-the-clock/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Continuing in Isometrics: A hero stepping on a tile</title>
		<link>http://briangriggs.com/2010/02/01/a-hero-stepping-on-a-tile/</link>
		<comments>http://briangriggs.com/2010/02/01/a-hero-stepping-on-a-tile/#comments</comments>
		<pubDate>Mon, 01 Feb 2010 21:00:09 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Future Professionals]]></category>
		<category><![CDATA[Game]]></category>

		<guid isPermaLink="false">http://briangriggs.com/?p=835</guid>
		<description><![CDATA[We started with this great game engine and we edited the arrays to add walls at different locations on the map. This week we&#8217;re going to add a custom floor tile that: Checks to see if the hero is standing on the tile. If the hero is on the tile, sends the entire Flash timeline [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://briangriggs.com/2010/01/26/isometric-game-engine/">We started with this great game engine</a> and we edited the arrays to add walls at different locations on the map. This week we&#8217;re going to add a custom floor tile that:</p>
<ul>
<li>Checks to see if the hero is standing on the tile.</li>
<li>If the hero is on the tile, sends the entire Flash timeline to the next frame.</li>
</ul>
<p>First let&#8217;s make sure we know how to recognize the hero stepping on a tile.</p>
<ol>
<li>Open up your project file from last week. (Remember: the <a href="http://briangriggs.com/wp-content/uploads/2010/01/isometric.zip">original file can be found here if you were gone</a>.)</li>
<li>Open up the project&#8217;s library.</li>
<li>Right-click/CTRL+click on the &#8217;tile100&#8242; movie clip in the library. Choose &#8216;Duplicate&#8217;.</li>
<li>Name it &#8217;tile101&#8242;. Make sure to click the checkbox next to Linkage: Export for ActionScript.</li>
<li>Double-click the &#8217;tile101&#8242; movie clip to edit it. Double-click the square and select a new color from the paintbucket for it.</li>
<li>Click on Scene 1 to go back to the main timeline.</li>
<li>Click on the frame with all the ActionScript in it. To edit the ActionScript, click on the arrow in the frame&#8217;s Properties window.</li>
<li>Look for the code that reads:
<p><code>_root.onEnterFrame = function():Void<br />
{<br />
	input(); // Handle keyboard movement<br />
	return;</p>
<p>};</code><br />
Let&#8217;s add a message that pops up, showing that the exit was stepped on. We&#8217;ll use the <em>trace</em> function for that:<br />
<code>_root.onEnterFrame = function():Void<br />
{<br />
	input(); // Handle keyboard movement<br />
	if(canvas.map[hero.y][hero.x] == 101) trace("Exit");<br />
	return;</p>
<p>};</code>
</li?<br />
</ol>
<p>A message should pop up in the debugger window with the word &#8220;Exit&#8221; showing up while you step on the tile.</p>
<p>Now that we can tell if the tile is being stepped on, see if you can figure out how to send the hero to a new map.</p>
]]></content:encoded>
			<wfw:commentRss>http://briangriggs.com/2010/02/01/a-hero-stepping-on-a-tile/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Isometric Game Engine</title>
		<link>http://briangriggs.com/2010/01/26/isometric-game-engine/</link>
		<comments>http://briangriggs.com/2010/01/26/isometric-game-engine/#comments</comments>
		<pubDate>Tue, 26 Jan 2010 19:53:51 +0000</pubDate>
		<dc:creator>Brian</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Future Professionals]]></category>
		<category><![CDATA[Game]]></category>

		<guid isPermaLink="false">http://briangriggs.com/?p=811</guid>
		<description><![CDATA[Isometric perspective is a way to use 2D images to create a 3D environment. Flash normally operates in 2D images; Chris Lindsey created a game engine in Flash to represent a 3D environment. The engine does require ActionScript 3, though, so it won&#8217;t run properly in ActionScript 2. A game engine is not a game [...]]]></description>
			<content:encoded><![CDATA[<p>Isometric perspective is a way to use 2D images to create a 3D environment. Flash normally operates in 2D images; Chris Lindsey created a game engine in Flash to represent a 3D environment. The engine does require ActionScript 3, though, so it won&#8217;t run properly in ActionScript 2.</p>
<p>A game engine is not a game in itself- it is the power behind the game. Programmers will design an engine to run their video game and then license that engine to other game developers. <a href="http://www.devmaster.net/engines/">Here&#8217;s a list of some of the current game engines out there</a>.</p>
<p>Things to look at in this game engine:</p>
<ol>
<li>There are no movie clips on the stage to begin with. The code places the movie clips onto the stage when you test the movie/make the .SWF file.</li>
<li>All of the code is in just one frame. You don&#8217;t have to search all over for it &#8211; this is really appreciated.</li>
<li>There&#8217;s a giant array of numbers.<br />
<a href="http://s936.photobucket.com/albums/ad207/tallestlibrarian/?action=view&#038;current=Picture4-3.png" target="_blank"><img src="http://i936.photobucket.com/albums/ad207/tallestlibrarian/Picture4-3.png" border="0" alt="Photobucket"></a><br />
This is your map. If it says &#8217;200&#8242;, that&#8217;s a wall piece that gets placed. If it says &#8217;100&#8242;, that&#8217;s a floor piece.<br />
<a href="http://s936.photobucket.com/albums/ad207/tallestlibrarian/?action=view&#038;current=Picture6-2.png" target="_blank"><img src="http://i936.photobucket.com/albums/ad207/tallestlibrarian/Picture6-2.png" border="0" alt="Photobucket"></a></li>
</ol>
<p>Save a copy of the .FLA file so you have the original and then one to work with. Try editing the &#8216;hero&#8217; movie clip. Draw your artwork on a new layer inside the movie clip. You can then delete the original box image layer. To help you out, you can turn the box layer into an outline by clicking on the colored box on the layer (in this picture it&#8217;s yellow).<br />
<a href="http://s936.photobucket.com/albums/ad207/tallestlibrarian/?action=view&#038;current=Picture5-3.png" target="_blank"><img src="http://i936.photobucket.com/albums/ad207/tallestlibrarian/Picture5-3.png" border="0" alt="Photobucket"></a></p>
<p>Once you get used to how the artwork is set up, try expanding the map by adding a new line of 100s and 200s in the ActionScript. </p>
<p><strong>Click on the game to play it. Use the arrow keys to move your character around.</strong><br />
<object width="550" height="400"><param name="movie" value="http://briangriggs.com/wp-content/uploads/2010/01/testgame.swf"><embed src="http://briangriggs.com/wp-content/uploads/2010/01/testgame.swf" width="550" height="400"></embed></object></p>
<p>The .FLA file with all of the code <a href="http://briangriggs.com/wp-content/uploads/2010/01/isometric.zip">can be found by clicking here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://briangriggs.com/2010/01/26/isometric-game-engine/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.367 seconds -->

