<?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>Benoit Freslon&#039;s blog &#187; Tutorial</title>
	<atom:link href="http://www.benoitfreslon.com/category/actionscript/tutorial/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.benoitfreslon.com</link>
	<description>Benoit Freslon&#039;s blog - Game Design, Flash games, ActionScript tutorials ...</description>
	<lastBuildDate>Wed, 01 Sep 2010 15:14:39 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Orient an object to the mouse cursor</title>
		<link>http://www.benoitfreslon.com/orient-an-object-to-the-mouse-cursor</link>
		<comments>http://www.benoitfreslon.com/orient-an-object-to-the-mouse-cursor#comments</comments>
		<pubDate>Sat, 09 Jan 2010 18:17:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[actionscript 3]]></category>
		<category><![CDATA[mouse]]></category>
		<category><![CDATA[orientation]]></category>

		<guid isPermaLink="false">http://www.thisisgameplay.com/?p=725</guid>
		<description><![CDATA[How to orient an objet to an other ? Just put those lines and change the instance name myTank.  
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_Orienter_un_objet_par_rapport_%C3%A0_un_autre1_1625501573"
			class="flashmovie"
			width="300"
			height="300">
	<param name="movie" value="http://www.benoitfreslon.com/wp-content/uploads/2010/01/Orienter_un_objet_par_rapport_%C3%A0_un_autre1.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://www.benoitfreslon.com/wp-content/uploads/2010/01/Orienter_un_objet_par_rapport_%C3%A0_un_autre1.swf"
			name="fm_Orienter_un_objet_par_rapport_%C3%A0_un_autre1_1625501573"
			width="300"
			height="300">
	<!--<![endif]-->
		   
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
12345678910111213141516// This object will always look at the mouse cursor
myTank.addEventListener&#40;Event.ENTER_FRAME, &#160;tankEnterFrame&#41;;
// This function will be launched every frame (25 times by seconds)
function tankEnterFrame&#40;pEvt&#41; &#123;
&#160; &#160; // [...]]]></description>
			<content:encoded><![CDATA[<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.benoitfreslon.com%2Forient-an-object-to-the-mouse-cursor&amp;layout=button_count&amp;show_faces=true&amp;width=80&amp;action=like&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:80px;height:30px;margin-top:5px;text-align:right;"></iframe><p>How to orient an objet to an other ? Just put those lines and change the instance name myTank.  
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_Orienter_un_objet_par_rapport_%C3%A0_un_autre1_1969265375"
			class="flashmovie"
			width="300"
			height="300">
	<param name="movie" value="http://www.benoitfreslon.com/wp-content/uploads/2010/01/Orienter_un_objet_par_rapport_%C3%A0_un_autre1.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://www.benoitfreslon.com/wp-content/uploads/2010/01/Orienter_un_objet_par_rapport_%C3%A0_un_autre1.swf"
			name="fm_Orienter_un_objet_par_rapport_%C3%A0_un_autre1_1969265375"
			width="300"
			height="300">
	<!--<![endif]-->
		  <a href="http://adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a> 
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<div class="codecolorer-container actionscript3 default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:300px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br /></div></td><td><div class="actionscript3 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900; font-style: italic;">// This object will always look at the mouse cursor</span><br />
myTank<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Event</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">ENTER_FRAME</span><span style="color: #000066; font-weight: bold;">,</span> &nbsp;tankEnterFrame<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
<span style="color: #009900; font-style: italic;">// This function will be launched every frame (25 times by seconds)</span><br />
<span style="color: #339966; font-weight: bold;">function</span> tankEnterFrame<span style="color: #000000;">&#40;</span>pEvt<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// pEvt.currentTarget : myTank</span><br />
&nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> mc=pEvt<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">currentTarget</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// Get the radian angle between the tank and the cursor</span><br />
&nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// You can also replace mouseX and mouseY by another coordinates</span><br />
&nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> angleRadian=<span style="color: #004993;">Math</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">atan2</span><span style="color: #000000;">&#40;</span>mouseY<span style="color: #000066; font-weight: bold;">-</span>mc<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">y</span><span style="color: #000066; font-weight: bold;">,</span>mouseX<span style="color: #000066; font-weight: bold;">-</span>mc<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">x</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// Convert the radian angle in dedree</span><br />
&nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> angleDegree=angleRadian<span style="color: #000066; font-weight: bold;">*</span><span style="color: #000000; font-weight:bold;">180</span><span style="color: #000066; font-weight: bold;">/</span><span style="color: #004993;">Math</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">PI</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// Set the orientation</span><br />
&nbsp; &nbsp; mc<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">rotation</span>=angleDegree<span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// Display angle of rotation in degree</span><br />
&nbsp; &nbsp; txtAngle<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span>=<span style="color: #004993;">Math</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">round</span><span style="color: #000000;">&#40;</span>angleDegree<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">+</span><span style="color: #990000;">&quot;°&quot;</span><span style="color: #000066; font-weight: bold;">;</span><br />
<span style="color: #000000;">&#125;</span></div></td></tr></tbody></table></div>
<p>Download the source code here : <a rel="attachment wp-att-749" href="http://www.benoitfreslon.com/orient-an-object-to-the-mouse-cursor/www-thisisgameplay-com_orient_object_to_mouse_cursor/">[www.thisisgameplay.com]_Orient_object_to_mouse_cursor.fla</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.benoitfreslon.com/orient-an-object-to-the-mouse-cursor/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tutorial: How to make a game like Jetman &#8211; step 1 &#8211; The Jetman</title>
		<link>http://www.benoitfreslon.com/how-to-make-a-game-like-jetman-step-1-the-jetman</link>
		<comments>http://www.benoitfreslon.com/how-to-make-a-game-like-jetman-step-1-the-jetman#comments</comments>
		<pubDate>Fri, 18 Dec 2009 17:06:36 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Game Design]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[actionscript 3]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[jetman]]></category>

		<guid isPermaLink="false">http://www.thisisgameplay.com/?p=543</guid>
		<description><![CDATA[In my first tutorial I will show you how to make a flash game like Jetman.
A simple very famous casual game on facebook and very addictive.
Play Jetman

1. First of all you have to download the Adobe Flash IDE: Adobe Flash CS3 or Adobe Flash CS4

We will code the game with ActionScript 3.0 (the programming language [...]]]></description>
			<content:encoded><![CDATA[<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.benoitfreslon.com%2Fhow-to-make-a-game-like-jetman-step-1-the-jetman&amp;layout=button_count&amp;show_faces=true&amp;width=80&amp;action=like&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:80px;height:30px;margin-top:5px;text-align:right;"></iframe><p>In my first tutorial I will show you how to make a flash game like Jetman.<img class="alignleft" title="Jetman" src="http://photos-g.ak.fbcdn.net/photos-ak-sf2p/v43/106/4243149646/app_1_4243149646_252.gif" alt="" width="53" height="53" /><br />
A simple very famous casual game on facebook and very addictive.</p>
<p><a href="http://apps.facebook.com/playjetman/challenges.php?landing=true" target="_blank">Play Jetman</a></p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="344" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/ZWvvJc09jzs&amp;hl=fr_FR&amp;fs=1&amp;" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="425" height="344" src="http://www.youtube.com/v/ZWvvJc09jzs&amp;hl=fr_FR&amp;fs=1&amp;" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p><strong>1. First of all you have to download the Adobe Flash IDE: Adobe Flash CS3 or Adobe Flash CS4<br />
</strong></p>
<p>We will code the game with ActionScript 3.0 (the programming language of Flash) so you need Adobe Flash CS3 at least.<br />
You can download the free trial version of Adobe Flash here (Mac or Windows) : <a href="https://www.adobe.com/cfusion/tdrc/index.cfm?loc=en&amp;product=flash" target="_blank">https://www.adobe.com/cfusion/tdrc/index.cfm?loc=en&amp;product=flash</a></p>
<p><strong>2. Create your document<br />
</strong></p>
<ul>
<li>Open Flash.</li>
<li>Create a new ActionScript 3.0 document.</li>
<li>On the properties set the<strong> framerate to</strong> <strong>25fps.</strong></li>
<li>And set the <strong>background color </strong>to <strong>black.<br />
</strong></li>
</ul>
<p><strong>3. Create Jetman MovieClip</strong></p>
<p>Flash uses graphic objects called MovieClip. So we have to create the Jetman&#8217;s MovieClip.</p>
<ul>
<li>Click on the <strong>Rectangle tool</strong> on the tools bar. (on the left)</li>
</ul>
<p style="padding-left: 60px;"><a rel="attachment wp-att-552" href="http://www.benoitfreslon.com/how-to-make-a-game-like-jetman-step-1-the-jetman/create_box-2/"><img class="size-full wp-image-552 alignnone" title="create_box" src="http://www.thisisgameplay.com/wp-content/uploads/2009/11/create_box1.jpg" alt="create_box" width="29" height="32" /></a></p>
<ul>
<li>Then drag and drop on the stage to <strong>create a rectangle</strong> about <strong>width:50px</strong> and <strong>height:15px</strong> (you can modify your shape dimentions later).</li>
<li>Select<strong> all your shape including the border</strong>. You can also use a<strong> double click.</strong></li>
<li>Do a right click on your selected shape and click on <strong>Convert to Symbol</strong>.</li>
<li>Write this symbol&#8217;s<strong> name</strong> : <strong>Jetman</strong> (not jetman or JETMAN).</li>
<li>Then click <strong>OK.</strong></li>
</ul>
<p>Now you can see your Symbol <strong>Jetman </strong>into your Library  (on the right). If you don&#8217;t see the Library Press F11 key.<br />
You have 1 instance of the Jetman symbol on your stage. Good. <strong>We just created a MovieClip</strong>.</p>
<p>In order to interact with the jetman MovieClip with ActionScript, we have the rename the instance&#8217;s name on the stage.</p>
<ul>
<li>Click on the Jetman&#8217;s instance on the stage.</li>
</ul>
<p style="padding-left: 60px;"><a rel="attachment wp-att-554" href="http://www.benoitfreslon.com/how-to-make-a-game-like-jetman-step-1-the-jetman/instance/"><img class="alignnone size-full wp-image-554" title="instance" src="http://www.thisisgameplay.com/wp-content/uploads/2009/11/instance.jpg" alt="instance" width="82" height="53" /></a></p>
<ul>
<li>Then go to the properties on the bottom and set the instance&#8217;s name to <strong>jetman </strong>(not Jetman or JETMAN) it&#8217;s very important.</li>
</ul>
<p><a rel="attachment wp-att-555" href="http://www.benoitfreslon.com/how-to-make-a-game-like-jetman-step-1-the-jetman/instance_name/"><img class="alignnone size-full wp-image-555" title="instance_name" src="http://www.thisisgameplay.com/wp-content/uploads/2009/11/instance_name.jpg" alt="instance_name" width="346" height="128" /></a></p>
<p>It&#8217;s done! Now we can move the instance with ActionScript.</p>
<p><strong>4. Starting to code</strong></p>
<p>You have differents ways to code with ActionScript. We will use the easier. (Coding into layers)</p>
<ul>
<li><strong>Create a new layer</strong> on the timeline (Click on the button on the left bottom corner).</li>
<li><strong>Put the layer on the top:</strong> drag and drop the layer.</li>
<li>You can <strong>rename</strong> the layer with a double click or Right Click then rename.</li>
<li>Then select the<strong> first frame</strong> (here in black).</li>
</ul>
<p><a rel="attachment wp-att-556" href="http://www.benoitfreslon.com/how-to-make-a-game-like-jetman-step-1-the-jetman/layer/"><img class="alignnone size-full wp-image-556" title="layer" src="http://www.thisisgameplay.com/wp-content/uploads/2009/11/layer.jpg" alt="layer" width="188" height="94" /></a></p>
<ul>
<li>Finally go to the windows menu &gt; Actions or press the F9 key.</li>
</ul>
<p>A new windows is opening : The Actions window. We will to write all our code here.</p>
<ul>
<li>Copy and paste this Actionscript 3 code (After codinf into your layer you should see a little <strong>a</strong> into this frame):</li>
</ul>
<div class="codecolorer-container actionscript3 default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:300px;height:400px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br />43<br />44<br />45<br />46<br />47<br />48<br />49<br />50<br />51<br />52<br />53<br />54<br />55<br />56<br />57<br />58<br />59<br />60<br />61<br />62<br />63<br />64<br />65<br />66<br />67<br />68<br />69<br />70<br />71<br />72<br />73<br /></div></td><td><div class="actionscript3 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900; font-style: italic;">// Please don't remove this comment.</span><br />
<span style="color: #009900; font-style: italic;">// Code by Benoit Freslon.</span><br />
<span style="color: #009900; font-style: italic;">// Tutorials, Flash games:</span><br />
<span style="color: #009900; font-style: italic;">// http://www.thisisgameplay.com</span><br />
<span style="color: #009900; font-style: italic;">//</span><br />
<br />
<span style="color: #009900; font-style: italic;">////// Game balance</span><br />
<span style="color: #009900; font-style: italic;">// Jetpack's boost speed</span><br />
<span style="color: #6699cc; font-weight: bold;">var</span> speedBoost = <span style="color: #000066; font-weight: bold;">-</span><span style="color: #000000; font-weight:bold;">4</span><span style="color: #000066; font-weight: bold;">;</span><br />
<span style="color: #009900; font-style: italic;">// Gravity</span><br />
<span style="color: #6699cc; font-weight: bold;">var</span> gravity = <span style="color: #000066; font-weight: bold;">.</span>8<span style="color: #000066; font-weight: bold;">;</span><br />
<span style="color: #009900; font-style: italic;">// Speed limit</span><br />
<span style="color: #6699cc; font-weight: bold;">var</span> speedMax = <span style="color: #000000; font-weight:bold;">5</span><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
<span style="color: #009900; font-style: italic;">////// Global variables don't touch those one</span><br />
<span style="color: #009900; font-style: italic;">// Jetman is using his jetpack ?</span><br />
<span style="color: #6699cc; font-weight: bold;">var</span> boost = <span style="color: #0033ff; font-weight: bold;">false</span><span style="color: #000066; font-weight: bold;">;</span><br />
<span style="color: #009900; font-style: italic;">// Jetman's current speed</span><br />
<span style="color: #6699cc; font-weight: bold;">var</span> speed = <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
<span style="color: #009900; font-style: italic;">// 25 times by seconds this function will be launched</span><br />
<span style="color: #339966; font-weight: bold;">function</span> jetmanEnterFrame<span style="color: #000000;">&#40;</span>pEvt<span style="color: #000000;">&#41;</span><br />
<span style="color: #000000;">&#123;</span><br />
&nbsp;<span style="color: #009900; font-style: italic;">// If boost == true</span><br />
&nbsp;<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>boost<span style="color: #000000;">&#41;</span><br />
&nbsp;<span style="color: #000000;">&#123;</span><br />
&nbsp;<span style="color: #009900; font-style: italic;">// The speed changes</span><br />
&nbsp;speed = speedBoost<span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp;<span style="color: #000000;">&#125;</span><br />
&nbsp;<span style="color: #0033ff; font-weight: bold;">else</span><br />
&nbsp;<span style="color: #000000;">&#123;</span><br />
&nbsp;<span style="color: #009900; font-style: italic;">// Else the gravity decrease jetman's speed</span><br />
&nbsp;speed <span style="color: #000066; font-weight: bold;">+</span>= gravity<span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp;<span style="color: #000000;">&#125;</span><br />
&nbsp;<span style="color: #009900; font-style: italic;">// If the current speed is to hi</span><br />
&nbsp;<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>speed <span style="color: #000066; font-weight: bold;">&amp;</span>gt<span style="color: #000066; font-weight: bold;">;</span> speedMax<span style="color: #000000;">&#41;</span><br />
&nbsp;<span style="color: #000000;">&#123;</span><br />
&nbsp;<span style="color: #009900; font-style: italic;">// Limit the speed</span><br />
&nbsp;speed = speedMax<span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp;<span style="color: #000000;">&#125;</span><br />
&nbsp;<span style="color: #009900; font-style: italic;">// If the current speed is to low</span><br />
&nbsp;<span style="color: #0033ff; font-weight: bold;">else</span> <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>speed <span style="color: #000066; font-weight: bold;">&amp;</span>lt<span style="color: #000066; font-weight: bold;">;</span> <span style="color: #000066; font-weight: bold;">-</span>speedMax<span style="color: #000000;">&#41;</span><br />
&nbsp;<span style="color: #000000;">&#123;</span><br />
&nbsp;<span style="color: #009900; font-style: italic;">// Limit the speed</span><br />
&nbsp;speed = <span style="color: #000066; font-weight: bold;">-</span>speedMax<span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp;<span style="color: #000000;">&#125;</span><br />
&nbsp;<span style="color: #009900; font-style: italic;">// Every frame jetman will move vertically. (y axis)</span><br />
&nbsp;jetman<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">y</span> <span style="color: #000066; font-weight: bold;">+</span>= speed<span style="color: #000066; font-weight: bold;">;</span><br />
<br />
&nbsp;<span style="color: #009900; font-style: italic;">// If jetman is out of the screen</span><br />
&nbsp;<span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>jetman<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">y</span> <span style="color: #000066; font-weight: bold;">&amp;</span>gt<span style="color: #000066; font-weight: bold;">;</span> <span style="color: #000000; font-weight:bold;">450</span><span style="color: #000000;">&#41;</span><br />
&nbsp;<span style="color: #000000;">&#123;</span><br />
&nbsp;jetman<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">y</span> = <span style="color: #000000; font-weight:bold;">100</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp;<span style="color: #000000;">&#125;</span><br />
<span style="color: #000000;">&#125;</span><br />
<span style="color: #009900; font-style: italic;">// Add a event listener to launch the jetmanEnterFrame function every frames</span><br />
jetman<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Event</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">ENTER_FRAME</span><span style="color: #000066; font-weight: bold;">,</span> jetmanEnterFrame<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
<br />
<span style="color: #009900; font-style: italic;">// If the mouse is pressed</span><br />
<span style="color: #339966; font-weight: bold;">function</span> <span style="color: #004993;">mouseDown</span><span style="color: #000000;">&#40;</span>pEvt<span style="color: #000000;">&#41;</span><br />
<span style="color: #000000;">&#123;</span><br />
&nbsp;<span style="color: #009900; font-style: italic;">// Set boost to true</span><br />
&nbsp;boost = <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000066; font-weight: bold;">;</span><br />
<span style="color: #000000;">&#125;</span><br />
<span style="color: #009900; font-style: italic;">// Id the mouse is released</span><br />
<span style="color: #339966; font-weight: bold;">function</span> <span style="color: #004993;">mouseUp</span><span style="color: #000000;">&#40;</span>pEvt<span style="color: #000000;">&#41;</span><br />
<span style="color: #000000;">&#123;</span><br />
&nbsp;<span style="color: #009900; font-style: italic;">// Set boost to false</span><br />
&nbsp;boost = <span style="color: #0033ff; font-weight: bold;">false</span><span style="color: #000066; font-weight: bold;">;</span><br />
<span style="color: #000000;">&#125;</span><br />
<span style="color: #009900; font-style: italic;">// Detecting the mouse inputs (MOUSE_DOWN and MOUSE_UP) on the entire &quot;stage&quot;</span><br />
<span style="color: #004993;">stage</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">MouseEvent</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">MOUSE_DOWN</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">mouseDown</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
<span style="color: #004993;">stage</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">MouseEvent</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">MOUSE_UP</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">mouseUp</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></div></td></tr></tbody></table></div>
<ul>
<li>Finally test your game. (hit CTRL+ENTER)</li>
</ul>
<p>You should see that:</p>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_www.thisisgameplay.com_Jetman_step1_1480043338"
			class="flashmovie"
			width="550"
			height="400">
	<param name="movie" value="./wp-content/uploads/2009/12/www.thisisgameplay.com_Jetman_step1.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="./wp-content/uploads/2009/12/www.thisisgameplay.com_Jetman_step1.swf"
			name="fm_www.thisisgameplay.com_Jetman_step1_1480043338"
			width="550"
			height="400">
	<!--<![endif]-->
		
<p><a href="http://adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>

	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<p>Download the source file here:</p>
<p><a rel="attachment wp-att-694" href="http://www.benoitfreslon.com/how-to-make-a-game-like-jetman-step-1-the-jetman/www-thisisgameplay-com_jetman_step1/">[www.thisisgameplay.com]_Jetman_step1.fla</a></p>
<p>Download the compiled file here:</p>
<p><a rel="attachment wp-att-703" href="http://www.benoitfreslon.com/how-to-make-a-game-like-jetman-step-1-the-jetman/www-thisisgameplay-com_jetman_step1-2/">[www.thisisgameplay.com]_Jetman_step1.swf</a></p>
<p>Next step the level design&#8230; ;)</p>
<div id="_mcePaste" style="overflow: hidden; position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px;">http://photos-g.ak.fbcdn.net/photos-ak-sf2p/v43/106/4243149646/app_1_4243149646_252.gif</div>
]]></content:encoded>
			<wfw:commentRss>http://www.benoitfreslon.com/how-to-make-a-game-like-jetman-step-1-the-jetman/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
