<?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  - Game Design, Flash games, ActionScript tutorials ... &#187; jetman</title>
	<atom:link href="http://www.benoitfreslon.com/tag/jetman/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.benoitfreslon.com</link>
	<description>Indie Game developer, learn Flash &#38; ActionScript with tutorials ...</description>
	<lastBuildDate>Mon, 16 Jan 2012 16:50:31 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Tutorial: How to make a game like Jetman – step 1 – The Jetman</title>
		<link>http://www.benoitfreslon.com/tutorial-how-to-make-a-game-like-jetman-%e2%80%93-step-1-%e2%80%93-the-jetman</link>
		<comments>http://www.benoitfreslon.com/tutorial-how-to-make-a-game-like-jetman-%e2%80%93-step-1-%e2%80%93-the-jetman#comments</comments>
		<pubDate>Fri, 18 Dec 2009 17:06:36 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[ActionScript3 as3]]></category>
		<category><![CDATA[Game Design]]></category>
		<category><![CDATA[Tip]]></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 [...]]]></description>
			<content:encoded><![CDATA[<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.benoitfreslon.com%2Ftutorial-how-to-make-a-game-like-jetman-%25e2%2580%2593-step-1-%25e2%2580%2593-the-jetman&amp;title=Tutorial%3A%20How%20to%20make%20a%20game%20like%20Jetman%20%E2%80%93%20step%201%20%E2%80%93%20The%20Jetman" id="wpa2a_2"><img src="http://www.benoitfreslon.com/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p><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 width="425" height="344" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" 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 width="425" height="344" type="application/x-shockwave-flash" src="http://www.youtube.com/v/ZWvvJc09jzs&amp;hl=fr_FR&amp;fs=1&amp;" allowFullScreen="true" allowscriptaccess="always" allowfullscreen="true" /></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 href="http://www.benoitfreslon.com/tutorial-how-to-make-a-game-like-jetman-%e2%80%93-step-1-%e2%80%93-the-jetman/create_box-2/" rel="attachment wp-att-552"><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 href="http://www.benoitfreslon.com/tutorial-how-to-make-a-game-like-jetman-%e2%80%93-step-1-%e2%80%93-the-jetman/instance/" rel="attachment wp-att-554"><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 href="http://www.benoitfreslon.com/tutorial-how-to-make-a-game-like-jetman-%e2%80%93-step-1-%e2%80%93-the-jetman/instance_name/" rel="attachment wp-att-555"><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 href="http://www.benoitfreslon.com/tutorial-how-to-make-a-game-like-jetman-%e2%80%93-step-1-%e2%80%93-the-jetman/layer/" rel="attachment wp-att-556"><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 .codecolorer" 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 /></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> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// If boost == true</span><br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>boost<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// The speed changes</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; speed = speedBoost<span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span> <span style="color: #0033ff; font-weight: bold;">else</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// Else the gravity decrease jetman's speed</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; speed <span style="color: #000066; font-weight: bold;">+</span>= &nbsp;gravity<span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// If the current speed is to hi</span><br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>speed <span style="color: #000066; font-weight: bold;">&gt;</span> speedMax<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// Limit the speed</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; speed = speedMax<span style="color: #000066; font-weight: bold;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// If the current speed is to low</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span> <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;">&lt;</span> <span style="color: #000066; font-weight: bold;">-</span>speedMax<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// Limit the speed</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; speed = &nbsp;<span style="color: #000066; font-weight: bold;">-</span> &nbsp;speedMax<span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// Every frame jetman will move vertically. (y axis)</span><br />
&nbsp; &nbsp; jetman<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">y</span> <span style="color: #000066; font-weight: bold;">+</span>= &nbsp;speed<span style="color: #000066; font-weight: bold;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// If jetman is out of the screen</span><br />
&nbsp; &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;">&gt;</span> <span style="color: #000000; font-weight:bold;">450</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &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; &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> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// Set boost to true</span><br />
&nbsp; &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> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// Set boost to false</span><br />
&nbsp; &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_831520599"
			class="flashmovie"
			width="550"
			height="400">
	<param name="movie" value="http://www.benoitfreslon.com/wp-content/uploads/2009/12/www.thisisgameplay.com_Jetman_step1.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="http://www.benoitfreslon.com/wp-content/uploads/2009/12/www.thisisgameplay.com_Jetman_step1.swf"
			name="fm_www.thisisgameplay.com_Jetman_step1_831520599"
			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 href="http://www.benoitfreslon.com/tutorial-how-to-make-a-game-like-jetman-%e2%80%93-step-1-%e2%80%93-the-jetman/www-thisisgameplay-com_jetman_step1/" rel="attachment wp-att-694">[www.thisisgameplay.com]_Jetman_step1.fla</a></p>
<p>Download the compiled file here:</p>
<p><a href="http://www.benoitfreslon.com/tutorial-how-to-make-a-game-like-jetman-%e2%80%93-step-1-%e2%80%93-the-jetman/www-thisisgameplay-com_jetman_step1-2/" rel="attachment wp-att-703">[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/tutorial-how-to-make-a-game-like-jetman-%e2%80%93-step-1-%e2%80%93-the-jetman/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

