<?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>parpue.net &#187; Box2D</title>
	<atom:link href="http://parpue.net/tag/box2d/feed" rel="self" type="application/rss+xml" />
	<link>http://parpue.net</link>
	<description>Flash, Flex, デザイン等自分の好きなことを好きなようにやってます</description>
	<lastBuildDate>Wed, 12 Aug 2009 17:46:04 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Box2d で風雨に揺れる葉っぱのようなもの</title>
		<link>http://parpue.net/web/329</link>
		<comments>http://parpue.net/web/329#comments</comments>
		<pubDate>Thu, 23 Oct 2008 07:57:30 +0000</pubDate>
		<dc:creator>okm</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[WEB]]></category>
		<category><![CDATA[actionscript3]]></category>
		<category><![CDATA[Box2D]]></category>
		<category><![CDATA[Flex3]]></category>

		<guid isPermaLink="false">http://parpue.net/?p=329</guid>
		<description><![CDATA[				なんか夏休みろくにとれなかったので、
				最近インドネシアはバリ島に遊びに行ってました。
				バリ島は雨季が近いということでスコールも1度味わってきました。
				というわけで、雨と風にたなびく葉っぱのようなものを強引にBox2Dで作ってみました。
				雨粒のあたり判定が甘いのは仕様です。
				ちょっとこれを使ってまた別のものを作ろうと考えています。
				
				↓　以下、種明かしのようなもの
				
				これをみると、いかに強引かがわかりますね。
				ただBox2Dを使うことで、強引でも簡単にそれっぽいものができると思います。
				　
				今回は回転ジョイントを用意し、常に葉っぱの先端部分の棒が右回転する力を加えました。
				その棒に対して、重りを加え、ときどき重りに下向きの力を加えることによって、
				風を受けている感じを表現している・・・つもりです。
				以下ソースコード・・・強引です。
				FlowLeafを呼び出す Box2DWorldTestクラス
				&#62;&#62;text
				ACTIONSCRIPT:
				
				
				
				package &#123;
				&#160; &#160; import Box2D.Collision.Shapes.b2CircleDef;
				&#160; &#160; import Box2D.Collision.Shapes.b2PolygonDef;
				&#160; &#160; import Box2D.Collision.b2AABB;
				&#160; &#160; import Box2D.Common.Math.b2Vec2;
				&#160; &#160; import Box2D.Dynamics.b2Body;
				&#160; &#160; import Box2D.Dynamics.b2BodyDef;
				&#160; &#160; import Box2D.Dynamics.b2DebugDraw;
				&#160; &#160; import Box2D.Dynamics.b2World;
				&#160; &#160; 
				&#160; &#160; import flash.display.Sprite;
				&#160; &#160; import flash.display.StageAlign;
				&#160; &#160; import flash.events.Event;
				&#160; &#160; import flash.events.MouseEvent;
				&#160; &#160; import flash.utils.*;
				&#160; &#160; 
				&#160; &#160; public class Box2DWorldTest extends Sprite
				&#160; &#160; &#123;
				&#160; &#160;  [...]]]></description>
			<content:encoded><![CDATA[				<p>なんか夏休みろくにとれなかったので、<br />
				最近インドネシアはバリ島に遊びに行ってました。</p>
				<p>バリ島は雨季が近いということでスコールも1度味わってきました。</p>
				<p>というわけで、雨と風にたなびく葉っぱのようなものを強引にBox2Dで作ってみました。<br />
				雨粒のあたり判定が甘いのは仕様です。<br />
				ちょっとこれを使ってまた別のものを作ろうと考えています。</p>
				<p><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="Box2DWorldTest" width="340" height="320" codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab"><param name="movie" value="http://parpue.net/wp-content/uploads/box2dworldtest.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#f0f0ff" /><param name="allowScriptAccess" value="sameDomain" /><embed src="http://parpue.net/wp-content/uploads/box2dworldtest.swf" quality="high" bgcolor="#f0f0ff" width="340" height="320" name="Box2DWorldTest" align="middle" play="true" loop="false" quality="high" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer"></embed></object></p>
				<p>↓　以下、種明かしのようなもの<br />
				<span id="more-329"></span></p>
				<p>これをみると、いかに強引かがわかりますね。<br />
				ただBox2Dを使うことで、強引でも簡単にそれっぽいものができると思います。</p>
				<p><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="Box2DWorldTest" width="340" height="320" codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab"><param name="movie" value="http://parpue.net/wp-content/uploads/box2dworldtestdeb.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#f0f0ff" /><param name="allowScriptAccess" value="sameDomain" /><embed src="http://parpue.net/wp-content/uploads/box2dworldtestdeb.swf" quality="high" bgcolor="#f0f0ff" width="340" height="320" name="Box2DWorldTest" align="middle" play="true" loop="false" quality="high" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer"></embed></object>　<img src="http://parpue.net/wp-content/uploads/flowleaf.png" alt="" title="flowleaf" width="253" height="250" class="alignnone size-full wp-image-336" style="border:solid 1px #CCC"/></p>
				<p>今回は回転ジョイントを用意し、常に葉っぱの先端部分の棒が右回転する力を加えました。<br />
				その棒に対して、重りを加え、ときどき重りに下向きの力を加えることによって、<br />
				風を受けている感じを表現している・・・つもりです。</p>
				<p>以下ソースコード・・・強引です。</p>
				<p>FlowLeafを呼び出す Box2DWorldTestクラス</p>
				<div class="igBar"><span id="lactionscript-3"><a href="#" onclick="javascript:showPlainTxt('actionscript-3'); return false;">&gt;&gt;text</a></span></div>
				<div class="syntax_hilite"><span class="langName">ACTIONSCRIPT:</span>
				<div id="actionscript-3">
				<div class="actionscript">
				<ol style="margin:0px; padding:0px" >
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">package <span style="color: #66cc66;">&#123;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> Box2D.<span style="color: #006600;">Collision</span>.<span style="color: #006600;">Shapes</span>.<span style="color: #006600;">b2CircleDef</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> Box2D.<span style="color: #006600;">Collision</span>.<span style="color: #006600;">Shapes</span>.<span style="color: #006600;">b2PolygonDef</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> Box2D.<span style="color: #006600;">Collision</span>.<span style="color: #006600;">b2AABB</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> Box2D.<span style="color: #006600;">Common</span>.<span style="color: #0066CC;">Math</span>.<span style="color: #006600;">b2Vec2</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> Box2D.<span style="color: #006600;">Dynamics</span>.<span style="color: #006600;">b2Body</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> Box2D.<span style="color: #006600;">Dynamics</span>.<span style="color: #006600;">b2BodyDef</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> Box2D.<span style="color: #006600;">Dynamics</span>.<span style="color: #006600;">b2DebugDraw</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> Box2D.<span style="color: #006600;">Dynamics</span>.<span style="color: #006600;">b2World</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">Sprite</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">StageAlign</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #006600;">Event</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #006600;">MouseEvent</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">utils</span>.*;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Box2DWorldTest <span style="color: #0066CC;">extends</span> Sprite</li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> world:b2World;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">floor</span>:b2Body;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> leafArea:Sprite;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> dropArea:Sprite;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> drop:b2Body;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> circleDef:b2BodyDef;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> dropShapeDef:b2CircleDef;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> f1:FlowLeaf;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> f2:FlowLeaf;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> f3:FlowLeaf;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> Box2DWorldTest<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">stage</span>.<span style="color: #0066CC;">scaleMode</span> = <span style="color: #ff0000;">"noScale"</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">stage</span>.<span style="color: #0066CC;">align</span> = StageAlign.<span style="color: #006600;">TOP_LEFT</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; leafArea = <span style="color: #000000; font-weight: bold;">new</span> Sprite;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dropArea = <span style="color: #000000; font-weight: bold;">new</span> Sprite;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">this</span>.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span>dropArea<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">this</span>.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span>leafArea<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 縦横2００メートルの世界を作成</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> worldAABB:b2AABB = <span style="color: #000000; font-weight: bold;">new</span> b2AABB<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; worldAABB.<span style="color: #006600;">lowerBound</span>.<span style="color: #0066CC;">Set</span><span style="color: #66cc66;">&#40;</span>-<span style="color: #cc66cc;color:#800000;">100</span>, -<span style="color: #cc66cc;color:#800000;">100</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; worldAABB.<span style="color: #006600;">upperBound</span>.<span style="color: #0066CC;">Set</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">100</span>, <span style="color: #cc66cc;color:#800000;">100</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 重力を下方向に10m/s^2とする 今回は風の感じで右方向にも1m/s^2</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> gravity:b2Vec2 = <span style="color: #000000; font-weight: bold;">new</span> b2Vec2<span style="color: #66cc66;">&#40;</span>-<span style="color: #cc66cc;color:#800000;">1</span>, <span style="color: #cc66cc;color:#800000;">10</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 外枠と重力を指定して、物理エンジン全体をセットアップする</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; world = <span style="color: #000000; font-weight: bold;">new</span> b2World<span style="color: #66cc66;">&#40;</span>worldAABB, gravity, <span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; f1 = <span style="color: #000000; font-weight: bold;">new</span> FlowLeaf<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">5</span>, <span style="color: #cc66cc;color:#800000;">7</span>, <span style="color: #cc66cc;color:#800000;">2</span>, <span style="color: #cc66cc;color:#800000;">4</span>, <span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">5</span>, world, <span style="color: #ff0000;">"leaf"</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; leafArea.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span>f1<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; f2 = <span style="color: #000000; font-weight: bold;">new</span> FlowLeaf<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">4</span>, <span style="color: #cc66cc;color:#800000;">7</span>, <span style="color: #cc66cc;color:#800000;">2</span>, <span style="color: #cc66cc;color:#800000;">3</span>, <span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">5</span>, world, <span style="color: #ff0000;">"leaf"</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; leafArea.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span>f2<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; f3 = <span style="color: #000000; font-weight: bold;">new</span> FlowLeaf<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">3</span>, <span style="color: #cc66cc;color:#800000;">7</span>, <span style="color: #cc66cc;color:#800000;">2</span>, <span style="color: #cc66cc;color:#800000;">3</span>, <span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">5</span>, world, <span style="color: #ff0000;">"leaf"</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; leafArea.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span>f3<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> debugDraw:b2DebugDraw = <span style="color: #000000; font-weight: bold;">new</span> b2DebugDraw;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; debugDraw.<span style="color: #006600;">m_sprite</span> = <span style="color: #0066CC;">this</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; debugDraw.<span style="color: #006600;">m_drawScale</span> = <span style="color: #cc66cc;color:#800000;">45</span>; <span style="color: #808080; font-style: italic;">// 1mを45ピクセルにする</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; debugDraw.<span style="color: #006600;">m_fillAlpha</span> = <span style="color: #cc66cc;color:#800000;">60</span>; <span style="color: #808080; font-style: italic;">// 不透明度</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; debugDraw.<span style="color: #006600;">m_lineThickness</span> = <span style="color: #cc66cc;color:#800000;">2</span>; <span style="color: #808080; font-style: italic;">// 線の太さ</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; debugDraw.<span style="color: #006600;">m_drawFlags</span> = b2DebugDraw.<span style="color: #006600;">e_shapeBit</span> | b2DebugDraw.<span style="color: #006600;">e_jointBit</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; world.<span style="color: #006600;">SetDebugDraw</span><span style="color: #66cc66;">&#40;</span>debugDraw<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">this</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>Event.<span style="color: #006600;">ENTER_FRAME</span>, enterFrameHandler<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; circleDef = <span style="color: #000000; font-weight: bold;">new</span> b2BodyDef<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; circleDef.<span style="color: #006600;">userData</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Object</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; circleDef.<span style="color: #006600;">userData</span>.<span style="color: #006600;">id</span> = <span style="color: #ff0000;">"circle"</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> spt:Sprite = <span style="color: #000000; font-weight: bold;">new</span> Sprite;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; spt.<span style="color: #006600;">graphics</span>.<span style="color: #0066CC;">lineStyle</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">1</span>, 0x6481F5<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; spt.<span style="color: #006600;">graphics</span>.<span style="color: #0066CC;">beginFill</span><span style="color: #66cc66;">&#40;</span>0x6481f5, <span style="color: #cc66cc;color:#800000;">50</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; spt.<span style="color: #006600;">graphics</span>.<span style="color: #006600;">drawCircle</span><span style="color: #66cc66;">&#40;</span> <span style="color: #cc66cc;color:#800000;">0</span>, <span style="color: #cc66cc;color:#800000;">0</span>, <span style="color: #cc66cc;color:#800000;">4</span> <span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; spt.<span style="color: #006600;">graphics</span>.<span style="color: #0066CC;">endFill</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; spt.<span style="color: #006600;">y</span> = -<span style="color: #cc66cc;color:#800000;">10</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; circleDef.<span style="color: #006600;">userData</span>.<span style="color: #006600;">spt</span> = spt;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dropArea.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span>spt<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> randomX = <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">floor</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">random</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>*<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">240</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>+<span style="color: #cc66cc;color:#800000;">100</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; circleDef.<span style="color: #0066CC;">position</span>.<span style="color: #0066CC;">Set</span><span style="color: #66cc66;">&#40;</span>randomX / <span style="color: #cc66cc;color:#800000;">45</span>, -<span style="color: #cc66cc;color:#800000;">10</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dropShapeDef = <span style="color: #000000; font-weight: bold;">new</span> b2CircleDef;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dropShapeDef.<span style="color: #006600;">radius</span> = <span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">15</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dropShapeDef.<span style="color: #006600;">restitution</span> = <span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">2</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dropShapeDef.<span style="color: #006600;">density</span> = <span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">5</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; drop = world.<span style="color: #006600;">CreateBody</span><span style="color: #66cc66;">&#40;</span>circleDef<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; drop.<span style="color: #006600;">CreateShape</span><span style="color: #66cc66;">&#40;</span>dropShapeDef<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; drop.<span style="color: #006600;">SetMassFromShapes</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">setInterval</span><span style="color: #66cc66;">&#40;</span>dropRain, <span style="color: #cc66cc;color:#800000;">2500</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> dropRain<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><span style="color: #66cc66;">&#123;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; world.<span style="color: #006600;">DestroyBody</span><span style="color: #66cc66;">&#40;</span>drop<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> randomX:<span style="color: #0066CC;">Number</span> = <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">floor</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">random</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>*<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">240</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>+<span style="color: #cc66cc;color:#800000;">100</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; circleDef.<span style="color: #0066CC;">position</span>.<span style="color: #0066CC;">Set</span><span style="color: #66cc66;">&#40;</span>randomX / <span style="color: #cc66cc;color:#800000;">45</span>, -<span style="color: #cc66cc;color:#800000;">10</span> / <span style="color: #cc66cc;color:#800000;">45</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; drop = world.<span style="color: #006600;">CreateBody</span><span style="color: #66cc66;">&#40;</span>circleDef<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; drop.<span style="color: #006600;">CreateShape</span><span style="color: #66cc66;">&#40;</span>dropShapeDef<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; drop.<span style="color: #006600;">SetMassFromShapes</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> enterFrameHandler<span style="color: #66cc66;">&#40;</span>event:Event<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> bb:b2Body = world.<span style="color: #006600;">m_bodyList</span>; bb; bb = bb.<span style="color: #006600;">m_next</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>bb.<span style="color: #006600;">m_userData</span> != <span style="color: #000000; font-weight: bold;">null</span> &amp;&amp; bb.<span style="color: #006600;">m_userData</span>.<span style="color: #006600;">spt</span> is Sprite<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;bb.<span style="color: #006600;">m_userData</span>.<span style="color: #006600;">spt</span>.<span style="color: #006600;">x</span> = bb.<span style="color: #006600;">GetPosition</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">x</span> * <span style="color: #cc66cc;color:#800000;">45</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;bb.<span style="color: #006600;">m_userData</span>.<span style="color: #006600;">spt</span>.<span style="color: #006600;">y</span> = bb.<span style="color: #006600;">GetPosition</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">y</span> * <span style="color: #cc66cc;color:#800000;">45</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #66cc66;">&#125;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #66cc66;">&#125;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">random</span> = <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">floor</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">random</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>*<span style="color: #cc66cc;color:#800000;">10</span><span style="color: #66cc66;">&#41;</span>+<span style="color: #cc66cc;color:#800000;">1</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">random</span> == <span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; f1.<span style="color: #006600;">wind</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">2</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; f2.<span style="color: #006600;">wind</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">2</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; f3.<span style="color: #006600;">wind</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">2</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span> </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; world.<span style="color: #006600;">Step</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">1</span> / <span style="color: #cc66cc;color:#800000;">24</span>, <span style="color: #cc66cc;color:#800000;">10</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><span style="color: #66cc66;">&#125;</span> </li>
				</ol>
				</div>
				</div>
				</div>
				<p>FlowLeaf 葉っぱ一枚分</p>
				<div class="igBar"><span id="lactionscript-4"><a href="#" onclick="javascript:showPlainTxt('actionscript-4'); return false;">&gt;&gt;text</a></span></div>
				<div class="syntax_hilite"><span class="langName">ACTIONSCRIPT:</span>
				<div id="actionscript-4">
				<div class="actionscript">
				<ol style="margin:0px; padding:0px" >
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">package</li>
				<li style="color:#26536A;"><span style="color: #66cc66;">&#123;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> Box2D.<span style="color: #006600;">Collision</span>.<span style="color: #006600;">Shapes</span>.<span style="color: #006600;">b2CircleDef</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> Box2D.<span style="color: #006600;">Collision</span>.<span style="color: #006600;">Shapes</span>.<span style="color: #006600;">b2PolygonDef</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> Box2D.<span style="color: #006600;">Common</span>.<span style="color: #0066CC;">Math</span>.<span style="color: #006600;">b2Vec2</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> Box2D.<span style="color: #006600;">Dynamics</span>.<span style="color: #006600;">Joints</span>.<span style="color: #006600;">b2DistanceJointDef</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> Box2D.<span style="color: #006600;">Dynamics</span>.<span style="color: #006600;">Joints</span>.<span style="color: #006600;">b2RevoluteJoint</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> Box2D.<span style="color: #006600;">Dynamics</span>.<span style="color: #006600;">Joints</span>.<span style="color: #006600;">b2RevoluteJointDef</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> Box2D.<span style="color: #006600;">Dynamics</span>.<span style="color: #006600;">b2Body</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> Box2D.<span style="color: #006600;">Dynamics</span>.<span style="color: #006600;">b2BodyDef</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> Box2D.<span style="color: #006600;">Dynamics</span>.<span style="color: #006600;">b2World</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">Sprite</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #006600;">Event</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">utils</span>.*;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> FlowLeaf <span style="color: #0066CC;">extends</span> Sprite</li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> flowBody:b2Body;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> fixedBody:b2Body;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> sinker:b2Body;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">_height</span>:<span style="color: #0066CC;">Number</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">_width</span>:<span style="color: #0066CC;">Number</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">_x</span>:<span style="color: #0066CC;">Number</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">_y</span>:<span style="color: #0066CC;">Number</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> barSize:<span style="color: #0066CC;">Number</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> bend:<span style="color: #0066CC;">Number</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> FlowLeaf<span style="color: #66cc66;">&#40;</span>x:<span style="color: #0066CC;">Number</span>,y:<span style="color: #0066CC;">Number</span>,<span style="color: #0066CC;">width</span>:<span style="color: #0066CC;">Number</span>, <span style="color: #0066CC;">height</span>:<span style="color: #0066CC;">Number</span>, bend:<span style="color: #0066CC;">Number</span>, world:b2World, id:<span style="color: #0066CC;">String</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; barSize = <span style="color: #0066CC;">width</span>/<span style="color: #cc66cc;color:#800000;">10</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">this</span>.<span style="color: #006600;">x</span> = <span style="color: #cc66cc;color:#800000;">45</span> * x;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">this</span>.<span style="color: #006600;">y</span> = <span style="color: #cc66cc;color:#800000;">45</span> * y;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">this</span>.<span style="color: #0066CC;">_height</span> = <span style="color: #0066CC;">height</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">this</span>.<span style="color: #0066CC;">_width</span> = <span style="color: #0066CC;">width</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">this</span>.<span style="color: #0066CC;">_x</span> = x;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">this</span>.<span style="color: #0066CC;">_y</span> = y;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">this</span>,bend = bend;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> fixedBodyDef:b2BodyDef = <span style="color: #000000; font-weight: bold;">new</span> b2BodyDef;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fixedBodyDef.<span style="color: #006600;">userData</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Object</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fixedBodyDef.<span style="color: #006600;">userData</span>.<span style="color: #006600;">id</span> = id;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fixedBodyDef.<span style="color: #0066CC;">position</span>.<span style="color: #0066CC;">Set</span><span style="color: #66cc66;">&#40;</span>x - barSize * <span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">5</span>, y - <span style="color: #0066CC;">height</span> * bend * <span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">5</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> fixedBodyPolygonDef:b2PolygonDef = <span style="color: #000000; font-weight: bold;">new</span> b2PolygonDef<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fixedBodyPolygonDef.<span style="color: #006600;">friction</span> = <span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">1</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fixedBodyPolygonDef.<span style="color: #006600;">density</span> = <span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">1</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fixedBodyPolygonDef.<span style="color: #006600;">SetAsBox</span><span style="color: #66cc66;">&#40;</span>barSize * <span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">5</span>, <span style="color: #0066CC;">height</span> * bend * <span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">5</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fixedBodyPolygonDef.<span style="color: #006600;">filter</span>.<span style="color: #006600;">maskBits</span> = 0x01;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fixedBodyPolygonDef.<span style="color: #006600;">filter</span>.<span style="color: #006600;">categoryBits</span> = 0x01;&nbsp;&nbsp;&nbsp;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fixedBody = world.<span style="color: #006600;">CreateBody</span><span style="color: #66cc66;">&#40;</span>fixedBodyDef<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fixedBody.<span style="color: #006600;">CreateShape</span><span style="color: #66cc66;">&#40;</span>fixedBodyPolygonDef<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> flowBodyDef:b2BodyDef = <span style="color: #000000; font-weight: bold;">new</span> b2BodyDef;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; flowBodyDef.<span style="color: #006600;">userData</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Object</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; flowBodyDef.<span style="color: #006600;">userData</span>.<span style="color: #006600;">id</span> = id;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; flowBodyDef.<span style="color: #0066CC;">position</span>.<span style="color: #0066CC;">Set</span><span style="color: #66cc66;">&#40;</span>x - <span style="color: #0066CC;">width</span>, y - <span style="color: #0066CC;">height</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> flowBodyPolygonDef:b2PolygonDef = <span style="color: #000000; font-weight: bold;">new</span> b2PolygonDef;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; flowBodyPolygonDef.<span style="color: #006600;">vertices</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #0066CC;">Set</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">0</span>,<span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; flowBodyPolygonDef.<span style="color: #006600;">vertices</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #0066CC;">Set</span><span style="color: #66cc66;">&#40;</span>barSize*<span style="color: #cc66cc;color:#800000;">2</span>, <span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; flowBodyPolygonDef.<span style="color: #006600;">vertices</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">2</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #0066CC;">Set</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">width</span> , <span style="color: #0066CC;">height</span> - <span style="color: #0066CC;">height</span> * bend<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; flowBodyPolygonDef.<span style="color: #006600;">vertices</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">3</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #0066CC;">Set</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">width</span> -barSize*<span style="color: #cc66cc;color:#800000;">2</span>, <span style="color: #0066CC;">height</span> - <span style="color: #0066CC;">height</span> * bend<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; flowBodyPolygonDef.<span style="color: #006600;">vertexCount</span> = <span style="color: #cc66cc;color:#800000;">4</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; flowBodyPolygonDef.<span style="color: #006600;">friction</span> = <span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">5</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; flowBodyPolygonDef.<span style="color: #006600;">density</span> = <span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">1</span>;</li>
				<li style="color:#26536A;">&nbsp;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;flowBody = world.<span style="color: #006600;">CreateBody</span><span style="color: #66cc66;">&#40;</span>flowBodyDef<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;flowBody.<span style="color: #006600;">CreateShape</span><span style="color: #66cc66;">&#40;</span>flowBodyPolygonDef<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;flowBody.<span style="color: #006600;">SetMassFromShapes</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">var</span> sinkerBodyDef:b2BodyDef = <span style="color: #000000; font-weight: bold;">new</span> b2BodyDef;</li>
				<li style="color:#26536A;">&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;sinkerBodyDef.<span style="color: #006600;">userData</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Object</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;sinkerBodyDef.<span style="color: #006600;">userData</span>.<span style="color: #006600;">id</span> = id + <span style="color: #ff0000;">"_sinker"</span>;</li>
				<li style="color:#26536A;">&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;sinkerBodyDef.<span style="color: #0066CC;">position</span>.<span style="color: #0066CC;">Set</span><span style="color: #66cc66;">&#40;</span>x - <span style="color: #0066CC;">width</span> +barSize , y - <span style="color: #0066CC;">height</span> * bend<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;</li>
				<li style="color:#26536A;">&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">var</span> sinkerShapeDef:b2CircleDef = <span style="color: #000000; font-weight: bold;">new</span> b2CircleDef;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;sinkerShapeDef.<span style="color: #006600;">radius</span> = barSize;</li>
				<li style="color:#26536A;">&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;sinkerShapeDef.<span style="color: #006600;">density</span> = <span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">5</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;sinkerShapeDef.<span style="color: #006600;">filter</span>.<span style="color: #006600;">maskBits</span> = 0x00;</li>
				<li style="color:#26536A;">&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;sinker = world.<span style="color: #006600;">CreateBody</span><span style="color: #66cc66;">&#40;</span>sinkerBodyDef<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;sinker.<span style="color: #006600;">CreateShape</span><span style="color: #66cc66;">&#40;</span>sinkerShapeDef<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp;</li>
				<li style="color:#26536A;">&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;sinker.<span style="color: #006600;">SetMassFromShapes</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> jointDef:b2RevoluteJointDef = <span style="color: #000000; font-weight: bold;">new</span> b2RevoluteJointDef;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; jointDef.<span style="color: #006600;">motorSpeed</span> = <span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">3</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; jointDef.<span style="color: #006600;">maxMotorTorque</span> = <span style="color: #cc66cc;color:#800000;">5</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; jointDef.<span style="color: #006600;">enableMotor</span> = <span style="color: #000000; font-weight: bold;">true</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; jointDef.<span style="color: #006600;">lowerAngle</span> = -<span style="color: #cc66cc;color:#800000;">20</span> * <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">PI</span> / <span style="color: #cc66cc;color:#800000;">180</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;jointDef.<span style="color: #006600;">upperAngle</span> = <span style="color: #cc66cc;color:#800000;">15</span> * <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">PI</span> / <span style="color: #cc66cc;color:#800000;">180</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;jointDef.<span style="color: #006600;">enableLimit</span> = <span style="color: #000000; font-weight: bold;">true</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;jointDef.<span style="color: #006600;">Initialize</span><span style="color: #66cc66;">&#40;</span>fixedBody, flowBody, <span style="color: #000000; font-weight: bold;">new</span> b2Vec2<span style="color: #66cc66;">&#40;</span>flowBody.<span style="color: #006600;">GetPosition</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">x</span> + <span style="color: #0066CC;">width</span> - barSize / <span style="color: #cc66cc;color:#800000;">2</span>, flowBody.<span style="color: #006600;">GetPosition</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">y</span> + <span style="color: #0066CC;">height</span> * bend<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #000000; font-weight: bold;">var</span> joint:b2RevoluteJoint = b2RevoluteJoint<span style="color: #66cc66;">&#40;</span>world.<span style="color: #006600;">CreateJoint</span><span style="color: #66cc66;">&#40;</span>jointDef<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;&nbsp; &nbsp;&nbsp;&nbsp;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #000000; font-weight: bold;">var</span> sinkerJointDef:b2DistanceJointDef = <span style="color: #000000; font-weight: bold;">new</span> b2DistanceJointDef;</li>
				<li style="color:#26536A;">&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;sinkerJointDef.<span style="color: #006600;">Initialize</span><span style="color: #66cc66;">&#40;</span>flowBody, sinker, flowBody.<span style="color: #006600;">GetPosition</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>, sinker.<span style="color: #006600;">GetPosition</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #000000; font-weight: bold;">var</span> sinkerJoint = world.<span style="color: #006600;">CreateJoint</span><span style="color: #66cc66;">&#40;</span>sinkerJointDef<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0066CC;">this</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>Event.<span style="color: #006600;">ENTER_FRAME</span>, enterFrameHandler<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> enterFrameHandler<span style="color: #66cc66;">&#40;</span>event:Event<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">this</span>.<span style="color: #006600;">graphics</span>.<span style="color: #0066CC;">clear</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">this</span>.<span style="color: #006600;">graphics</span>.<span style="color: #0066CC;">lineStyle</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">1</span>,0x66FF66<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">this</span>.<span style="color: #006600;">graphics</span>.<span style="color: #0066CC;">beginFill</span><span style="color: #66cc66;">&#40;</span>0xCCFFCC, <span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">8</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">this</span>.<span style="color: #006600;">graphics</span>.<span style="color: #0066CC;">curveTo</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">0</span>, - <span style="color: #0066CC;">_height</span> * <span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">8</span> * <span style="color: #cc66cc;color:#800000;">45</span>,<span style="color: #66cc66;">&#40;</span>flowBody.<span style="color: #006600;">GetPosition</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">x</span> - <span style="color: #0066CC;">_x</span> <span style="color: #66cc66;">&#41;</span> * <span style="color: #cc66cc;color:#800000;">45</span>, <span style="color: #66cc66;">&#40;</span>flowBody.<span style="color: #006600;">GetPosition</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">y</span> - <span style="color: #0066CC;">_y</span> <span style="color: #66cc66;">&#41;</span>* <span style="color: #cc66cc;color:#800000;">45</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">this</span>.<span style="color: #006600;">graphics</span>.<span style="color: #0066CC;">curveTo</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">0</span> - barSize * <span style="color: #cc66cc;color:#800000;">4</span> * <span style="color: #cc66cc;color:#800000;">45</span>, - <span style="color: #0066CC;">_height</span> * <span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">8</span> * <span style="color: #cc66cc;color:#800000;">45</span>,<span style="color: #cc66cc;color:#800000;">0</span> - barSize * <span style="color: #cc66cc;color:#800000;">4</span> * <span style="color: #cc66cc;color:#800000;">45</span>, <span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">this</span>.<span style="color: #006600;">graphics</span>.<span style="color: #0066CC;">lineTo</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">0</span>,<span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">this</span>.<span style="color: #006600;">graphics</span>.<span style="color: #0066CC;">endFill</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> wind<span style="color: #66cc66;">&#40;</span>power:<span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><span style="color: #66cc66;">&#123;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sinker.<span style="color: #006600;">m_linearVelocity</span>.<span style="color: #006600;">y</span> = power;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="color:#26536A;">&nbsp;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="color:#26536A;"><span style="color: #66cc66;">&#125;</span> </li>
				</ol>
				</div>
				</div>
				</div>
]]></content:encoded>
			<wfw:commentRss>http://parpue.net/web/329/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Box2D オブジェクトにオブジェクトをあてて回転させる</title>
		<link>http://parpue.net/web/318</link>
		<comments>http://parpue.net/web/318#comments</comments>
		<pubDate>Tue, 30 Sep 2008 19:04:45 +0000</pubDate>
		<dc:creator>okm</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[WEB]]></category>
		<category><![CDATA[Box2D]]></category>
		<category><![CDATA[Flex3]]></category>

		<guid isPermaLink="false">http://parpue.net/?p=318</guid>
		<description><![CDATA[				久々に、、、Box2Dさわってみた。
				これの続きです。
				ってマジで久しぶりだ(^-^;;
				今までジョイントには全く手を出さなかったので、
				モノがぶつかると回転するオブジェクトを追加 [...]]]></description>
			<content:encoded><![CDATA[				<p>久々に、、、Box2Dさわってみた。</p>
				<p><a href="http://parpue.net/web/46">これ</a>の続きです。<br />
				ってマジで久しぶりだ(^-^;;</p>
				<p>今までジョイントには全く手を出さなかったので、<br />
				モノがぶつかると回転するオブジェクトを追加してみました。</p>
				<p><a href="http://parpue.net/wp-content/uploads/labylins4.png" rel="shadowbox[post-318];player=img;"><img src="http://parpue.net/wp-content/uploads/labylins4-300x215.png" alt="" title="labylins4" width="300" height="215" class="alignnone size-medium wp-image-319" /></a></p>
				<p>音符がぶつかることで障害物が回転します。</p>
				<p>↓以下動くものと、一部のソース<br />
				<span id="more-318"></span></p>
				<p><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="LabyrinsSuite" width="630" height="450" codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab"><param name="movie" value="http://parpue.net/wp-content/uploads/labyrinssuite6.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#ffcc66" /><param name="allowScriptAccess" value="sameDomain" /><embed src="http://parpue.net/wp-content/uploads/labyrinssuite6.swf" quality="high" bgcolor="#ffcc66" width="630" height="450" name="LabyrinsSuite" align="middle" play="true" loop="false" quality="high" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer"></embed></object></p>
				<p>画面クリックで開始、<br />
				<strong>[←][→]キーで移動、半角[s]キーでジャンプ</strong>です。</p>
				<p>以前公開したコードに、<br />
				以下のように回転するジョイントを追加しているだけです。</p>
				<p>四角を物理世界につくって、別のオブジェクトとジョイント！</p>
				<div class="igBar"><span id="lactionscript-6"><a href="#" onclick="javascript:showPlainTxt('actionscript-6'); return false;">&gt;&gt;text</a></span></div>
				<div class="syntax_hilite"><span class="langName">ACTIONSCRIPT:</span>
				<div id="actionscript-6">
				<div class="actionscript">
				<ol style="margin:0px; padding:0px" >
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><span style="color: #808080; font-style: italic;">//ジョイント元</span></li>
				<li style="color:#26536A;"><span style="color: #000000; font-weight: bold;">var</span> trianglePolygonDef:b2PolygonDef = <span style="color: #000000; font-weight: bold;">new</span> b2PolygonDef;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">trianglePolygonDef.<span style="color: #006600;">vertexCount</span> = <span style="color: #cc66cc;color:#800000;">3</span>;</li>
				<li style="color:#26536A;">trianglePolygonDef.<span style="color: #006600;">vertices</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #0066CC;">Set</span><span style="color: #66cc66;">&#40;</span>-<span style="color: #cc66cc;color:#800000;">1</span>,<span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">trianglePolygonDef.<span style="color: #006600;">vertices</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #0066CC;">Set</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">0</span>,-<span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">trianglePolygonDef.<span style="color: #006600;">vertices</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">2</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #0066CC;">Set</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">1</span>,<span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><span style="color: #000000; font-weight: bold;">var</span> triangleBodyDef:b2BodyDef = <span style="color: #000000; font-weight: bold;">new</span> b2BodyDef;</li>
				<li style="color:#26536A;">triangleBodyDef.<span style="color: #0066CC;">position</span>.<span style="color: #0066CC;">Set</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">7</span>.<span style="color: #cc66cc;color:#800000;">3</span>, <span style="color: #cc66cc;color:#800000;">10</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">trianglePolygonDef.<span style="color: #006600;">filter</span>.<span style="color: #006600;">maskBits</span> = 0x00;</li>
				<li style="color:#26536A;">trianglePolygonDef.<span style="color: #006600;">filter</span>.<span style="color: #006600;">categoryBits</span> = 0x00;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><span style="color: #000000; font-weight: bold;">var</span> triangleBody:b2Body = world.<span style="color: #006600;">CreateBody</span><span style="color: #66cc66;">&#40;</span>triangleBodyDef<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">triangleBody.<span style="color: #006600;">CreateShape</span><span style="color: #66cc66;">&#40;</span>trianglePolygonDef<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp;</li>
				<li style="color:#26536A;"><span style="color: #000000; font-weight: bold;">var</span> rollSquareBodyDef:b2BodyDef = <span style="color: #000000; font-weight: bold;">new</span> b2BodyDef<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">rollSquareBodyDef.<span style="color: #006600;">userData</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Object</span>;</li>
				<li style="color:#26536A;">rollSquareBodyDef.<span style="color: #006600;">userData</span>.<span style="color: #006600;">id</span> = <span style="color: #ff0000;">"rolls"</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">rollSquareBodyDef.<span style="color: #006600;">userData</span>.<span style="color: #006600;">spt</span> = <span style="color: #0066CC;">this</span>.<span style="color: #006600;">s1_sq</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">rollSquareBodyDef.<span style="color: #0066CC;">position</span>.<span style="color: #0066CC;">Set</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">2</span>, <span style="color: #cc66cc;color:#800000;">4</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;"><span style="color: #000000; font-weight: bold;">var</span> rollSquareShapeDef:b2PolygonDef = <span style="color: #000000; font-weight: bold;">new</span> b2PolygonDef<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">rollSquareShapeDef.<span style="color: #006600;">friction</span> = <span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">5</span>;</li>
				<li style="color:#26536A;">rollSquareShapeDef.<span style="color: #006600;">density</span> = <span style="color: #cc66cc;color:#800000;">50</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">rollSquareShapeDef.<span style="color: #006600;">SetAsBox</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">1</span>.<span style="color: #cc66cc;color:#800000;">5</span>, <span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">2</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><span style="color: #000000; font-weight: bold;">var</span> rollSquareBody:b2Body = world.<span style="color: #006600;">CreateBody</span><span style="color: #66cc66;">&#40;</span>rollSquareBodyDef<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">rollSquareBody.<span style="color: #006600;">CreateShape</span><span style="color: #66cc66;">&#40;</span>rollSquareShapeDef<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">rollSquareBody.<span style="color: #006600;">SetMassFromShapes</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;"><span style="color: #000000; font-weight: bold;">var</span> jointDef:b2RevoluteJointDef = <span style="color: #000000; font-weight: bold;">new</span> b2RevoluteJointDef;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">jointDef.<span style="color: #006600;">Initialize</span><span style="color: #66cc66;">&#40;</span>triangleBody, rollSquareBody, rollSquareBody.<span style="color: #006600;">GetWorldCenter</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">jointDef.<span style="color: #006600;">motorSpeed</span> = <span style="color: #cc66cc;color:#800000;">3</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">jointDef.<span style="color: #006600;">maxMotorTorque</span> = <span style="color: #cc66cc;color:#800000;">1</span>;</li>
				<li style="color:#26536A;">jointDef.<span style="color: #006600;">enableMotor</span> = <span style="color: #000000; font-weight: bold;">true</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><span style="color: #000000; font-weight: bold;">var</span> frontJoint:b2RevoluteJoint = b2RevoluteJoint<span style="color: #66cc66;">&#40;</span>world.<span style="color: #006600;">CreateJoint</span><span style="color: #66cc66;">&#40;</span>jointDef<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>; </li>
				</ol>
				</div>
				</div>
				</div>
				<p>簡単！</p>
				<p>最近、FullFlashサイト作ろうかなーとか、<br />
				いろいろやっています。</p>
]]></content:encoded>
			<wfw:commentRss>http://parpue.net/web/318/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Box2D,Papervision3Dでフリースローゲームを３D表示</title>
		<link>http://parpue.net/web/157</link>
		<comments>http://parpue.net/web/157#comments</comments>
		<pubDate>Thu, 31 Jul 2008 16:35:20 +0000</pubDate>
		<dc:creator>okm</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[WEB]]></category>
		<category><![CDATA[actionscript3]]></category>
		<category><![CDATA[Box2D]]></category>
		<category><![CDATA[Papervision3D]]></category>
		<category><![CDATA[フリースロー]]></category>

		<guid isPermaLink="false">http://parpue.net/?p=157</guid>
		<description><![CDATA[				前々回のエントリでBox2DとPapervision3dを連携させてみて、
				前のフリースローも似たようなことできるんじゃないかと思ってやってみた。
				ボールを投げたところからだけ３Dでシミュレーションします。
				環境によってはすごい重いと思います。
				縦長ｗ　長すぎましたねｗ　下だけ表示でもなんとなく操作できます。
				今回は「←」「→」キーで前後に移動できるようにしました。
				「クリック」、「ｓ」キーで方向、パワー決定してシュート！
				
				基本的には前のエントリとやってることは同じです。
				Box2dな方のソースは整理中・・・。
				シーンをENTER_FRAMEイベントで書き出し続けつつ、
				Box2DのほうからupDatePositionsを呼んで、カメラ、ボールの位置を変更しています。
				&#62;&#62;text
				ACTIONSCRIPT:
				
				
				
				private function onEnterHandler&#40;event:Event&#41;:void &#123;
				&#160; &#160; &#160; &#160; &#160; &#160; ball.rotationY += 5;
				&#160; &#160; &#160; &#160; &#160; &#160; renderer.renderScene&#40;scene, camera, viewPort&#41;;
				&#160; &#160; &#160; &#160; &#125;
				&#160; &#160; &#160; &#160; 
				&#160; &#160; &#160; &#160; public function upDatePositions&#40; boy_pos, ball_x, ball_y,ball_angle&#41; &#123;
				&#160; &#160; &#160; &#160; &#160; &#160; camera.z = -100 + boy_pos/1.5;
				&#160; &#160; &#160; &#160; &#160; &#160; ball.z =  [...]]]></description>
			<content:encoded><![CDATA[				<p><a href="http://parpue.net/?p=138">前々回のエントリ</a>でBox2DとPapervision3dを連携させてみて、<br />
				前のフリースローも似たようなことできるんじゃないかと思ってやってみた。</p>
				<p>ボールを投げたところからだけ３Dでシミュレーションします。<br />
				環境によってはすごい重いと思います。</p>
				<p>縦長ｗ　長すぎましたねｗ　下だけ表示でもなんとなく操作できます。<br />
				今回は「←」「→」キーで前後に移動できるようにしました。<br />
				<strong>「クリック」、「ｓ」キー</strong>で方向、パワー決定してシュート！</p>
				<div style="border:solid 3px #774444;padding:0;margin:0;width:540px;height:960px;margin-left:auto;margin-right:auto"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="540" height="960"><param name="id" value="basket" /><param name="align" value="middle" /><param name="allowScriptAccess" value="sameDomain" /><param name="quality" value="high" /><param name="scale" value="noscale" /><param name="src" value="http://parpue.net/wp-content/uploads/basket1.swf"/><embed id="basket" type="application/x-shockwave-flash" width="540" height="960" src="http://parpue.net/wp-content/uploads/basket1.swf"  scale="noscale" quality="high" allowscriptaccess="sameDomain" align="middle"></embed></object></div>
				<p>基本的には前のエントリとやってることは同じです。<br />
				Box2dな方のソースは整理中・・・。</p>
				<p>シーンをENTER_FRAMEイベントで書き出し続けつつ、<br />
				Box2DのほうからupDatePositionsを呼んで、カメラ、ボールの位置を変更しています。</p>
				<div class="igBar"><span id="lactionscript-9"><a href="#" onclick="javascript:showPlainTxt('actionscript-9'); return false;">&gt;&gt;text</a></span></div>
				<div class="syntax_hilite"><span class="langName">ACTIONSCRIPT:</span>
				<div id="actionscript-9">
				<div class="actionscript">
				<ol style="margin:0px; padding:0px" >
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> onEnterHandler<span style="color: #66cc66;">&#40;</span>event:Event<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ball.<span style="color: #006600;">rotationY</span> += <span style="color: #cc66cc;color:#800000;">5</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; renderer.<span style="color: #006600;">renderScene</span><span style="color: #66cc66;">&#40;</span>scene, <span style="color: #0066CC;">camera</span>, viewPort<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> upDatePositions<span style="color: #66cc66;">&#40;</span> boy_pos, ball_x, ball_y,ball_angle<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">camera</span>.<span style="color: #006600;">z</span> = -<span style="color: #cc66cc;color:#800000;">100</span> + boy_pos/<span style="color: #cc66cc;color:#800000;">1</span>.<span style="color: #cc66cc;color:#800000;">5</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ball.<span style="color: #006600;">z</span> = -<span style="color: #cc66cc;color:#800000;">100</span> + ball_x * <span style="color: #cc66cc;color:#800000;">90</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ball.<span style="color: #006600;">y</span> = <span style="color: #cc66cc;color:#800000;">925</span> - ball_y * <span style="color: #cc66cc;color:#800000;">90</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span> </li>
				</ol>
				</div>
				</div>
				</div>
				<p>↓Papervision3Dのほうのソース全部<br />
				<span id="more-157"></span><br />
				ちょっと強引な部分もありますｗ</p>
				<div class="igBar"><span id="lactionscript-10"><a href="#" onclick="javascript:showPlainTxt('actionscript-10'); return false;">&gt;&gt;text</a></span></div>
				<div class="syntax_hilite"><span class="langName">ACTIONSCRIPT:</span>
				<div id="actionscript-10">
				<div class="actionscript">
				<ol style="margin:0px; padding:0px" >
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">package<span style="color: #66cc66;">&#123;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> caurina.<span style="color: #006600;">transitions</span>.<span style="color: #006600;">Tweener</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">Sprite</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #006600;">Event</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> org.<span style="color: #006600;">papervision3d</span>.<span style="color: #006600;">cameras</span>.<span style="color: #006600;">Camera3D</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> org.<span style="color: #006600;">papervision3d</span>.<span style="color: #006600;">lights</span>.<span style="color: #006600;">PointLight3D</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> org.<span style="color: #006600;">papervision3d</span>.<span style="color: #006600;">materials</span>.<span style="color: #006600;">ColorMaterial</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> org.<span style="color: #006600;">papervision3d</span>.<span style="color: #006600;">materials</span>.<span style="color: #006600;">WireframeMaterial</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> org.<span style="color: #006600;">papervision3d</span>.<span style="color: #006600;">materials</span>.<span style="color: #006600;">shadematerials</span>.<span style="color: #006600;">PhongMaterial</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> org.<span style="color: #006600;">papervision3d</span>.<span style="color: #006600;">materials</span>.<span style="color: #006600;">special</span>.<span style="color: #006600;">CompositeMaterial</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> org.<span style="color: #006600;">papervision3d</span>.<span style="color: #006600;">materials</span>.<span style="color: #006600;">utils</span>.<span style="color: #006600;">MaterialsList</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> org.<span style="color: #006600;">papervision3d</span>.<span style="color: #006600;">objects</span>.<span style="color: #006600;">DisplayObject3D</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> org.<span style="color: #006600;">papervision3d</span>.<span style="color: #006600;">objects</span>.<span style="color: #006600;">primitives</span>.<span style="color: #006600;">Cube</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> org.<span style="color: #006600;">papervision3d</span>.<span style="color: #006600;">objects</span>.<span style="color: #006600;">primitives</span>.<span style="color: #006600;">Plane</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> org.<span style="color: #006600;">papervision3d</span>.<span style="color: #006600;">objects</span>.<span style="color: #006600;">primitives</span>.<span style="color: #006600;">Sphere</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> org.<span style="color: #006600;">papervision3d</span>.<span style="color: #006600;">render</span>.<span style="color: #006600;">BasicRenderEngine</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> org.<span style="color: #006600;">papervision3d</span>.<span style="color: #006600;">scenes</span>.<span style="color: #006600;">Scene3D</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> org.<span style="color: #006600;">papervision3d</span>.<span style="color: #006600;">view</span>.<span style="color: #006600;">Viewport3D</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">/**</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; * @author Default</span></li>
				<li style="color:#26536A;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; */</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Basket3D <span style="color: #0066CC;">extends</span> Sprite<span style="color: #66cc66;">&#123;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> scene:Scene3D;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">camera</span>:Camera3D;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> viewPort:Viewport3D;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> renderer:BasicRenderEngine;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> rootNode:DisplayObject3D;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">floor</span>:Cube;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> wall:Cube;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> whiteBoard:Plane;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> ball:Sphere;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _light:PointLight3D;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> cameraView_y:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;color:#800000;">50</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> cameraView_z:<span style="color: #0066CC;">Number</span> = -<span style="color: #cc66cc;color:#800000;">400</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> cameraView_angle:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;color:#800000;">0</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> Basket3D<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; init3D<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> init3D<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span><span style="color: #66cc66;">&#123;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// create renderer</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; renderer = <span style="color: #000000; font-weight: bold;">new</span> BasicRenderEngine<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// create scene</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; scene = <span style="color: #000000; font-weight: bold;">new</span> Scene3D<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// create viewport</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; viewPort = <span style="color: #000000; font-weight: bold;">new</span> Viewport3D<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">0</span>, <span style="color: #cc66cc;color:#800000;">0</span>, <span style="color: #000000; font-weight: bold;">true</span>, <span style="color: #000000; font-weight: bold;">false</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; addChild<span style="color: #66cc66;">&#40;</span>viewPort<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// create camera</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">camera</span> = <span style="color: #000000; font-weight: bold;">new</span> Camera3D;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">camera</span>.<span style="color: #006600;">y</span> = <span style="color: #cc66cc;color:#800000;">500</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">camera</span>.<span style="color: #006600;">z</span> = -<span style="color: #cc66cc;color:#800000;">100</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">camera</span>.<span style="color: #006600;">x</span> = <span style="color: #cc66cc;color:#800000;">600</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">camera</span>.<span style="color: #006600;">rotationX</span> = <span style="color: #cc66cc;color:#800000;">15</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">camera</span>.<span style="color: #006600;">rotationY</span> = -<span style="color: #cc66cc;color:#800000;">45</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// create root node</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rootNode = scene.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span> <span style="color: #000000; font-weight: bold;">new</span> DisplayObject3D<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"rootNode"</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _light = <span style="color: #000000; font-weight: bold;">new</span> PointLight3D;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _light.<span style="color: #006600;">x</span> = -<span style="color: #cc66cc;color:#800000;">100</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _light.<span style="color: #006600;">y</span> = <span style="color: #cc66cc;color:#800000;">100</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _light.<span style="color: #006600;">z</span> = <span style="color: #cc66cc;color:#800000;">40</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> colorMaterial:ColorMaterial = <span style="color: #000000; font-weight: bold;">new</span> ColorMaterial<span style="color: #66cc66;">&#40;</span>0xFFCCCC, <span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> wireMaterial:WireframeMaterial = <span style="color: #000000; font-weight: bold;">new</span> WireframeMaterial<span style="color: #66cc66;">&#40;</span>0xFFCCCC, <span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> phongMaterial:PhongMaterial = <span style="color: #000000; font-weight: bold;">new</span> PhongMaterial<span style="color: #66cc66;">&#40;</span>_light, 0xF7D49E, 0xFFEEEE, <span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> compMaterial:CompositeMaterial = <span style="color: #000000; font-weight: bold;">new</span> CompositeMaterial;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> materialsList:MaterialsList = <span style="color: #000000; font-weight: bold;">new</span> MaterialsList;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; compMaterial.<span style="color: #006600;">addMaterial</span><span style="color: #66cc66;">&#40;</span>phongMaterial<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; compMaterial.<span style="color: #006600;">addMaterial</span><span style="color: #66cc66;">&#40;</span>wireMaterial<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; materialsList.<span style="color: #006600;">addMaterial</span><span style="color: #66cc66;">&#40;</span>compMaterial, <span style="color: #ff0000;">"all"</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">floor</span> = <span style="color: #000000; font-weight: bold;">new</span> Cube<span style="color: #66cc66;">&#40;</span>materialsList, <span style="color: #cc66cc;color:#800000;">700</span>, <span style="color: #cc66cc;color:#800000;">1080</span>, <span style="color: #cc66cc;color:#800000;">20</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">floor</span>.<span style="color: #006600;">z</span> = <span style="color: #cc66cc;color:#800000;">540</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rootNode.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">floor</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; wall = <span style="color: #000000; font-weight: bold;">new</span> Cube<span style="color: #66cc66;">&#40;</span>materialsList, <span style="color: #cc66cc;color:#800000;">700</span>, <span style="color: #cc66cc;color:#800000;">20</span>, <span style="color: #cc66cc;color:#800000;">1600</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; wall.<span style="color: #006600;">y</span> = <span style="color: #cc66cc;color:#800000;">800</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; wall.<span style="color: #006600;">z</span> = <span style="color: #cc66cc;color:#800000;">1120</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rootNode.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span>wall<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> whiteMateril:ColorMaterial = <span style="color: #000000; font-weight: bold;">new</span> ColorMaterial<span style="color: #66cc66;">&#40;</span>0xFFFFFF<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> balckWireMaterial:WireframeMaterial = <span style="color: #000000; font-weight: bold;">new</span> WireframeMaterial<span style="color: #66cc66;">&#40;</span>0x000000<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> boardCompMaterial:CompositeMaterial = <span style="color: #000000; font-weight: bold;">new</span> CompositeMaterial;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; boardCompMaterial.<span style="color: #006600;">addMaterial</span><span style="color: #66cc66;">&#40;</span>whiteMateril<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; boardCompMaterial.<span style="color: #006600;">addMaterial</span><span style="color: #66cc66;">&#40;</span>balckWireMaterial<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; whiteBoard = <span style="color: #000000; font-weight: bold;">new</span> Plane<span style="color: #66cc66;">&#40;</span>boardCompMaterial, <span style="color: #cc66cc;color:#800000;">350</span>, <span style="color: #cc66cc;color:#800000;">200</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; whiteBoard.<span style="color: #006600;">z</span> = <span style="color: #cc66cc;color:#800000;">980</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; whiteBoard.<span style="color: #006600;">y</span> = <span style="color: #cc66cc;color:#800000;">550</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rootNode.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span>whiteBoard<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> ballPhongMaterial:PhongMaterial = <span style="color: #000000; font-weight: bold;">new</span> PhongMaterial<span style="color: #66cc66;">&#40;</span>_light, 0xFD783D, 0xFBBA49, <span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> ballWireMaterial:WireframeMaterial = <span style="color: #000000; font-weight: bold;">new</span> WireframeMaterial<span style="color: #66cc66;">&#40;</span>0xFD783D<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> ballCompMaterial:CompositeMaterial = <span style="color: #000000; font-weight: bold;">new</span> CompositeMaterial;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ballCompMaterial.<span style="color: #006600;">addMaterial</span><span style="color: #66cc66;">&#40;</span>ballPhongMaterial<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ballCompMaterial.<span style="color: #006600;">addMaterial</span><span style="color: #66cc66;">&#40;</span>ballWireMaterial<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ball = <span style="color: #000000; font-weight: bold;">new</span> Sphere<span style="color: #66cc66;">&#40;</span>ballCompMaterial, <span style="color: #cc66cc;color:#800000;">25</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ball.<span style="color: #006600;">z</span> = <span style="color: #cc66cc;color:#800000;">200</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ball.<span style="color: #006600;">y</span> = <span style="color: #cc66cc;color:#800000;">100</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rootNode.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span>ball<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; renderer.<span style="color: #006600;">renderScene</span><span style="color: #66cc66;">&#40;</span>scene, <span style="color: #0066CC;">camera</span>, viewPort<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">this</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>Event.<span style="color: #006600;">ENTER_FRAME</span>, onEnterHandler<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Tweener.<span style="color: #006600;">addTween</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">camera</span>, <span style="color: #66cc66;">&#123;</span> x:<span style="color: #cc66cc;color:#800000;">0</span>, y:<span style="color: #0066CC;">this</span>.<span style="color: #006600;">cameraView_y</span>, z:<span style="color: #0066CC;">this</span>.<span style="color: #006600;">cameraView_z</span>,rotationY:<span style="color: #cc66cc;color:#800000;">0</span>,rotationX:<span style="color: #0066CC;">this</span>.<span style="color: #006600;">cameraView_angle</span>,<span style="color: #0066CC;">time</span>:<span style="color: #cc66cc;color:#800000;">3</span>, transition:<span style="color: #ff0000;">"liner"</span> <span style="color: #66cc66;">&#125;</span> <span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> onEnterHandler<span style="color: #66cc66;">&#40;</span>event:Event<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ball.<span style="color: #006600;">rotationY</span> += <span style="color: #cc66cc;color:#800000;">5</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; renderer.<span style="color: #006600;">renderScene</span><span style="color: #66cc66;">&#40;</span>scene, <span style="color: #0066CC;">camera</span>, viewPort<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> upDatePositions<span style="color: #66cc66;">&#40;</span> boy_pos, ball_x, ball_y,ball_angle<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">camera</span>.<span style="color: #006600;">z</span> = -<span style="color: #cc66cc;color:#800000;">100</span> + boy_pos/<span style="color: #cc66cc;color:#800000;">1</span>.<span style="color: #cc66cc;color:#800000;">5</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ball.<span style="color: #006600;">z</span> = -<span style="color: #cc66cc;color:#800000;">100</span> + ball_x * <span style="color: #cc66cc;color:#800000;">90</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ball.<span style="color: #006600;">y</span> = <span style="color: #cc66cc;color:#800000;">925</span> - ball_y * <span style="color: #cc66cc;color:#800000;">90</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><span style="color: #66cc66;">&#125;</span> </li>
				</ol>
				</div>
				</div>
				</div>
]]></content:encoded>
			<wfw:commentRss>http://parpue.net/web/157/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Box2D と PaperVision3D を連携させてみる</title>
		<link>http://parpue.net/web/138</link>
		<comments>http://parpue.net/web/138#comments</comments>
		<pubDate>Mon, 28 Jul 2008 10:39:04 +0000</pubDate>
		<dc:creator>okm</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[WEB]]></category>
		<category><![CDATA[actionscript3]]></category>
		<category><![CDATA[Box2D]]></category>
		<category><![CDATA[Papervision]]></category>
		<category><![CDATA[Papervision3D]]></category>

		<guid isPermaLink="false">http://parpue.net/?p=138</guid>
		<description><![CDATA[				Box2Dをちょっと勉強してみて、
				このライブラリでは、
				「物理演算させた結果を数値パラメータとして取り出して使う」、
				ということがわかってきた。
				Box２Dで遊んでいる人の多くが [...]]]></description>
			<content:encoded><![CDATA[				<p>Box2Dをちょっと勉強してみて、<br />
				このライブラリでは、<br />
				「物理演算させた結果を数値パラメータとして取り出して使う」、<br />
				ということがわかってきた。</p>
				<p>Box２Dで遊んでいる人の多くがそうであるように、<br />
				このパラメータを何で使ったらおもしろいかというひとつの行き先として、３D表示がある。<br />
				Flashには３D表現のライブラリとしては、<a href="http://blog.papervision3d.org/" target="_blank">PaperVision3D</a>が有名です。</p>
				<p>というわけで、３D表現とか未経験なので、勉強もかねて、<br />
				<a href="http://gihyo.jp/dev/feature/01/box2d/0002">技術評論社の簡単なBox２Dサンプル</a>の動作を、<br />
				Papervision3Dライブラリを使って３D表示させてみた。</p>
				<div style="border:solid 1px;padding:0;margin:0;width:430px;height:350px;margin-left:auto;margin-right:auto">
				<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="430" height="350"><param name="id" value="pvtest" /><param name="align" value="middle" /><param name="allowScriptAccess" value="sameDomain" /><param name="quality" value="high" /><param name="scale" value="noscale" /><param name="src" value="http://parpue.net/wp-content/uploads/papervision.swf"/><embed id="pvtest" type="application/x-shockwave-flash" width="430" height="350" src="http://parpue.net/wp-content/uploads/papervision.swf"  scale="noscale" quality="high" allowscriptaccess="sameDomain" align="middle"></embed></object>
				</div>
				<p>↑　<strong>画面クリック</strong>で、箱が落ちます。<br />
				Box2D部分はほぼ技術評論社のものと変更ありません。</p>
				<p>Box2Dは、2次元の物理演算ライブラリなので、<br />
				PaperVision3Dを用いても、表示されている領域内では、２Dの動作しかしません。</p>
				<p>Box2Dで、毎フレームごとのX座標、Y座標、傾きなどの値を取り出して、<br />
				PaperVision3Dの世界に落とし込んでいます。</p>
				<p>というわけで、とりあえずPaperVision３Dの初体験ができましたｗ<br />
				がんばればもうちょっと面白いことできそうだなー。</p>
				<p>↓ソース全部。<br />
				<span id="more-138"></span><br />
				使用したPaperVision3Dライブラリのバージョンは<br />
				「Public Alpha 2.0 - Great White (24.03.08)」です。</p>
				<p>メインのPaperVisionTestクラス</p>
				<div class="igBar"><span id="lactionscript-13"><a href="#" onclick="javascript:showPlainTxt('actionscript-13'); return false;">&gt;&gt;text</a></span></div>
				<div class="syntax_hilite"><span class="langName">ACTIONSCRIPT:</span>
				<div id="actionscript-13">
				<div class="actionscript">
				<ol style="margin:0px; padding:0px" >
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">package src <span style="color: #66cc66;">&#123;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> Box2D.<span style="color: #006600;">Collision</span>.<span style="color: #006600;">b2AABB</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> Box2D.<span style="color: #006600;">Collision</span>.<span style="color: #006600;">Shapes</span>.<span style="color: #006600;">b2PolygonDef</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> Box2D.<span style="color: #006600;">Common</span>.<span style="color: #0066CC;">Math</span>.<span style="color: #006600;">b2Vec2</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> Box2D.<span style="color: #006600;">Dynamics</span>.<span style="color: #006600;">b2Body</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> Box2D.<span style="color: #006600;">Dynamics</span>.<span style="color: #006600;">b2BodyDef</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> Box2D.<span style="color: #006600;">Dynamics</span>.<span style="color: #006600;">b2DebugDraw</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> Box2D.<span style="color: #006600;">Dynamics</span>.<span style="color: #006600;">b2World</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">Sprite</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #006600;">Event</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #006600;">MouseEvent</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">/**</span></li>
				<li style="color:#26536A;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; * ...</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; * @author Default</span></li>
				<li style="color:#26536A;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; */</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> PaperVisionTest <span style="color: #0066CC;">extends</span> Sprite <span style="color: #66cc66;">&#123;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> world:b2World;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> boxBody:b2Body;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> pvView:PVView;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> PaperVisionTest<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// イベントハンドラを登録する</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">stage</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">CLICK</span>, clickHandler<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; addEventListener<span style="color: #66cc66;">&#40;</span>Event.<span style="color: #006600;">ENTER_FRAME</span>, enterFrameHandler<span style="color: #66cc66;">&#41;</span>;&nbsp;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pvView = <span style="color: #000000; font-weight: bold;">new</span> PVView;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pvView.<span style="color: #006600;">x</span> = -<span style="color: #cc66cc;color:#800000;">100</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pvView.<span style="color: #006600;">y</span> = -<span style="color: #cc66cc;color:#800000;">100</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; addChild<span style="color: #66cc66;">&#40;</span>pvView<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> clickHandler<span style="color: #66cc66;">&#40;</span>event:MouseEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">////////////////////////////////////////</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 物理エンジンのセットアップ</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 外枠を定義する</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> worldAABB:b2AABB = <span style="color: #000000; font-weight: bold;">new</span> b2AABB<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; worldAABB.<span style="color: #006600;">lowerBound</span>.<span style="color: #0066CC;">Set</span><span style="color: #66cc66;">&#40;</span>-<span style="color: #cc66cc;color:#800000;">100</span>, -<span style="color: #cc66cc;color:#800000;">100</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; worldAABB.<span style="color: #006600;">upperBound</span>.<span style="color: #0066CC;">Set</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">100</span>, <span style="color: #cc66cc;color:#800000;">100</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 重力を下方向に10m/s^2とする</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> gravity:b2Vec2 = <span style="color: #000000; font-weight: bold;">new</span> b2Vec2<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">0</span>, <span style="color: #cc66cc;color:#800000;">10</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 外枠と重力を指定して、物理エンジン全体をセットアップする</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; world = <span style="color: #000000; font-weight: bold;">new</span> b2World<span style="color: #66cc66;">&#40;</span>worldAABB, gravity, <span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">////////////////////////////////////////</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 床の設置</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 床は画面の下のほうに設置します</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 床の位置を左から2.1m、上から3mとする</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> floorBodyDef:b2BodyDef = <span style="color: #000000; font-weight: bold;">new</span> b2BodyDef<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; floorBodyDef.<span style="color: #0066CC;">position</span>.<span style="color: #0066CC;">Set</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">2</span>.<span style="color: #cc66cc;color:#800000;">15</span>, <span style="color: #cc66cc;color:#800000;">3</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 床の形を、幅4m、厚さ20cmとする</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 指定するのはその半分の値</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> floorShapeDef:b2PolygonDef = <span style="color: #000000; font-weight: bold;">new</span> b2PolygonDef<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; floorShapeDef.<span style="color: #006600;">SetAsBox</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">2</span>, <span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 床を動かない物体として作る</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">floor</span>:b2Body = world.<span style="color: #006600;">CreateBody</span><span style="color: #66cc66;">&#40;</span>floorBodyDef<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">floor</span>.<span style="color: #006600;">CreateShape</span><span style="color: #66cc66;">&#40;</span>floorShapeDef<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">////////////////////////////////////////</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 箱の設置</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 箱は床の上から落として、少しはねるようにします</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 箱の位置を左から2.5m、上から1mとする</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> boxBodyDef:b2BodyDef = <span style="color: #000000; font-weight: bold;">new</span> b2BodyDef<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; boxBodyDef.<span style="color: #0066CC;">position</span>.<span style="color: #0066CC;">Set</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">2</span>.<span style="color: #cc66cc;color:#800000;">5</span>, <span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 箱の形を、幅60cm、高さ40cmとして45度ぐらい右に回す</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> boxShapeDef:b2PolygonDef= <span style="color: #000000; font-weight: bold;">new</span> b2PolygonDef<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; boxShapeDef.<span style="color: #006600;">SetAsOrientedBox</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">3</span>, <span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">2</span>, <span style="color: #000000; font-weight: bold;">new</span> b2Vec2<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">0</span>, <span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#41;</span>, <span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">9</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; boxShapeDef.<span style="color: #006600;">density</span> = <span style="color: #cc66cc;color:#800000;">1</span>;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 密度 [kg/m^2]</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; boxShapeDef.<span style="color: #006600;">restitution</span> = <span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">75</span>;&nbsp; <span style="color: #808080; font-style: italic;">// 反発係数、通常は0～1</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 箱を動く物体として作る</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; boxBody = world.<span style="color: #006600;">CreateBody</span><span style="color: #66cc66;">&#40;</span>boxBodyDef<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; boxBody.<span style="color: #006600;">CreateShape</span><span style="color: #66cc66;">&#40;</span>boxShapeDef<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; boxBody.<span style="color: #006600;">SetMassFromShapes</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">////////////////////////////////////////</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 描画設定</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> debugDraw:b2DebugDraw = <span style="color: #000000; font-weight: bold;">new</span> b2DebugDraw<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; debugDraw.<span style="color: #006600;">m_sprite</span> = <span style="color: #0066CC;">this</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; debugDraw.<span style="color: #006600;">m_drawScale</span> = <span style="color: #cc66cc;color:#800000;">100</span>; <span style="color: #808080; font-style: italic;">// 1mを100ピクセルにする</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; debugDraw.<span style="color: #006600;">m_fillAlpha</span> = <span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">6</span>; <span style="color: #808080; font-style: italic;">// 不透明度</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; debugDraw.<span style="color: #006600;">m_lineThickness</span> = <span style="color: #cc66cc;color:#800000;">1</span>; <span style="color: #808080; font-style: italic;">// 線の太さ</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; debugDraw.<span style="color: #006600;">m_drawFlags</span> = b2DebugDraw.<span style="color: #006600;">e_shapeBit</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; world.<span style="color: #006600;">SetDebugDraw</span><span style="color: #66cc66;">&#40;</span>debugDraw<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> enterFrameHandler<span style="color: #66cc66;">&#40;</span>event:Event<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>world == <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// Flashはデフォルトで秒間24フレームなので、</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 物理シミュレーションを1/24秒進める</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; world.<span style="color: #006600;">Step</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">1</span> / <span style="color: #cc66cc;color:#800000;">24</span>, <span style="color: #cc66cc;color:#800000;">10</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 箱の座標、傾きを３D世界に適用する。</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> b2vec:b2Vec2 = boxBody.<span style="color: #006600;">GetPosition</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pvView.<span style="color: #006600;">setCubePosition</span><span style="color: #66cc66;">&#40;</span>b2vec.<span style="color: #006600;">x</span> * <span style="color: #cc66cc;color:#800000;">100</span>, b2vec.<span style="color: #006600;">y</span> * <span style="color: #cc66cc;color:#800000;">100</span>, boxBody.<span style="color: #006600;">GetAngle</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><span style="color: #66cc66;">&#125;</span> </li>
				</ol>
				</div>
				</div>
				</div>
				<p>3D表示用PVViewクラス</p>
				<div class="igBar"><span id="lactionscript-14"><a href="#" onclick="javascript:showPlainTxt('actionscript-14'); return false;">&gt;&gt;text</a></span></div>
				<div class="syntax_hilite"><span class="langName">ACTIONSCRIPT:</span>
				<div id="actionscript-14">
				<div class="actionscript">
				<ol style="margin:0px; padding:0px" >
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">package src <span style="color: #66cc66;">&#123;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> Box2D.<span style="color: #006600;">Dynamics</span>.<span style="color: #006600;">b2Body</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> org.<span style="color: #006600;">papervision3d</span>.<span style="color: #006600;">lights</span>.<span style="color: #006600;">PointLight3D</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> org.<span style="color: #006600;">papervision3d</span>.<span style="color: #006600;">materials</span>.<span style="color: #006600;">ColorMaterial</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> org.<span style="color: #006600;">papervision3d</span>.<span style="color: #006600;">materials</span>.<span style="color: #006600;">shadematerials</span>.<span style="color: #006600;">PhongMaterial</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> org.<span style="color: #006600;">papervision3d</span>.<span style="color: #006600;">materials</span>.<span style="color: #006600;">special</span>.<span style="color: #006600;">CompositeMaterial</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> org.<span style="color: #006600;">papervision3d</span>.<span style="color: #006600;">materials</span>.<span style="color: #006600;">utils</span>.<span style="color: #006600;">MaterialsList</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> org.<span style="color: #006600;">papervision3d</span>.<span style="color: #006600;">materials</span>.<span style="color: #006600;">WireframeMaterial</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> org.<span style="color: #006600;">papervision3d</span>.<span style="color: #006600;">objects</span>.<span style="color: #006600;">primitives</span>.<span style="color: #006600;">Cube</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> org.<span style="color: #006600;">papervision3d</span>.<span style="color: #006600;">view</span>.<span style="color: #006600;">BasicView</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">/**</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; * ...</span></li>
				<li style="color:#26536A;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; * @author Default</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; */</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> PVView <span style="color: #0066CC;">extends</span> BasicView<span style="color: #66cc66;">&#123;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> b2BodyList:<span style="color: #0066CC;">Array</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _light:PointLight3D;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> cube:Cube;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> PVView<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; b2BodyList = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Array</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">camera</span>.<span style="color: #006600;">z</span> = -<span style="color: #cc66cc;color:#800000;">50</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">camera</span>.<span style="color: #006600;">x</span> = -<span style="color: #cc66cc;color:#800000;">40</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">camera</span>.<span style="color: #006600;">y</span> = -<span style="color: #cc66cc;color:#800000;">40</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _light = <span style="color: #000000; font-weight: bold;">new</span> PointLight3D;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _light.<span style="color: #006600;">x</span> = <span style="color: #cc66cc;color:#800000;">0</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _light.<span style="color: #006600;">y</span> = <span style="color: #cc66cc;color:#800000;">0</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _light.<span style="color: #006600;">z</span> = <span style="color: #cc66cc;color:#800000;">40</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> colorMaterial:ColorMaterial = <span style="color: #000000; font-weight: bold;">new</span> ColorMaterial<span style="color: #66cc66;">&#40;</span>0x77FF77, <span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> wireMaterial:WireframeMaterial = <span style="color: #000000; font-weight: bold;">new</span> WireframeMaterial<span style="color: #66cc66;">&#40;</span>0x66FF66, <span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> phongMaterial:PhongMaterial = <span style="color: #000000; font-weight: bold;">new</span> PhongMaterial<span style="color: #66cc66;">&#40;</span> _light, 0xCCDDCC, 0xDDEEDD, <span style="color: #cc66cc;color:#800000;">1</span> <span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> compositeMaterial:CompositeMaterial = <span style="color: #000000; font-weight: bold;">new</span> CompositeMaterial<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; compositeMaterial.<span style="color: #006600;">addMaterial</span><span style="color: #66cc66;">&#40;</span>colorMaterial<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; compositeMaterial.<span style="color: #006600;">addMaterial</span><span style="color: #66cc66;">&#40;</span>phongMaterial<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; compositeMaterial.<span style="color: #006600;">addMaterial</span><span style="color: #66cc66;">&#40;</span>wireMaterial<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> materialsList:MaterialsList = <span style="color: #000000; font-weight: bold;">new</span> MaterialsList;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; materialsList.<span style="color: #006600;">addMaterial</span><span style="color: #66cc66;">&#40;</span>compositeMaterial, <span style="color: #ff0000;">"all"</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cube = <span style="color: #000000; font-weight: bold;">new</span> Cube<span style="color: #66cc66;">&#40;</span>materialsList, <span style="color: #cc66cc;color:#800000;">60</span>, <span style="color: #cc66cc;color:#800000;">40</span>, <span style="color: #cc66cc;color:#800000;">40</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cube.<span style="color: #006600;">x</span> = <span style="color: #cc66cc;color:#800000;">2</span>.<span style="color: #cc66cc;color:#800000;">5</span> * <span style="color: #cc66cc;color:#800000;">100</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cube.<span style="color: #006600;">y</span> = <span style="color: #cc66cc;color:#800000;">1</span> * <span style="color: #cc66cc;color:#800000;">100</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; scene.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span>cube<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; startRendering<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;&nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> setCubePosition<span style="color: #66cc66;">&#40;</span>x:<span style="color: #0066CC;">Number</span>, y:<span style="color: #0066CC;">Number</span>, rotationY<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cube.<span style="color: #006600;">x</span> = x;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cube.<span style="color: #006600;">z</span> = y;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rotationY = rotationY * <span style="color: #cc66cc;color:#800000;">180</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cube.<span style="color: #006600;">rotationY</span> = rotationY;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><span style="color: #66cc66;">&#125;</span> </li>
				</ol>
				</div>
				</div>
				</div>
]]></content:encoded>
			<wfw:commentRss>http://parpue.net/web/138/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Box2Dでバスケのフリースローゲーム（２）</title>
		<link>http://parpue.net/web/126</link>
		<comments>http://parpue.net/web/126#comments</comments>
		<pubDate>Thu, 24 Jul 2008 21:54:55 +0000</pubDate>
		<dc:creator>okm</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[WEB]]></category>
		<category><![CDATA[actionscript3]]></category>
		<category><![CDATA[Box2D]]></category>
		<category><![CDATA[フリースロー]]></category>

		<guid isPermaLink="false">http://parpue.net/?p=126</guid>
		<description><![CDATA[				前のエントリのやつを調整。
				画面クリックでスタート。"s"キーまたは、クリックで角度とパワーを決めてシュート！
				
				友人に、いろいろとつっこまれたところを直しました。
				↓変更箇所と、 [...]]]></description>
			<content:encoded><![CDATA[				<p>前のエントリのやつを調整。</p>
				<p>画面クリックでスタート。<strong>"s"キーまたは、クリック</strong>で角度とパワーを決めてシュート！</p>
				<div style="border:solid 1px;padding:0;margin:0;width:540px;height:480px;margin-left:auto;margin-right:auto"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="540" height="480"><param name="id" value="basket" /><param name="align" value="middle" /><param name="allowScriptAccess" value="sameDomain" /><param name="quality" value="high" /><param name="scale" value="noscale" /><param name="src" value="http://parpue.net/wp-content/uploads/basket2.swf"/><embed id="basket" type="application/x-shockwave-flash" width="540" height="480" src="http://parpue.net/wp-content/uploads/basket2.swf"  scale="noscale" quality="high" allowscriptaccess="sameDomain" align="middle"></embed></object></div>
				<p>友人に、いろいろとつっこまれたところを直しました。<br />
				↓変更箇所と、ちょっとしたネタバレ<br />
				<span id="more-126"></span><br />
				変更箇所<br />
				・GOALの判定が甘かったのを修正・・・ゴール付近にいっただけでGOALになっていた。<br />
				・パワーゲージの移動をゆっくりに。<br />
				・"s"キーだけではなく、マウスクリックだけでも遊べるように。<br />
				・部屋を広々と。</p>
				<p>ネタバレ<br />
				<a href="http://parpue.net/wp-content/uploads/netabare.png" rel="shadowbox[post-126];player=img;"><img src="http://parpue.net/wp-content/uploads/netabare-300x268.png" alt="ネタバレ" title="netabare" width="300" height="268" class="size-medium wp-image-132" /></a><br />
				↑クリックで拡大</p>
				<p>Box2Dで部屋と、人間、ボール、ゴールなどのオブジェクトをすべて作成しています。<br />
				ゴールを形成している壁もじつはほんのちょっと四角を配置しているだけ。</p>
				<p>この壁の上部と、下部の赤い線に順番に触れたらゴールとしています。<br />
				前のはゴールの下の方の線だけで判定していたので、<br />
				なんか近くによるだけでゴールになったりましていました。</p>
]]></content:encoded>
			<wfw:commentRss>http://parpue.net/web/126/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Box2D でバスケのフリースローゲーム</title>
		<link>http://parpue.net/web/117</link>
		<comments>http://parpue.net/web/117#comments</comments>
		<pubDate>Wed, 23 Jul 2008 18:33:36 +0000</pubDate>
		<dc:creator>okm</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[WEB]]></category>
		<category><![CDATA[actionscript3]]></category>
		<category><![CDATA[Box2D]]></category>

		<guid isPermaLink="false">http://parpue.net/?p=117</guid>
		<description><![CDATA[				以前のエントリで、思いついたBox2Dによるフリースローゲームを、
				ごりごりと作ってみて、とりあえず動いた。
				
				
				
				画面クリック後は "s"キーのみ。"s"で方向を決めて、 [...]]]></description>
			<content:encoded><![CDATA[				<p><a href="http://parpue.net/?p=50">以前のエントリ</a>で、思いついたBox2Dによるフリースローゲームを、<br />
				ごりごりと作ってみて、とりあえず動いた。</p>
				<div style="border:solid 1px;padding:0;margin:0;width:540px;height:360px;margin-left:auto;margin-right:auto">
				<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="540" height="360"><param name="id" value="basket" /><param name="align" value="middle" /><param name="allowScriptAccess" value="sameDomain" /><param name="quality" value="high" /><param name="scale" value="noscale" /><param name="src" value="http://parpue.net/wp-content/uploads/basket.swf"/><embed id="basket" type="application/x-shockwave-flash" width="540" height="360" src="http://parpue.net/wp-content/uploads/basket.swf"  scale="noscale" quality="high" allowscriptaccess="sameDomain" align="middle"></embed></object>
				</div>
				<p><strong>画面クリック後は "s"キーのみ</strong>。"s"で方向を決めて、"s"でパワーを決めてシュート！<br />
				・・・思ったより入らないけど、ちゃんと入りますよｗ</p>
				<p>別で作っている<a href="http://parpue.net/?p=46">組曲ボーナスのFlash</a>のコードが基本です。<br />
				今回のは勢いでばばーっと作ったので、とてもソース全公開できない、、、。</p>
				<p>"s"キーを押すごとに<strong>onEnterFrame</strong>の挙動を、「角度を決める」、「パワーを決める」等ふりわけて、<br />
				ゴールのSpriteと、ボールのSpriteが重なったらゴールした、と見なすというような処理としています。</p>
				<p>もし全コードみたいという奇特な方がいらっしゃれば、<br />
				こっそりあげるかも。</p>
				<p>本当にBox2Dエンジンおもしろいなー。</p>
				<p>今後は組曲ボーナスFlash作りつつ、Progression Frameworkが気になっているので、<br />
				そっちに手を出したりするかも。</p>
]]></content:encoded>
			<wfw:commentRss>http://parpue.net/web/117/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>２Dのバスケ フリースローゲーム思いついてみる。</title>
		<link>http://parpue.net/web/50</link>
		<comments>http://parpue.net/web/50#comments</comments>
		<pubDate>Fri, 18 Jul 2008 19:40:31 +0000</pubDate>
		<dc:creator>okm</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[WEB]]></category>
		<category><![CDATA[Box2D]]></category>
		<category><![CDATA[フリースロー]]></category>

		<guid isPermaLink="false">http://parpue.net/?p=50</guid>
		<description><![CDATA[				前エントリに続いて、
				某組曲ボーナスゲームも作り途中ですが、
				Box２D使えば、２Dなフリースローゲームも簡単に作れるんじゃないだろか。
				某組曲ボーナスゲームより考えることが少なそうだ。
 [...]]]></description>
			<content:encoded><![CDATA[				<p>前エントリに続いて、<br />
				某組曲ボーナスゲームも作り途中ですが、<br />
				Box２D使えば、２Dなフリースローゲームも簡単に作れるんじゃないだろか。</p>
				<p>某組曲ボーナスゲームより考えることが少なそうだ。</p>
				<p>というわけでフリースロー用の素材を描いて、いろいろ考えてみた。<br />
				目標はこんなの↓</p>
				<div style="border:solid 1px;padding:0;margin:0;width:545px;height:368px;margin-left:auto;margin-right:auto">
				<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="545" height="368"><param name="id" value="basket_seed" /><param name="align" value="middle" /><param name="allowScriptAccess" value="sameDomain" /><param name="quality" value="high" /><param name="scale" value="noscale" /><param name="src" value="http://parpue.net/wp-content/uploads/basket_seed.swf"/><embed id="basket_seed" type="application/x-shockwave-flash" width="545" height="368" src="http://parpue.net/wp-content/uploads/basket_seed.swf"  scale="noscale" quality="high" allowscriptaccess="sameDomain" align="middle"></embed></object>
				</div>
				<p>ずっとみてても入ることはありません。<br />
				もがき続けます。</p>
				<p>ボールはFlashのトゥイーンでがしがし不自然に動かしました(^-^;;<br />
				この辺をBox2Dにやらせれば、絶対気持ちいいぜ！</p>
				<p>しかし素材作るのが大変だ・・・。<br />
				今回はフリーの<a href="http://www.studioshin.com/" target="_blank">SimpleDotX</a>で描きました。<br />
				（あれほどベジェ曲線やるといっておきながら・・・）</p>
				<p><a href="http://parpue.net/wp-content/uploads/hiro_dot.png" rel="shadowbox[post-50];player=img;"><img src="http://parpue.net/wp-content/uploads/hiro_dot-300x300.png" alt="投げる人" title="hiro_dot" width="200" height="200" class="size-medium wp-image-56" /></a></p>
				<p>実際にスクリプトの方もちょっとかいてみた。<br />
				うん、いけそうだ！　（↓まだ、作り中だから絵だけです。）</p>
				<div id="attachment_67" class="wp-caption alignnone" style="width: 310px"><a href="http://parpue.net/wp-content/uploads/bascket_hinagata.png" rel="shadowbox[post-50];player=img;"><img src="http://parpue.net/wp-content/uploads/bascket_hinagata-300x194.png" alt="フリースローひな形" title="bascket_hinagata" width="300" height="194" class="size-medium wp-image-67" /></a><p class="wp-caption-text">フリースローひな形</p></div>
				<p>いろいろ平行してがんばっていこう！</p>
]]></content:encoded>
			<wfw:commentRss>http://parpue.net/web/50/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Box2D リンケージシンボルでアニメーションさせてダッシュ＆ジャンプ</title>
		<link>http://parpue.net/web/46</link>
		<comments>http://parpue.net/web/46#comments</comments>
		<pubDate>Tue, 15 Jul 2008 18:10:24 +0000</pubDate>
		<dc:creator>okm</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[WEB]]></category>
		<category><![CDATA[Box2D]]></category>
		<category><![CDATA[リンケージ]]></category>
		<category><![CDATA[慣性]]></category>

		<guid isPermaLink="false">http://parpue.net/?p=46</guid>
		<description><![CDATA[				Box2Dで、迷○組曲ボーナスステージもどき制作日記の続きです。
				今回はFlashで作成したアニメーションのシンボルをリンケージさせて、
				実際に表示されるキャラクターを動かしてみました。
				このキャラクターは、前作ったコレで使ったやつの使い回しで、我らがドットりえッチです。
				今回もまだエンドレスですｗ
				
				
				
				画面をクリックして、「←」「→」で左右移動、「s」でジャンプです。
				今回は、Flashでリンケージさせたシンボルを組み込んで、
				Flex3でコンパイルする際に組み込んでいます。
				&#62;&#62;text
				ACTIONSCRIPT:
				
				
				
				&#91;Embed&#40;source = 'LabylinsSeed.swf', symbol = 'riecchi'&#41; &#93;
				&#160; &#160; &#160; &#160; private var Riecchi:Class;
				&#160; &#160; &#160; &#160; private var riecchi:MovieClip; 
				
				
				
				
				
				外部のFlashを組み込んで、シンボルをクラスとして使えるようにするには
				[Embed(source='読み込むファイル名', symbol='リンケージ時に指定したクラス名')]
				
				でOKです。
				今回読み込んだLabylinsSeed.swfは以下のようなFlashです。
				
				
				
				上からシンボル化したMovieClipで、それぞれを
				"stop", "low", "middle", "high", "max", 飛んでるのが "jump"と命名してあります。
				それとは別の、riecchiというMovieClipをシンボル化しています。
				このMovieClipは、同じように"stop", "low","middle" ... と名前をつけたフレームをもち、
				それぞれのフレームに上記でシンボル化したMovieClipをおいています。
				↓現在加わっている力から、どのフレームのアニメーションを動かすか、
				どのフレームで gotoAndStop() させるかを指示しています。
				&#62;&#62;text
				ACTIONSCRIPT:
				
				
				
				var vel_x = Math.abs&#40;square.m_linearVelocity.x&#41;;
				&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; var status:String = "stop";
				&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; if&#40; vel_x  [...]]]></description>
			<content:encoded><![CDATA[				<p>Box2Dで、迷○組曲ボーナスステージもどき制作日記の続きです。</p>
				<p>今回はFlashで作成したアニメーションのシンボルをリンケージさせて、<br />
				実際に表示されるキャラクターを動かしてみました。<br />
				このキャラクターは、前作った<a href="http://chocolataste-planner.jp/staffpage.php" target="_blank">コレ</a>で使ったやつの使い回しで、我らがドットりえッチです。<br />
				今回もまだエンドレスですｗ</p>
				<div style="border:solid 1px;padding:0;margin:0;width:540px;height:360px">
				<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="540" height="360"><param name="id" value="labyrinssuite" /><param name="align" value="middle" /><param name="allowScriptAccess" value="sameDomain" /><param name="quality" value="high" /><param name="scale" value="noscale" /><param name="src" value="http://parpue.net/wp-content/labyrinssuite5.swf"/><embed id="labyrinssuite" type="application/x-shockwave-flash" width="540" height="360" src="http://parpue.net/wp-content/labyrinssuite5.swf"  scale="noscale" quality="high" allowscriptaccess="sameDomain" align="middle"></embed></object>
				</div>
				<p>画面をクリックして、<strong>「←」「→」</strong>で左右移動、<strong>「s」</strong>でジャンプです。</p>
				<p>今回は、Flashでリンケージさせたシンボルを組み込んで、<br />
				Flex3でコンパイルする際に組み込んでいます。</p>
				<div class="igBar"><span id="lactionscript-18"><a href="#" onclick="javascript:showPlainTxt('actionscript-18'); return false;">&gt;&gt;text</a></span></div>
				<div class="syntax_hilite"><span class="langName">ACTIONSCRIPT:</span>
				<div id="actionscript-18">
				<div class="actionscript">
				<ol style="margin:0px; padding:0px" >
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><span style="color: #66cc66;">&#91;</span>Embed<span style="color: #66cc66;">&#40;</span>source = <span style="color: #ff0000;">'LabylinsSeed.swf'</span>, symbol = <span style="color: #ff0000;">'riecchi'</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#93;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> Riecchi:<span style="color: #000000; font-weight: bold;">Class</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> riecchi:<span style="color: #0066CC;">MovieClip</span>; </li>
				</ol>
				</div>
				</div>
				</div>
				<p>
				外部のFlashを組み込んで、シンボルをクラスとして使えるようにするには<br />
				<strong>[Embed(source='読み込むファイル名', symbol='リンケージ時に指定したクラス名')]<br />
				</strong><br />
				でOKです。</p>
				<p>今回読み込んだLabylinsSeed.swfは以下のようなFlashです。</p>
				<div style="border:solid 1px;padding:0;margin:0;width:400px;height:300px">
				<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="400" height="300"><param name="id" value="labyrinssuite" /><param name="align" value="middle" /><param name="allowScriptAccess" value="sameDomain" /><param name="quality" value="high" /><param name="scale" value="noscale" /><param name="src" value="http://parpue.net/wp-content/labylinsseed.swf"/><embed id="labyrinssuite" type="application/x-shockwave-flash" width="400" height="300" src="http://parpue.net/wp-content/labylinsseed.swf"  scale="noscale" quality="high" allowscriptaccess="sameDomain" align="middle"></embed></object>
				</div>
				<p>上からシンボル化したMovieClipで、それぞれを<br />
				<strong>"stop", "low", "middle", "high", "max", 飛んでるのが "jump"</strong>と命名してあります。</p>
				<p>それとは別の、riecchiというMovieClipをシンボル化しています。<br />
				このMovieClipは、同じように"stop", "low","middle" ... と名前をつけたフレームをもち、<br />
				それぞれのフレームに上記でシンボル化したMovieClipをおいています。</p>
				<p>↓現在加わっている力から、どのフレームのアニメーションを動かすか、<br />
				どのフレームで gotoAndStop() させるかを指示しています。</p>
				<div class="igBar"><span id="lactionscript-19"><a href="#" onclick="javascript:showPlainTxt('actionscript-19'); return false;">&gt;&gt;text</a></span></div>
				<div class="syntax_hilite"><span class="langName">ACTIONSCRIPT:</span>
				<div id="actionscript-19">
				<div class="actionscript">
				<ol style="margin:0px; padding:0px" >
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><span style="color: #000000; font-weight: bold;">var</span> vel_x = <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">abs</span><span style="color: #66cc66;">&#40;</span>square.<span style="color: #006600;">m_linearVelocity</span>.<span style="color: #006600;">x</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">status</span>:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">"stop"</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span> vel_x &lt;<span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">5</span><span style="color: #66cc66;">&#41;</span> <span style="color: #0066CC;">status</span> = <span style="color: #ff0000;">"stop"</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>vel_x &lt;<span style="color: #cc66cc;color:#800000;">2</span><span style="color: #66cc66;">&#41;</span> <span style="color: #0066CC;">status</span> = <span style="color: #ff0000;">"low"</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>vel_x &lt;<span style="color: #cc66cc;color:#800000;">5</span><span style="color: #66cc66;">&#41;</span> <span style="color: #0066CC;">status</span> = <span style="color: #ff0000;">"middle"</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">else</span> <span style="color: #0066CC;">status</span> = <span style="color: #ff0000;">"high"</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">status</span> != square.<span style="color: #006600;">m_userData</span>.<span style="color: #006600;">speed_status</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; riecchi.<span style="color: #0066CC;">gotoAndStop</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">status</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; square.<span style="color: #006600;">m_userData</span>.<span style="color: #006600;">speed_status</span> = <span style="color: #0066CC;">status</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span> </li>
				</ol>
				</div>
				</div>
				</div>
				<p>
				こうすることで、速度によってアニメーションを変えることができました。<br />
				ちなみにmaxは使わなかった。</p>
				<p>方向転換時に慣性のような力を残す、フラットをとると減点なども追加しました。<br />
				前のコードに試行錯誤しながら作ったので、ソース汚いっす。</p>
				<p>次回はグラフィックをもっと追加してみようかな・・・続く！！</p>
				<p>↓勢いのあるソース全部<br />
				<span id="more-46"></span></p>
				<div class="igBar"><span id="lactionscript-20"><a href="#" onclick="javascript:showPlainTxt('actionscript-20'); return false;">&gt;&gt;text</a></span></div>
				<div class="syntax_hilite"><span class="langName">ACTIONSCRIPT:</span>
				<div id="actionscript-20">
				<div class="actionscript">
				<ol style="margin:0px; padding:0px" >
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">package <span style="color: #66cc66;">&#123;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> Box2D.<span style="color: #006600;">Collision</span>.<span style="color: #006600;">Shapes</span>.<span style="color: #006600;">b2PolygonDef</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> Box2D.<span style="color: #006600;">Collision</span>.<span style="color: #006600;">Shapes</span>.<span style="color: #006600;">b2Shape</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> Box2D.<span style="color: #006600;">Collision</span>.<span style="color: #006600;">b2AABB</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> Box2D.<span style="color: #006600;">Common</span>.<span style="color: #0066CC;">Math</span>.<span style="color: #006600;">b2Vec2</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> Box2D.<span style="color: #006600;">Common</span>.<span style="color: #0066CC;">Math</span>.<span style="color: #006600;">b2XForm</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> Box2D.<span style="color: #006600;">Dynamics</span>.<span style="color: #006600;">Contacts</span>.<span style="color: #006600;">b2ContactEdge</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> Box2D.<span style="color: #006600;">Dynamics</span>.<span style="color: #006600;">b2Body</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> Box2D.<span style="color: #006600;">Dynamics</span>.<span style="color: #006600;">b2BodyDef</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> Box2D.<span style="color: #006600;">Dynamics</span>.<span style="color: #006600;">b2DebugDraw</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> Box2D.<span style="color: #006600;">Dynamics</span>.<span style="color: #006600;">b2World</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">Bitmap</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #0066CC;">MovieClip</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">Sprite</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">StageAlign</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #006600;">Event</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #006600;">KeyboardEvent</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #006600;">MouseEvent</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> flash.<span style="color: #0066CC;">text</span>.<span style="color: #0066CC;">TextField</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">ui</span>.<span style="color: #006600;">Keyboard</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">utils</span>.*;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">/**</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; * @author okm</span></li>
				<li style="color:#26536A;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; */</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> LabyrinsSuite <span style="color: #0066CC;">extends</span> Sprite<span style="color: #66cc66;">&#123;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> world:b2World;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> square:b2Body;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">floor</span>:b2Body;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 床と箱生命体が接触しているか</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> ground:<span style="color: #0066CC;">Boolean</span> = <span style="color: #000000; font-weight: bold;">false</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#91;</span>Embed<span style="color: #66cc66;">&#40;</span>source=<span style="color: #ff0000;">'hako.png'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> hakoImg:<span style="color: #000000; font-weight: bold;">Class</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> spt:Sprite;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#91;</span>Embed<span style="color: #66cc66;">&#40;</span>source = <span style="color: #ff0000;">'onpu.png'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> onpuImg:<span style="color: #000000; font-weight: bold;">Class</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#91;</span>Embed<span style="color: #66cc66;">&#40;</span>source = <span style="color: #ff0000;">'flat.png'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> flatImg:<span style="color: #000000; font-weight: bold;">Class</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#91;</span>Embed<span style="color: #66cc66;">&#40;</span>source = <span style="color: #ff0000;">'LabylinsSeed.swf'</span>, symbol = <span style="color: #ff0000;">'riecchi'</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#93;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> Riecchi:<span style="color: #000000; font-weight: bold;">Class</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> riecchi:<span style="color: #0066CC;">MovieClip</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> onpArea:Sprite;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> onpCnt:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;color:#800000;">0</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> onpCntText:<span style="color: #0066CC;">TextField</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> timer:<span style="color: #0066CC;">Number</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> LabyrinsSuite<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">stage</span>.<span style="color: #0066CC;">scaleMode</span> = <span style="color: #ff0000;">"noScale"</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">stage</span>.<span style="color: #0066CC;">align</span> = StageAlign.<span style="color: #006600;">TOP_LEFT</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">textField</span>:<span style="color: #0066CC;">TextField</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">TextField</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">textField</span>.<span style="color: #0066CC;">text</span> = <span style="color: #ff0000;">"click me "</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">textField</span>.<span style="color: #006600;">x</span> = <span style="color: #cc66cc;color:#800000;">100</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">textField</span>.<span style="color: #006600;">y</span> = <span style="color: #cc66cc;color:#800000;">100</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">textField</span>.<span style="color: #0066CC;">selectable</span> = <span style="color: #000000; font-weight: bold;">false</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">this</span>.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">textField</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 音符とった数のカウント表示用</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; onpCntText = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">TextField</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; onpCntText.<span style="color: #006600;">x</span> = <span style="color: #cc66cc;color:#800000;">10</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; onpCntText.<span style="color: #006600;">y</span> = <span style="color: #cc66cc;color:#800000;">10</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; onpCntText.<span style="color: #0066CC;">text</span> = <span style="color: #ff0000;">"0"</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; addChild<span style="color: #66cc66;">&#40;</span>onpCntText<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//var bmp:Bitmap = new hakoImg();</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 中心座標と重なるように。</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//bmp.x = -18;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//bmp.y = -36;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; riecchi = <span style="color: #000000; font-weight: bold;">new</span> Riecchi<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; riecchi.<span style="color: #0066CC;">gotoAndStop</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"low"</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; riecchi.<span style="color: #006600;">x</span> = -<span style="color: #cc66cc;color:#800000;">15</span>.<span style="color: #cc66cc;color:#800000;">5</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; riecchi.<span style="color: #006600;">y</span> = -<span style="color: #cc66cc;color:#800000;">29</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; spt = <span style="color: #000000; font-weight: bold;">new</span> Sprite;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; spt.<span style="color: #0066CC;">visible</span> = <span style="color: #000000; font-weight: bold;">false</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; spt.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span>riecchi<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; addChild<span style="color: #66cc66;">&#40;</span>spt<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">stage</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">CLICK</span>, go<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> go<span style="color: #66cc66;">&#40;</span>event:MouseEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">clearInterval</span><span style="color: #66cc66;">&#40;</span>timer<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; spt.<span style="color: #0066CC;">visible</span> = <span style="color: #000000; font-weight: bold;">true</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 音符取得数初期化</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; onpCntText.<span style="color: #0066CC;">text</span> = <span style="color: #ff0000;">"0"</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; onpCnt = <span style="color: #cc66cc;color:#800000;">0</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>onpArea != <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span> <span style="color: #0066CC;">this</span>.<span style="color: #006600;">removeChild</span><span style="color: #66cc66;">&#40;</span>onpArea<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; onpArea = <span style="color: #000000; font-weight: bold;">new</span> Sprite;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">this</span>.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span>onpArea<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">stage</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>KeyboardEvent.<span style="color: #006600;">KEY_DOWN</span>, keyDownHandler<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">stage</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>KeyboardEvent.<span style="color: #006600;">KEY_UP</span>, keyUpHandler<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">////////////////////////////////////////</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 物理エンジンのセットアップ</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 縦横２００メートルの世界を作成</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> worldAABB:b2AABB = <span style="color: #000000; font-weight: bold;">new</span> b2AABB<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; worldAABB.<span style="color: #006600;">lowerBound</span>.<span style="color: #0066CC;">Set</span><span style="color: #66cc66;">&#40;</span>-<span style="color: #cc66cc;color:#800000;">100</span>, -<span style="color: #cc66cc;color:#800000;">100</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; worldAABB.<span style="color: #006600;">upperBound</span>.<span style="color: #0066CC;">Set</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">100</span>, <span style="color: #cc66cc;color:#800000;">100</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 重力を下方向に10m/s^2とする</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> gravity:b2Vec2 = <span style="color: #000000; font-weight: bold;">new</span> b2Vec2<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">0</span>, <span style="color: #cc66cc;color:#800000;">10</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 外枠と重力を指定して、物理エンジン全体をセットアップする</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; world = <span style="color: #000000; font-weight: bold;">new</span> b2World<span style="color: #66cc66;">&#40;</span>worldAABB, gravity, <span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">/////////////////////////////////////////////</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 部屋の作成 横幅 12M 高さ 8M の部屋を作成</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">/////////////////////////////////////////////</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 床</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 天井の高さは 8M 床の 中心X座標は　7.5M(真ん中)</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> floorBodyDef:b2BodyDef = <span style="color: #000000; font-weight: bold;">new</span> b2BodyDef<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 床のIDを floor としておく</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; floorBodyDef.<span style="color: #006600;">userData</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Object</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; floorBodyDef.<span style="color: #006600;">userData</span>.<span style="color: #006600;">spt</span> = <span style="color: #000000; font-weight: bold;">new</span> Sprite;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; floorBodyDef.<span style="color: #006600;">userData</span>.<span style="color: #006600;">id</span> = <span style="color: #ff0000;">"floor"</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; floorBodyDef.<span style="color: #0066CC;">position</span>.<span style="color: #0066CC;">Set</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">6</span>, <span style="color: #cc66cc;color:#800000;">8</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 床の形を、幅12m、厚さ20cmとする</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 指定するのはその半分の値</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> floorShapeDef:b2PolygonDef = <span style="color: #000000; font-weight: bold;">new</span> b2PolygonDef<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; floorShapeDef.<span style="color: #006600;">friction</span> = <span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">1</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; floorShapeDef.<span style="color: #006600;">SetAsBox</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">6</span>, <span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 床のcategoryBits/maskBits</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; floorShapeDef.<span style="color: #006600;">filter</span>.<span style="color: #006600;">maskBits</span> = 0x01;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; floorShapeDef.<span style="color: #006600;">filter</span>.<span style="color: #006600;">categoryBits</span> = 0x01;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 床を動かない物体として作る</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">floor</span> = world.<span style="color: #006600;">CreateBody</span><span style="color: #66cc66;">&#40;</span>floorBodyDef<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">floor</span>.<span style="color: #006600;">CreateShape</span><span style="color: #66cc66;">&#40;</span>floorShapeDef<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 両端の壁　高さは 8M 幅 10cm</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 左壁</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> leftWallBodyDef:b2BodyDef = <span style="color: #000000; font-weight: bold;">new</span> b2BodyDef<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; leftWallBodyDef.<span style="color: #006600;">userData</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Object</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; leftWallBodyDef.<span style="color: #006600;">userData</span>.<span style="color: #006600;">id</span> = <span style="color: #ff0000;">"left"</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; leftWallBodyDef.<span style="color: #006600;">userData</span>.<span style="color: #006600;">spt</span> = <span style="color: #000000; font-weight: bold;">new</span> Sprite;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; leftWallBodyDef.<span style="color: #0066CC;">position</span>.<span style="color: #0066CC;">Set</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">05</span>, <span style="color: #cc66cc;color:#800000;">4</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> wallShapeDef:b2PolygonDef = <span style="color: #000000; font-weight: bold;">new</span> b2PolygonDef<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; wallShapeDef.<span style="color: #006600;">friction</span> = <span style="color: #cc66cc;color:#800000;">0</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; wallShapeDef.<span style="color: #006600;">SetAsBox</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">05</span>, <span style="color: #cc66cc;color:#800000;">4</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> leftWall:b2Body = world.<span style="color: #006600;">CreateBody</span><span style="color: #66cc66;">&#40;</span>leftWallBodyDef<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; leftWall.<span style="color: #006600;">CreateShape</span><span style="color: #66cc66;">&#40;</span>wallShapeDef<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 右壁</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> rightWallBodyDef:b2BodyDef = <span style="color: #000000; font-weight: bold;">new</span> b2BodyDef<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rightWallBodyDef.<span style="color: #006600;">userData</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Object</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rightWallBodyDef.<span style="color: #006600;">userData</span>.<span style="color: #006600;">id</span> = <span style="color: #ff0000;">"right"</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rightWallBodyDef.<span style="color: #006600;">userData</span>.<span style="color: #006600;">spt</span> = <span style="color: #000000; font-weight: bold;">new</span> Sprite;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rightWallBodyDef.<span style="color: #0066CC;">position</span>.<span style="color: #0066CC;">Set</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">11</span>.<span style="color: #cc66cc;color:#800000;">95</span>, <span style="color: #cc66cc;color:#800000;">4</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> rightWall:b2Body = world.<span style="color: #006600;">CreateBody</span><span style="color: #66cc66;">&#40;</span>rightWallBodyDef<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rightWall.<span style="color: #006600;">CreateShape</span><span style="color: #66cc66;">&#40;</span>wallShapeDef<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">////////////////////////////////////////</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 箱生命体</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">////////////////////////////////////////</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 箱の位置を左から2.5m、上から1mとする</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> boxBodyDef:b2BodyDef = <span style="color: #000000; font-weight: bold;">new</span> b2BodyDef<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; boxBodyDef.<span style="color: #006600;">userData</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Object</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; boxBodyDef.<span style="color: #006600;">userData</span>.<span style="color: #006600;">id</span> = <span style="color: #ff0000;">"hako"</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; boxBodyDef.<span style="color: #006600;">userData</span>.<span style="color: #006600;">spt</span> = spt;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; boxBodyDef.<span style="color: #006600;">userData</span>.<span style="color: #006600;">speed_status</span> = <span style="color: #ff0000;">"low"</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; boxBodyDef.<span style="color: #0066CC;">position</span>.<span style="color: #0066CC;">Set</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">2</span>.<span style="color: #cc66cc;color:#800000;">5</span>, <span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 箱の幅 40cm 高さ 80cm　重さは 30kg とする</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> boxShapeDef:b2PolygonDef= <span style="color: #000000; font-weight: bold;">new</span> b2PolygonDef<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//boxShapeDef.SetAsOrientedBox(0.3, 0.2, new b2Vec2(0, 0), 0.8);</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; boxShapeDef.<span style="color: #006600;">SetAsBox</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">32</span>, <span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">57</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; boxShapeDef.<span style="color: #006600;">density</span> = <span style="color: #cc66cc;color:#800000;">80</span>;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 密度</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; boxShapeDef.<span style="color: #006600;">friction</span> = <span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">6</span>;&nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 摩擦係数</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; boxShapeDef.<span style="color: #006600;">restitution</span> = <span style="color: #cc66cc;color:#800000;">0</span>;&nbsp; &nbsp;<span style="color: #808080; font-style: italic;">// 反発係数、通常は0～1</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 箱を動く物体として作る</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> boxBody:b2Body = world.<span style="color: #006600;">CreateBody</span><span style="color: #66cc66;">&#40;</span>boxBodyDef<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; boxBody.<span style="color: #006600;">CreateShape</span><span style="color: #66cc66;">&#40;</span>boxShapeDef<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// SetMassFromShapes で重力が有効になる</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; boxBody.<span style="color: #006600;">SetMassFromShapes</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; square = boxBody;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">////////////////////////////////////////</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 描画設定</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> debugDraw:b2DebugDraw = <span style="color: #000000; font-weight: bold;">new</span> b2DebugDraw<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; debugDraw.<span style="color: #006600;">m_sprite</span> = <span style="color: #0066CC;">this</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; debugDraw.<span style="color: #006600;">m_drawScale</span> = <span style="color: #cc66cc;color:#800000;">45</span>; <span style="color: #808080; font-style: italic;">// 1mを45ピクセルにする</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; debugDraw.<span style="color: #006600;">m_fillAlpha</span> = <span style="color: #cc66cc;color:#800000;">0</span>; <span style="color: #808080; font-style: italic;">// 不透明度</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//debugDraw.m_lineThickness = 1; // 線の太さ</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//debugDraw.m_drawFlags = b2DebugDraw.e_shapeBit;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//world.SetDebugDraw(debugDraw);</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">this</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>Event.<span style="color: #006600;">ENTER_FRAME</span>, enterFrameHandler<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; timer = <span style="color: #0066CC;">setInterval</span><span style="color: #66cc66;">&#40;</span>dropBox, <span style="color: #cc66cc;color:#800000;">1200</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> dropBox<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> dropbox_x:<span style="color: #0066CC;">Number</span> = <span style="color: #0066CC;">this</span>.<span style="color: #006600;">xRandomInt</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">11</span>, <span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> dropboxBodyDef:b2BodyDef = <span style="color: #000000; font-weight: bold;">new</span> b2BodyDef<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dropboxBodyDef.<span style="color: #006600;">userData</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Object</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dropboxBodyDef.<span style="color: #006600;">userData</span>.<span style="color: #006600;">id</span> = <span style="color: #ff0000;">"dropbox"</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> onpuBmp:Bitmap;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> onpuType:<span style="color: #0066CC;">String</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span>.<span style="color: #006600;">xRandomInt</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">10</span>,<span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#41;</span>&gt; <span style="color: #cc66cc;color:#800000;">8</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; onpuBmp = <span style="color: #000000; font-weight: bold;">new</span> flatImg<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; onpuType = <span style="color: #ff0000;">"flat"</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><span style="color: #b1b100;">else</span><span style="color: #66cc66;">&#123;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; onpuBmp = <span style="color: #000000; font-weight: bold;">new</span> onpuImg<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; onpuType = <span style="color: #ff0000;">"normal"</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; onpuBmp.<span style="color: #006600;">x</span> = -<span style="color: #cc66cc;color:#800000;">5</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; onpuBmp.<span style="color: #006600;">y</span> = -<span style="color: #cc66cc;color:#800000;">7</span>.<span style="color: #cc66cc;color:#800000;">5</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> onpu_spt:Sprite = <span style="color: #000000; font-weight: bold;">new</span> Sprite;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; onpu_spt.<span style="color: #0066CC;">visible</span> = <span style="color: #000000; font-weight: bold;">false</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; onpu_spt.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span>onpuBmp<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dropboxBodyDef.<span style="color: #006600;">userData</span>.<span style="color: #006600;">spt</span> = onpu_spt;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dropboxBodyDef.<span style="color: #006600;">userData</span>.<span style="color: #006600;">crash</span> = <span style="color: #cc66cc;color:#800000;">0</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dropboxBodyDef.<span style="color: #006600;">userData</span>.<span style="color: #006600;">onpuType</span> = onpuType;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dropboxBodyDef.<span style="color: #006600;">angle</span> = <span style="color: #0066CC;">this</span>.<span style="color: #006600;">xRandomInt</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">5</span>, <span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#41;</span> / <span style="color: #cc66cc;color:#800000;">10</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dropboxBodyDef.<span style="color: #0066CC;">position</span>.<span style="color: #0066CC;">Set</span><span style="color: #66cc66;">&#40;</span>dropbox_x, <span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">5</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; onpArea.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span>dropboxBodyDef.<span style="color: #006600;">userData</span>.<span style="color: #006600;">spt</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 箱の幅 10cm 高さ 15cm　重さは 1kg とする</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> dropboxShapeDef:b2PolygonDef= <span style="color: #000000; font-weight: bold;">new</span> b2PolygonDef<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//boxShapeDef.SetAsOrientedBox(0.3, 0.2, new b2Vec2(0, 0), 0.8);</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dropboxShapeDef.<span style="color: #006600;">SetAsBox</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">1</span>, <span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">15</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dropboxShapeDef.<span style="color: #006600;">density</span> = <span style="color: #cc66cc;color:#800000;">25</span>;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 密度</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dropboxShapeDef.<span style="color: #006600;">friction</span> = <span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">2</span>;&nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 摩擦係数</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dropboxShapeDef.<span style="color: #006600;">restitution</span> = <span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">7</span>;&nbsp; &nbsp;<span style="color: #808080; font-style: italic;">// 反発係数、通常は0～1</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 箱を動く物体として作る</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dropboxShapeDef.<span style="color: #006600;">filter</span>.<span style="color: #006600;">categoryBits</span> = 0x01;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dropboxShapeDef.<span style="color: #006600;">filter</span>.<span style="color: #006600;">maskBits</span> = 0x01;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> dropbox:b2Body = world.<span style="color: #006600;">CreateBody</span><span style="color: #66cc66;">&#40;</span>dropboxBodyDef<span style="color: #66cc66;">&#41;</span>; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dropbox.<span style="color: #006600;">CreateShape</span><span style="color: #66cc66;">&#40;</span>dropboxShapeDef<span style="color: #66cc66;">&#41;</span>;&nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dropbox.<span style="color: #006600;">m_linearVelocity</span>.<span style="color: #006600;">x</span> = <span style="color: #0066CC;">this</span>.<span style="color: #006600;">xRandomInt</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">2</span>, -<span style="color: #cc66cc;color:#800000;">2</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dropbox.<span style="color: #006600;">SetMassFromShapes</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> m_InputL:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;color:#800000;">0</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> m_InputR:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;color:#800000;">0</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> m_InputS:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;color:#800000;">0</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> m_Dir:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;color:#800000;">0</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> moveTime:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;color:#800000;">0</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// キーが押されたときの処理</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> keyDownHandler<span style="color: #66cc66;">&#40;</span>event:KeyboardEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; square.<span style="color: #006600;">WakeUp</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>event.<span style="color: #006600;">keyCode</span> == Keyboard.<span style="color: #0066CC;">LEFT</span> &amp;&amp; m_InputL != <span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; m_InputL = <span style="color: #cc66cc;color:#800000;">1</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; m_InputR = <span style="color: #cc66cc;color:#800000;">0</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; m_Dir = -<span style="color: #cc66cc;color:#800000;">1</span>.<span style="color: #cc66cc;color:#800000;">0</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; moveTime = <span style="color: #cc66cc;color:#800000;">0</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>event.<span style="color: #006600;">keyCode</span> == Keyboard.<span style="color: #0066CC;">RIGHT</span> &amp;&amp; m_InputR != <span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; m_InputR = <span style="color: #cc66cc;color:#800000;">1</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; m_InputL = <span style="color: #cc66cc;color:#800000;">0</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; m_Dir = <span style="color: #cc66cc;color:#800000;">1</span>.<span style="color: #cc66cc;color:#800000;">0</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; moveTime = <span style="color: #cc66cc;color:#800000;">0</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>event.<span style="color: #006600;">keyCode</span> == <span style="color: #cc66cc;color:#800000;">83</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span> <span style="color: #808080; font-style: italic;">// s</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; m_InputS = <span style="color: #cc66cc;color:#800000;">1</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> keyUpHandler<span style="color: #66cc66;">&#40;</span>event:KeyboardEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>event.<span style="color: #006600;">keyCode</span> == Keyboard.<span style="color: #0066CC;">LEFT</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; m_InputL = <span style="color: #cc66cc;color:#800000;">0</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>event.<span style="color: #006600;">keyCode</span> == Keyboard.<span style="color: #0066CC;">RIGHT</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; m_InputR = <span style="color: #cc66cc;color:#800000;">0</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>event.<span style="color: #006600;">keyCode</span> == <span style="color: #cc66cc;color:#800000;">83</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span> <span style="color: #808080; font-style: italic;">// s</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; m_InputS = <span style="color: #cc66cc;color:#800000;">0</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="color:#26536A;">&nbsp;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> enterFrameHandler<span style="color: #66cc66;">&#40;</span>event:Event<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> bb:b2Body = world.<span style="color: #006600;">m_bodyList</span>; bb; bb = bb.<span style="color: #006600;">m_next</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>bb.<span style="color: #006600;">m_userData</span> != <span style="color: #000000; font-weight: bold;">null</span> &amp;&amp; bb.<span style="color: #006600;">m_userData</span>.<span style="color: #006600;">spt</span> is Sprite<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>bb.<span style="color: #006600;">m_userData</span>.<span style="color: #006600;">id</span> == <span style="color: #ff0000;">"dropbox"</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// なんか音符たまに下で死んでるからさよならする</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>bb.<span style="color: #006600;">IsFrozen</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shape = bb.<span style="color: #006600;">GetShapeList</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shape.<span style="color: #006600;">m_filter</span>.<span style="color: #006600;">maskBits</span> = 0x00;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bb.<span style="color: #006600;">m_linearVelocity</span>.<span style="color: #006600;">y</span> = <span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">2</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> onp_spt:Sprite = bb.<span style="color: #006600;">m_userData</span>.<span style="color: #006600;">spt</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; onp_spt.<span style="color: #0066CC;">visible</span> = <span style="color: #000000; font-weight: bold;">true</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// もし箱生命体と触れていたら消す</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>onp_spt.<span style="color: #006600;">hitTestObject</span><span style="color: #66cc66;">&#40;</span>square.<span style="color: #006600;">m_userData</span>.<span style="color: #006600;">spt</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; onpArea.<span style="color: #006600;">removeChild</span><span style="color: #66cc66;">&#40;</span>onp_spt<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; world.<span style="color: #006600;">DestroyBody</span><span style="color: #66cc66;">&#40;</span>bb<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 音符取得数追加</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>bb.<span style="color: #006600;">m_userData</span>.<span style="color: #006600;">onpuType</span> == <span style="color: #ff0000;">"normal"</span><span style="color: #66cc66;">&#41;</span>&nbsp; onpCnt++;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>bb.<span style="color: #006600;">m_userData</span>.<span style="color: #006600;">onpuType</span> == <span style="color: #ff0000;">"flat"</span><span style="color: #66cc66;">&#41;</span> onpCnt--;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; onpCntText.<span style="color: #0066CC;">text</span> = onpCnt.<span style="color: #0066CC;">toString</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bb.<span style="color: #006600;">m_userData</span>.<span style="color: #006600;">spt</span>.<span style="color: #006600;">rotation</span> = bb.<span style="color: #006600;">GetAngle</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> * <span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">180</span> / <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">PI</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span>&nbsp; &nbsp;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bb.<span style="color: #006600;">m_userData</span>.<span style="color: #006600;">spt</span>.<span style="color: #006600;">x</span> = bb.<span style="color: #006600;">GetPosition</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">x</span> * <span style="color: #cc66cc;color:#800000;">45</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bb.<span style="color: #006600;">m_userData</span>.<span style="color: #006600;">spt</span>.<span style="color: #006600;">y</span> = bb.<span style="color: #006600;">GetPosition</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">y</span> * <span style="color: #cc66cc;color:#800000;">45</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 箱生命体は、決して倒れない！</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> xform:b2XForm = square.<span style="color: #006600;">GetXForm</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; square.<span style="color: #006600;">SetXForm</span><span style="color: #66cc66;">&#40;</span>xform.<span style="color: #0066CC;">position</span>, <span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 衝突判定　床</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> shape:b2Shape;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ground = <span style="color: #000000; font-weight: bold;">false</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> ce:b2ContactEdge = <span style="color: #0066CC;">floor</span>.<span style="color: #006600;">m_contactList</span>; ce != <span style="color: #000000; font-weight: bold;">null</span>; ce = ce.<span style="color: #006600;">next</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>&nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> obj1:b2Body = ce.<span style="color: #006600;">contact</span>.<span style="color: #006600;">GetShape1</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">m_body</span>;<span style="color: #808080; font-style: italic;">//1つ目のオブジェクト </span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> obj2:b2Body = ce.<span style="color: #006600;">contact</span>.<span style="color: #006600;">GetShape2</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">m_body</span>;<span style="color: #808080; font-style: italic;">//2つ目のオブジェクト</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>obj1.<span style="color: #006600;">m_userData</span> &amp;&amp; obj2.<span style="color: #006600;">m_userData</span> &amp;&amp; ce.<span style="color: #006600;">contact</span>.<span style="color: #006600;">GetManifoldCount</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> == <span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>&nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>obj2.<span style="color: #006600;">m_userData</span>.<span style="color: #006600;">id</span> == <span style="color: #ff0000;">"dropbox"</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>obj2.<span style="color: #006600;">m_userData</span>.<span style="color: #006600;">crash</span>&gt; <span style="color: #cc66cc;color:#800000;">2</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shape = obj2.<span style="color: #006600;">GetShapeList</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shape.<span style="color: #006600;">m_filter</span>.<span style="color: #006600;">maskBits</span> = 0x00;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; obj2.<span style="color: #006600;">m_userData</span>.<span style="color: #006600;">crash</span>++;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>obj2.<span style="color: #006600;">m_userData</span>.<span style="color: #006600;">id</span> == <span style="color: #ff0000;">"hako"</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span> <span style="color: #808080; font-style: italic;">// 地面とプレーヤーが接触</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ground = <span style="color: #000000; font-weight: bold;">true</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>m_InputS == <span style="color: #cc66cc;color:#800000;">1</span> &amp;&amp; ground <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; square.<span style="color: #006600;">m_linearVelocity</span>.<span style="color: #006600;">y</span> = -<span style="color: #cc66cc;color:#800000;">7</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>m_InputL&gt; <span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> initForce:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">3</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span> square.<span style="color: #006600;">m_linearVelocity</span>.<span style="color: #006600;">x</span>&gt; <span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; initForce -= square.<span style="color: #006600;">m_linearVelocity</span>.<span style="color: #006600;">x</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> leftForce:<span style="color: #0066CC;">Number</span> = <span style="color: #0066CC;">this</span>.<span style="color: #006600;">easeInOutQuad</span><span style="color: #66cc66;">&#40;</span>moveTime, initForce, <span style="color: #cc66cc;color:#800000;">6</span>, <span style="color: #cc66cc;color:#800000;">30</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>moveTime &lt;<span style="color: #cc66cc;color:#800000;">30</span><span style="color: #66cc66;">&#41;</span> moveTime++;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; square.<span style="color: #006600;">m_linearVelocity</span>.<span style="color: #006600;">x</span> = -leftForce;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; square.<span style="color: #006600;">m_userData</span>.<span style="color: #006600;">spt</span>.<span style="color: #006600;">scaleX</span> = -<span style="color: #cc66cc;color:#800000;">1</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>m_InputR&gt; <span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> initForce:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">3</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span> square.<span style="color: #006600;">m_linearVelocity</span>.<span style="color: #006600;">x</span> &lt;<span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; initForce += square.<span style="color: #006600;">m_linearVelocity</span>.<span style="color: #006600;">x</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> rightForce:<span style="color: #0066CC;">Number</span> = <span style="color: #0066CC;">this</span>.<span style="color: #006600;">easeInOutQuad</span><span style="color: #66cc66;">&#40;</span>moveTime, initForce, <span style="color: #cc66cc;color:#800000;">6</span>, <span style="color: #cc66cc;color:#800000;">30</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>moveTime &lt;<span style="color: #cc66cc;color:#800000;">30</span><span style="color: #66cc66;">&#41;</span> moveTime++;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; square.<span style="color: #006600;">m_linearVelocity</span>.<span style="color: #006600;">x</span> = rightForce;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; square.<span style="color: #006600;">m_userData</span>.<span style="color: #006600;">spt</span>.<span style="color: #006600;">scaleX</span> = <span style="color: #cc66cc;color:#800000;">1</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>world == <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//MovieClip描画</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 床にいないときはジャンプ</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>!ground<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; riecchi.<span style="color: #0066CC;">gotoAndStop</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">"jump"</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; square.<span style="color: #006600;">m_userData</span>.<span style="color: #006600;">speed_status</span> = <span style="color: #ff0000;">"jump"</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span> </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">else</span><span style="color: #66cc66;">&#123;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> vel_x = <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">abs</span><span style="color: #66cc66;">&#40;</span>square.<span style="color: #006600;">m_linearVelocity</span>.<span style="color: #006600;">x</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">status</span>:<span style="color: #0066CC;">String</span> = <span style="color: #ff0000;">"stop"</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span> vel_x &lt;<span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">5</span><span style="color: #66cc66;">&#41;</span> <span style="color: #0066CC;">status</span> = <span style="color: #ff0000;">"stop"</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>vel_x &lt;<span style="color: #cc66cc;color:#800000;">2</span><span style="color: #66cc66;">&#41;</span> <span style="color: #0066CC;">status</span> = <span style="color: #ff0000;">"low"</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>vel_x &lt;<span style="color: #cc66cc;color:#800000;">5</span><span style="color: #66cc66;">&#41;</span> <span style="color: #0066CC;">status</span> = <span style="color: #ff0000;">"middle"</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">else</span> <span style="color: #0066CC;">status</span> = <span style="color: #ff0000;">"high"</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">status</span> != square.<span style="color: #006600;">m_userData</span>.<span style="color: #006600;">speed_status</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; riecchi.<span style="color: #0066CC;">gotoAndStop</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">status</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; square.<span style="color: #006600;">m_userData</span>.<span style="color: #006600;">speed_status</span> = <span style="color: #0066CC;">status</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// Flashはデフォルトで秒間24フレームなので、</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 物理シミュレーションを1/24秒進める</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; world.<span style="color: #006600;">Step</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">1</span> / <span style="color: #cc66cc;color:#800000;">24</span>, <span style="color: #cc66cc;color:#800000;">10</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">/**</span></li>
				<li style="color:#26536A;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; &nbsp; &nbsp; 　* t = time</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; &nbsp; &nbsp; 　* b = beginning value</span></li>
				<li style="color:#26536A;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;　* c = change in value</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;　* d = duration</span></li>
				<li style="color:#26536A;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;　*/</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> easeInOutQuad<span style="color: #66cc66;">&#40;</span>t:<span style="color: #0066CC;">Number</span>, b:<span style="color: #0066CC;">Number</span>, c:<span style="color: #0066CC;">Number</span>, d:<span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Number</span> <span style="color: #66cc66;">&#123;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>t/=d/<span style="color: #cc66cc;color:#800000;">2</span><span style="color: #66cc66;">&#41;</span> &lt;<span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span> <span style="color: #b1b100;">return</span> c/<span style="color: #cc66cc;color:#800000;">2</span>*t*t + b;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> -c/<span style="color: #cc66cc;color:#800000;">2</span> * <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>--t<span style="color: #66cc66;">&#41;</span>*<span style="color: #66cc66;">&#40;</span>t-<span style="color: #cc66cc;color:#800000;">2</span><span style="color: #66cc66;">&#41;</span> - <span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span> + b;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span>; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> xRandomInt <span style="color: #66cc66;">&#40;</span>nMax:<span style="color: #0066CC;">Number</span>, nMin:<span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Number</span> <span style="color: #66cc66;">&#123;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// nMinからnMaxまでのランダムな整数を返す</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> nRandomInt:<span style="color: #0066CC;">Number</span> = <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">floor</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">random</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>*<span style="color: #66cc66;">&#40;</span>nMax-nMin+<span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>+nMin;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> nRandomInt;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span> </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="color:#26536A;"><span style="color: #66cc66;">&#125;</span> </li>
				</ol>
				</div>
				</div>
				</div>
]]></content:encoded>
			<wfw:commentRss>http://parpue.net/web/46/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Box2D で 降りしきる音符を拾いまわる箱</title>
		<link>http://parpue.net/web/38</link>
		<comments>http://parpue.net/web/38#comments</comments>
		<pubDate>Wed, 09 Jul 2008 08:57:17 +0000</pubDate>
		<dc:creator>okm</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[WEB]]></category>
		<category><![CDATA[Box2D]]></category>
		<category><![CDATA[FlashDevelop]]></category>
		<category><![CDATA[箱組曲]]></category>

		<guid isPermaLink="false">http://parpue.net/?p=38</guid>
		<description><![CDATA[				前回作ったものに、pngファイルを重ねて表示しました。
				動き回る箱が、音符を拾うゲームです。
				箱組曲ですねｗ
				Box2Dで落ちる音符が自然でいい感じです。
				だいぶ遊べるものに近づいてきました。
				ちなみにエンドレスです。ウハハ！拾い続けるのだ！
				
				
				
				画面をクリックして、「←」「→」で左右移動、「s」でジャンプです。
				今回やっと、無限ジャンプをさせなくしました。
				次回は、箱生命体を改め、ちゃんと歩く何か動かそうかなｗ
				それから音符の種類も増やそうと思っています。
				今回は、外部ファイルを埋め込んで、
				Spriteとして表示できるようにしています。
				埋め込み部
				&#62;&#62;text
				ACTIONSCRIPT:
				
				
				
				&#91;Embed&#40;source='hako.png'&#41;&#93;
				&#160; &#160; private var hakoImg:Class;
				&#160; &#160; private var spt:Sprite;
				&#160; &#160; &#160; &#160; 
				&#160; &#160; &#91;Embed&#40;source = 'onpu.png'&#41;&#93;
				&#160; &#160; private var onpuImg:Class; 
				
				
				
				
				表示できるようにして追加
				&#62;&#62;text
				ACTIONSCRIPT:
				
				
				
				var bmp:Bitmap = new hakoImg&#40;&#41;;
				&#160; &#160; // 中心座標と重なるように。
				&#160; &#160; bmp.x = -18;
				&#160; &#160; bmp.y = -36;
				&#160; &#160; spt = new Sprite;
				&#160; &#160; spt.visible = false;
				&#160; &#160; spt.addChild&#40;bmp&#41;;
				&#160; &#160; addChild&#40;spt&#41;; 
				
				
				
				
				「箱はどんなことがあっても転ばない」というところで悩みました。
				毎フレーム傾きを戻してやることにしました。
				&#62;&#62;text
				ACTIONSCRIPT:
				
				
				
				// 箱生命体は、決して倒れない！
				var xform:b2XForm = square.GetXForm&#40;&#41;;
				square.SetXForm&#40;xform.position,  [...]]]></description>
			<content:encoded><![CDATA[				<p>前回作ったものに、pngファイルを重ねて表示しました。<br />
				<b>動き回る箱が、音符を拾うゲームです。</b><br />
				<b>箱組曲</b>ですねｗ</p>
				<p>Box2Dで落ちる音符が自然でいい感じです。<br />
				だいぶ遊べるものに近づいてきました。<br />
				ちなみにエンドレスです。ウハハ！拾い続けるのだ！</p>
				<div style="border:solid 1px;padding:0;margin:0;width:540px;height:360px">
				<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="540" height="360"><param name="id" value="labyrinssuite" /><param name="align" value="middle" /><param name="allowScriptAccess" value="sameDomain" /><param name="quality" value="high" /><param name="scale" value="noscale" /><param name="src" value="http://parpue.net/wp-content/labyrinssuite4.swf"/><embed id="labyrinssuite" type="application/x-shockwave-flash" width="540" height="360" src="http://parpue.net/wp-content/labyrinssuite4.swf"  scale="noscale" quality="high" allowscriptaccess="sameDomain" align="middle"></embed></object>
				</div>
				<p>画面をクリックして、<strong>「←」「→」</strong>で左右移動、<strong>「s」</strong>でジャンプです。<br />
				今回やっと、無限ジャンプをさせなくしました。</p>
				<p>次回は、箱生命体を改め、ちゃんと歩く何か動かそうかなｗ<br />
				それから音符の種類も増やそうと思っています。</p>
				<p>今回は、外部ファイルを埋め込んで、<br />
				Spriteとして表示できるようにしています。</p>
				<p>埋め込み部</p>
				<div class="igBar"><span id="lactionscript-25"><a href="#" onclick="javascript:showPlainTxt('actionscript-25'); return false;">&gt;&gt;text</a></span></div>
				<div class="syntax_hilite"><span class="langName">ACTIONSCRIPT:</span>
				<div id="actionscript-25">
				<div class="actionscript">
				<ol style="margin:0px; padding:0px" >
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><span style="color: #66cc66;">&#91;</span>Embed<span style="color: #66cc66;">&#40;</span>source=<span style="color: #ff0000;">'hako.png'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> hakoImg:<span style="color: #000000; font-weight: bold;">Class</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> spt:Sprite;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #66cc66;">&#91;</span>Embed<span style="color: #66cc66;">&#40;</span>source = <span style="color: #ff0000;">'onpu.png'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> onpuImg:<span style="color: #000000; font-weight: bold;">Class</span>; </li>
				</ol>
				</div>
				</div>
				</div>
				<p>表示できるようにして追加</p>
				<div class="igBar"><span id="lactionscript-26"><a href="#" onclick="javascript:showPlainTxt('actionscript-26'); return false;">&gt;&gt;text</a></span></div>
				<div class="syntax_hilite"><span class="langName">ACTIONSCRIPT:</span>
				<div id="actionscript-26">
				<div class="actionscript">
				<ol style="margin:0px; padding:0px" >
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><span style="color: #000000; font-weight: bold;">var</span> bmp:Bitmap = <span style="color: #000000; font-weight: bold;">new</span> hakoImg<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 中心座標と重なるように。</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; bmp.<span style="color: #006600;">x</span> = -<span style="color: #cc66cc;color:#800000;">18</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; bmp.<span style="color: #006600;">y</span> = -<span style="color: #cc66cc;color:#800000;">36</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; spt = <span style="color: #000000; font-weight: bold;">new</span> Sprite;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; spt.<span style="color: #0066CC;">visible</span> = <span style="color: #000000; font-weight: bold;">false</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; spt.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span>bmp<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; addChild<span style="color: #66cc66;">&#40;</span>spt<span style="color: #66cc66;">&#41;</span>; </li>
				</ol>
				</div>
				</div>
				</div>
				<p><strong>「箱はどんなことがあっても転ばない」</strong>というところで悩みました。<br />
				毎フレーム傾きを戻してやることにしました。</p>
				<div class="igBar"><span id="lactionscript-27"><a href="#" onclick="javascript:showPlainTxt('actionscript-27'); return false;">&gt;&gt;text</a></span></div>
				<div class="syntax_hilite"><span class="langName">ACTIONSCRIPT:</span>
				<div id="actionscript-27">
				<div class="actionscript">
				<ol style="margin:0px; padding:0px" >
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><span style="color: #808080; font-style: italic;">// 箱生命体は、決して倒れない！</span></li>
				<li style="color:#26536A;"><span style="color: #000000; font-weight: bold;">var</span> xform:b2XForm = square.<span style="color: #006600;">GetXForm</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">square.<span style="color: #006600;">SetXForm</span><span style="color: #66cc66;">&#40;</span>xform.<span style="color: #0066CC;">position</span>, <span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#41;</span>; </li>
				</ol>
				</div>
				</div>
				</div>
				<p>書いてみると2行でしたが、果たしてこれが正しいやり方なのか・・・</p>
				<p>あとは、地面にいるときだけジャンプ可能にしたのは、<br />
				<strong>「地面と衝突しているかどうか」</strong>でフラグ判定しているだけです。</p>
				<p>悩みながらやったのでソースが、だんだん荒くなってきた。</p>
				<p>続く！</p>
				<p>↓ソース全部<br />
				<span id="more-38"></span></p>
				<div class="igBar"><span id="lactionscript-28"><a href="#" onclick="javascript:showPlainTxt('actionscript-28'); return false;">&gt;&gt;text</a></span></div>
				<div class="syntax_hilite"><span class="langName">ACTIONSCRIPT:</span>
				<div id="actionscript-28">
				<div class="actionscript">
				<ol style="margin:0px; padding:0px" >
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">package src <span style="color: #66cc66;">&#123;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> Box2D.<span style="color: #006600;">Collision</span>.<span style="color: #006600;">b2AABB</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> Box2D.<span style="color: #006600;">Collision</span>.<span style="color: #006600;">b2ContactID</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> Box2D.<span style="color: #006600;">Collision</span>.<span style="color: #006600;">Shapes</span>.<span style="color: #006600;">b2CircleDef</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> Box2D.<span style="color: #006600;">Collision</span>.<span style="color: #006600;">Shapes</span>.<span style="color: #006600;">b2PolygonDef</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> Box2D.<span style="color: #006600;">Collision</span>.<span style="color: #006600;">Shapes</span>.<span style="color: #006600;">b2Shape</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> Box2D.<span style="color: #006600;">Common</span>.<span style="color: #0066CC;">Math</span>.<span style="color: #006600;">b2Vec2</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> Box2D.<span style="color: #006600;">Common</span>.<span style="color: #0066CC;">Math</span>.<span style="color: #006600;">b2XForm</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> Box2D.<span style="color: #006600;">Dynamics</span>.<span style="color: #006600;">b2Body</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> Box2D.<span style="color: #006600;">Dynamics</span>.<span style="color: #006600;">b2BodyDef</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> Box2D.<span style="color: #006600;">Dynamics</span>.<span style="color: #006600;">b2DebugDraw</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> Box2D.<span style="color: #006600;">Dynamics</span>.<span style="color: #006600;">b2World</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> Box2D.<span style="color: #006600;">Dynamics</span>.<span style="color: #006600;">Contacts</span>.<span style="color: #006600;">b2ContactEdge</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">Bitmap</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">Sprite</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #006600;">Event</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #006600;">KeyboardEvent</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #006600;">MouseEvent</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #006600;">TextEvent</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> flash.<span style="color: #0066CC;">text</span>.<span style="color: #0066CC;">TextField</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">ui</span>.<span style="color: #006600;">Keyboard</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">utils</span>.*;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">/**</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; * @author okm</span></li>
				<li style="color:#26536A;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; */</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> LabyrinsSuite <span style="color: #0066CC;">extends</span> Sprite<span style="color: #66cc66;">&#123;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> world:b2World;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> square:b2Body;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">floor</span>:b2Body;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 床と箱生命体が接触しているか</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> ground:<span style="color: #0066CC;">Boolean</span> = <span style="color: #000000; font-weight: bold;">false</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#91;</span>Embed<span style="color: #66cc66;">&#40;</span>source=<span style="color: #ff0000;">'hako.png'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> hakoImg:<span style="color: #000000; font-weight: bold;">Class</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> spt:Sprite;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#91;</span>Embed<span style="color: #66cc66;">&#40;</span>source = <span style="color: #ff0000;">'onpu.png'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> onpuImg:<span style="color: #000000; font-weight: bold;">Class</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> onpArea:Sprite;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> onpCnt:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;color:#800000;">0</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> onpCntText:<span style="color: #0066CC;">TextField</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> LabyrinsSuite<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">textField</span>:<span style="color: #0066CC;">TextField</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">TextField</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">textField</span>.<span style="color: #0066CC;">text</span> = <span style="color: #ff0000;">"click me "</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">textField</span>.<span style="color: #006600;">x</span> = <span style="color: #cc66cc;color:#800000;">100</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">textField</span>.<span style="color: #006600;">y</span> = <span style="color: #cc66cc;color:#800000;">100</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">textField</span>.<span style="color: #0066CC;">selectable</span> = <span style="color: #000000; font-weight: bold;">false</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">this</span>.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">textField</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 音符とった数のカウント表示用</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; onpCntText = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">TextField</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; onpCntText.<span style="color: #006600;">x</span> = <span style="color: #cc66cc;color:#800000;">10</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; onpCntText.<span style="color: #006600;">y</span> = <span style="color: #cc66cc;color:#800000;">10</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; onpCntText.<span style="color: #0066CC;">text</span> = <span style="color: #ff0000;">"0"</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; addChild<span style="color: #66cc66;">&#40;</span>onpCntText<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> bmp:Bitmap = <span style="color: #000000; font-weight: bold;">new</span> hakoImg<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 中心座標と重なるように。</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bmp.<span style="color: #006600;">x</span> = -<span style="color: #cc66cc;color:#800000;">18</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bmp.<span style="color: #006600;">y</span> = -<span style="color: #cc66cc;color:#800000;">36</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; spt = <span style="color: #000000; font-weight: bold;">new</span> Sprite;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; spt.<span style="color: #0066CC;">visible</span> = <span style="color: #000000; font-weight: bold;">false</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; spt.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span>bmp<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; addChild<span style="color: #66cc66;">&#40;</span>spt<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">stage</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">CLICK</span>, go<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> go<span style="color: #66cc66;">&#40;</span>event:MouseEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; spt.<span style="color: #0066CC;">visible</span> = <span style="color: #000000; font-weight: bold;">true</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 音符取得数初期化</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; onpCntText.<span style="color: #0066CC;">text</span> = <span style="color: #ff0000;">"0"</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; onpCnt = <span style="color: #cc66cc;color:#800000;">0</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>onpArea != <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span> <span style="color: #0066CC;">this</span>.<span style="color: #006600;">removeChild</span><span style="color: #66cc66;">&#40;</span>onpArea<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; onpArea = <span style="color: #000000; font-weight: bold;">new</span> Sprite;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">this</span>.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span>onpArea<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">stage</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>KeyboardEvent.<span style="color: #006600;">KEY_DOWN</span>, keyDownHandler<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">stage</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>KeyboardEvent.<span style="color: #006600;">KEY_UP</span>, keyUpHandler<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">////////////////////////////////////////</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 物理エンジンのセットアップ</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 縦横２００メートルの世界を作成</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> worldAABB:b2AABB = <span style="color: #000000; font-weight: bold;">new</span> b2AABB<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; worldAABB.<span style="color: #006600;">lowerBound</span>.<span style="color: #0066CC;">Set</span><span style="color: #66cc66;">&#40;</span>-<span style="color: #cc66cc;color:#800000;">100</span>, -<span style="color: #cc66cc;color:#800000;">100</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; worldAABB.<span style="color: #006600;">upperBound</span>.<span style="color: #0066CC;">Set</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">100</span>, <span style="color: #cc66cc;color:#800000;">100</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 重力を下方向に10m/s^2とする</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> gravity:b2Vec2 = <span style="color: #000000; font-weight: bold;">new</span> b2Vec2<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">0</span>, <span style="color: #cc66cc;color:#800000;">10</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 外枠と重力を指定して、物理エンジン全体をセットアップする</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; world = <span style="color: #000000; font-weight: bold;">new</span> b2World<span style="color: #66cc66;">&#40;</span>worldAABB, gravity, <span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">/////////////////////////////////////////////</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 部屋の作成 横幅 12M 高さ 8M の部屋を作成</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">/////////////////////////////////////////////</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 床</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 天井の高さは 8M 床の 中心X座標は　7.5M(真ん中)</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> floorBodyDef:b2BodyDef = <span style="color: #000000; font-weight: bold;">new</span> b2BodyDef<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 床のIDを floor としておく</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; floorBodyDef.<span style="color: #006600;">userData</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Object</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; floorBodyDef.<span style="color: #006600;">userData</span>.<span style="color: #006600;">spt</span> = <span style="color: #000000; font-weight: bold;">new</span> Sprite;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; floorBodyDef.<span style="color: #006600;">userData</span>.<span style="color: #006600;">id</span> = <span style="color: #ff0000;">"floor"</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; floorBodyDef.<span style="color: #0066CC;">position</span>.<span style="color: #0066CC;">Set</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">6</span>, <span style="color: #cc66cc;color:#800000;">8</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 床の形を、幅12m、厚さ20cmとする</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 指定するのはその半分の値</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> floorShapeDef:b2PolygonDef = <span style="color: #000000; font-weight: bold;">new</span> b2PolygonDef<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; floorShapeDef.<span style="color: #006600;">friction</span> = <span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">1</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; floorShapeDef.<span style="color: #006600;">SetAsBox</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">6</span>, <span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 床のcategoryBits/maskBits</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; floorShapeDef.<span style="color: #006600;">filter</span>.<span style="color: #006600;">maskBits</span> = 0x01;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; floorShapeDef.<span style="color: #006600;">filter</span>.<span style="color: #006600;">categoryBits</span> = 0x01;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 床を動かない物体として作る</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">floor</span> = world.<span style="color: #006600;">CreateBody</span><span style="color: #66cc66;">&#40;</span>floorBodyDef<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">floor</span>.<span style="color: #006600;">CreateShape</span><span style="color: #66cc66;">&#40;</span>floorShapeDef<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 両端の壁　高さは 8M 幅 10cm</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 左壁</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> leftWallBodyDef:b2BodyDef = <span style="color: #000000; font-weight: bold;">new</span> b2BodyDef<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; leftWallBodyDef.<span style="color: #006600;">userData</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Object</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; leftWallBodyDef.<span style="color: #006600;">userData</span>.<span style="color: #006600;">id</span> = <span style="color: #ff0000;">"left"</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; leftWallBodyDef.<span style="color: #006600;">userData</span>.<span style="color: #006600;">spt</span> = <span style="color: #000000; font-weight: bold;">new</span> Sprite;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; leftWallBodyDef.<span style="color: #0066CC;">position</span>.<span style="color: #0066CC;">Set</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">05</span>, <span style="color: #cc66cc;color:#800000;">4</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> wallShapeDef:b2PolygonDef = <span style="color: #000000; font-weight: bold;">new</span> b2PolygonDef<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; wallShapeDef.<span style="color: #006600;">friction</span> = <span style="color: #cc66cc;color:#800000;">0</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; wallShapeDef.<span style="color: #006600;">SetAsBox</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">05</span>, <span style="color: #cc66cc;color:#800000;">4</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> leftWall:b2Body = world.<span style="color: #006600;">CreateBody</span><span style="color: #66cc66;">&#40;</span>leftWallBodyDef<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; leftWall.<span style="color: #006600;">CreateShape</span><span style="color: #66cc66;">&#40;</span>wallShapeDef<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 右壁</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> rightWallBodyDef:b2BodyDef = <span style="color: #000000; font-weight: bold;">new</span> b2BodyDef<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rightWallBodyDef.<span style="color: #006600;">userData</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Object</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rightWallBodyDef.<span style="color: #006600;">userData</span>.<span style="color: #006600;">id</span> = <span style="color: #ff0000;">"right"</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rightWallBodyDef.<span style="color: #006600;">userData</span>.<span style="color: #006600;">spt</span> = <span style="color: #000000; font-weight: bold;">new</span> Sprite;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rightWallBodyDef.<span style="color: #0066CC;">position</span>.<span style="color: #0066CC;">Set</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">11</span>.<span style="color: #cc66cc;color:#800000;">95</span>, <span style="color: #cc66cc;color:#800000;">4</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> rightWall:b2Body = world.<span style="color: #006600;">CreateBody</span><span style="color: #66cc66;">&#40;</span>rightWallBodyDef<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rightWall.<span style="color: #006600;">CreateShape</span><span style="color: #66cc66;">&#40;</span>wallShapeDef<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">////////////////////////////////////////</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 箱生命体</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">////////////////////////////////////////</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 箱の位置を左から2.5m、上から1mとする</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> boxBodyDef:b2BodyDef = <span style="color: #000000; font-weight: bold;">new</span> b2BodyDef<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; boxBodyDef.<span style="color: #006600;">userData</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Object</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; boxBodyDef.<span style="color: #006600;">userData</span>.<span style="color: #006600;">id</span> = <span style="color: #ff0000;">"hako"</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; boxBodyDef.<span style="color: #006600;">userData</span>.<span style="color: #006600;">spt</span> = spt;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; boxBodyDef.<span style="color: #0066CC;">position</span>.<span style="color: #0066CC;">Set</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">2</span>.<span style="color: #cc66cc;color:#800000;">5</span>, <span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 箱の幅 40cm 高さ 80cm　重さは 30kg とする</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> boxShapeDef:b2PolygonDef= <span style="color: #000000; font-weight: bold;">new</span> b2PolygonDef<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//boxShapeDef.SetAsOrientedBox(0.3, 0.2, new b2Vec2(0, 0), 0.8);</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; boxShapeDef.<span style="color: #006600;">SetAsBox</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">4</span>, <span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">8</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; boxShapeDef.<span style="color: #006600;">density</span> = <span style="color: #cc66cc;color:#800000;">50</span>;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 密度 [kg/m^2] 30/0.6*1</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; boxShapeDef.<span style="color: #006600;">friction</span> = <span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">6</span>;&nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 摩擦係数</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; boxShapeDef.<span style="color: #006600;">restitution</span> = <span style="color: #cc66cc;color:#800000;">0</span>;&nbsp; &nbsp;<span style="color: #808080; font-style: italic;">// 反発係数、通常は0～1</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 箱を動く物体として作る</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> boxBody:b2Body = world.<span style="color: #006600;">CreateBody</span><span style="color: #66cc66;">&#40;</span>boxBodyDef<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; boxBody.<span style="color: #006600;">CreateShape</span><span style="color: #66cc66;">&#40;</span>boxShapeDef<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// SetMassFromShapes で重力が有効になる</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; boxBody.<span style="color: #006600;">SetMassFromShapes</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; square = boxBody;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">////////////////////////////////////////</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 描画設定</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> debugDraw:b2DebugDraw = <span style="color: #000000; font-weight: bold;">new</span> b2DebugDraw<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; debugDraw.<span style="color: #006600;">m_sprite</span> = <span style="color: #0066CC;">this</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; debugDraw.<span style="color: #006600;">m_drawScale</span> = <span style="color: #cc66cc;color:#800000;">45</span>; <span style="color: #808080; font-style: italic;">// 1mを45ピクセルにする</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; debugDraw.<span style="color: #006600;">m_fillAlpha</span> = <span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">3</span>; <span style="color: #808080; font-style: italic;">// 不透明度</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; debugDraw.<span style="color: #006600;">m_lineThickness</span> = <span style="color: #cc66cc;color:#800000;">1</span>; <span style="color: #808080; font-style: italic;">// 線の太さ</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; debugDraw.<span style="color: #006600;">m_drawFlags</span> = b2DebugDraw.<span style="color: #006600;">e_shapeBit</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; world.<span style="color: #006600;">SetDebugDraw</span><span style="color: #66cc66;">&#40;</span>debugDraw<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">this</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>Event.<span style="color: #006600;">ENTER_FRAME</span>, enterFrameHandler<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">setInterval</span><span style="color: #66cc66;">&#40;</span>dropBox, <span style="color: #cc66cc;color:#800000;">600</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> dropBox<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> dropbox_x:<span style="color: #0066CC;">Number</span> = <span style="color: #0066CC;">this</span>.<span style="color: #006600;">xRandomInt</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">11</span>, <span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> dropboxBodyDef:b2BodyDef = <span style="color: #000000; font-weight: bold;">new</span> b2BodyDef<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dropboxBodyDef.<span style="color: #006600;">userData</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Object</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dropboxBodyDef.<span style="color: #006600;">userData</span>.<span style="color: #006600;">id</span> = <span style="color: #ff0000;">"dropbox"</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> onpuBmp:Bitmap = <span style="color: #000000; font-weight: bold;">new</span> onpuImg<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; onpuBmp.<span style="color: #006600;">x</span> = -<span style="color: #cc66cc;color:#800000;">5</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; onpuBmp.<span style="color: #006600;">y</span> = -<span style="color: #cc66cc;color:#800000;">7</span>.<span style="color: #cc66cc;color:#800000;">5</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> onpu_spt:Sprite = <span style="color: #000000; font-weight: bold;">new</span> Sprite;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; onpu_spt.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span>onpuBmp<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dropboxBodyDef.<span style="color: #006600;">userData</span>.<span style="color: #006600;">spt</span> = onpu_spt;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dropboxBodyDef.<span style="color: #006600;">userData</span>.<span style="color: #006600;">crash</span> = <span style="color: #cc66cc;color:#800000;">0</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dropboxBodyDef.<span style="color: #006600;">angle</span> = <span style="color: #0066CC;">this</span>.<span style="color: #006600;">xRandomInt</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">5</span>, <span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#41;</span> / <span style="color: #cc66cc;color:#800000;">10</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dropboxBodyDef.<span style="color: #0066CC;">position</span>.<span style="color: #0066CC;">Set</span><span style="color: #66cc66;">&#40;</span>dropbox_x, <span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">5</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; onpArea.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span>dropboxBodyDef.<span style="color: #006600;">userData</span>.<span style="color: #006600;">spt</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 箱の幅 10cm 高さ 15cm　重さは 1kg とする</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> dropboxShapeDef:b2PolygonDef= <span style="color: #000000; font-weight: bold;">new</span> b2PolygonDef<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//boxShapeDef.SetAsOrientedBox(0.3, 0.2, new b2Vec2(0, 0), 0.8);</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dropboxShapeDef.<span style="color: #006600;">SetAsBox</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">1</span>, <span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">15</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dropboxShapeDef.<span style="color: #006600;">density</span> = <span style="color: #cc66cc;color:#800000;">25</span>;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 密度</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dropboxShapeDef.<span style="color: #006600;">friction</span> = <span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">2</span>;&nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 摩擦係数</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dropboxShapeDef.<span style="color: #006600;">restitution</span> = <span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">7</span>;&nbsp; &nbsp;<span style="color: #808080; font-style: italic;">// 反発係数、通常は0～1</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 箱を動く物体として作る</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dropboxShapeDef.<span style="color: #006600;">filter</span>.<span style="color: #006600;">categoryBits</span> = 0x01;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dropboxShapeDef.<span style="color: #006600;">filter</span>.<span style="color: #006600;">maskBits</span> = 0x01;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> dropbox:b2Body = world.<span style="color: #006600;">CreateBody</span><span style="color: #66cc66;">&#40;</span>dropboxBodyDef<span style="color: #66cc66;">&#41;</span>; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dropbox.<span style="color: #006600;">CreateShape</span><span style="color: #66cc66;">&#40;</span>dropboxShapeDef<span style="color: #66cc66;">&#41;</span>;&nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dropbox.<span style="color: #006600;">m_linearVelocity</span>.<span style="color: #006600;">x</span> = <span style="color: #0066CC;">this</span>.<span style="color: #006600;">xRandomInt</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">2</span>, -<span style="color: #cc66cc;color:#800000;">2</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dropbox.<span style="color: #006600;">SetMassFromShapes</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> m_InputL:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;color:#800000;">0</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> m_InputR:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;color:#800000;">0</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> m_InputS:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;color:#800000;">0</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> m_Dir:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;color:#800000;">0</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> moveTime:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;color:#800000;">0</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// キーが押されたときの処理</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> keyDownHandler<span style="color: #66cc66;">&#40;</span>event:KeyboardEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; square.<span style="color: #006600;">WakeUp</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>event.<span style="color: #006600;">keyCode</span> == Keyboard.<span style="color: #0066CC;">LEFT</span> &amp;&amp; m_InputL != <span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; m_InputL = <span style="color: #cc66cc;color:#800000;">1</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; m_InputR = <span style="color: #cc66cc;color:#800000;">0</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; m_Dir = -<span style="color: #cc66cc;color:#800000;">1</span>.<span style="color: #cc66cc;color:#800000;">0</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; moveTime = <span style="color: #cc66cc;color:#800000;">0</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>event.<span style="color: #006600;">keyCode</span> == Keyboard.<span style="color: #0066CC;">RIGHT</span> &amp;&amp; m_InputR != <span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; m_InputR = <span style="color: #cc66cc;color:#800000;">1</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; m_InputL = <span style="color: #cc66cc;color:#800000;">0</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; m_Dir = <span style="color: #cc66cc;color:#800000;">1</span>.<span style="color: #cc66cc;color:#800000;">0</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; moveTime = <span style="color: #cc66cc;color:#800000;">0</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>event.<span style="color: #006600;">keyCode</span> == <span style="color: #cc66cc;color:#800000;">83</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span> <span style="color: #808080; font-style: italic;">// s</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; m_InputS = <span style="color: #cc66cc;color:#800000;">1</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> keyUpHandler<span style="color: #66cc66;">&#40;</span>event:KeyboardEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>event.<span style="color: #006600;">keyCode</span> == Keyboard.<span style="color: #0066CC;">LEFT</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; m_InputL = <span style="color: #cc66cc;color:#800000;">0</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>event.<span style="color: #006600;">keyCode</span> == Keyboard.<span style="color: #0066CC;">RIGHT</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; m_InputR = <span style="color: #cc66cc;color:#800000;">0</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>event.<span style="color: #006600;">keyCode</span> == <span style="color: #cc66cc;color:#800000;">83</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span> <span style="color: #808080; font-style: italic;">// s</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; m_InputS = <span style="color: #cc66cc;color:#800000;">0</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="color:#26536A;">&nbsp;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> enterFrameHandler<span style="color: #66cc66;">&#40;</span>event:Event<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> bb:b2Body = world.<span style="color: #006600;">m_bodyList</span>; bb; bb = bb.<span style="color: #006600;">m_next</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>bb.<span style="color: #006600;">m_userData</span> != <span style="color: #000000; font-weight: bold;">null</span> &amp;&amp; bb.<span style="color: #006600;">m_userData</span>.<span style="color: #006600;">spt</span> is Sprite<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>bb.<span style="color: #006600;">m_userData</span>.<span style="color: #006600;">id</span> == <span style="color: #ff0000;">"dropbox"</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> onp_spt:Sprite = bb.<span style="color: #006600;">m_userData</span>.<span style="color: #006600;">spt</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// もし箱生命体と触れていたら消す</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>onp_spt.<span style="color: #006600;">hitTestObject</span><span style="color: #66cc66;">&#40;</span>square.<span style="color: #006600;">m_userData</span>.<span style="color: #006600;">spt</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; onpArea.<span style="color: #006600;">removeChild</span><span style="color: #66cc66;">&#40;</span>onp_spt<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; world.<span style="color: #006600;">DestroyBody</span><span style="color: #66cc66;">&#40;</span>bb<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 音符取得数追加</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; onpCnt++;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; onpCntText.<span style="color: #0066CC;">text</span> = onpCnt.<span style="color: #0066CC;">toString</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bb.<span style="color: #006600;">m_userData</span>.<span style="color: #006600;">spt</span>.<span style="color: #006600;">rotation</span> = bb.<span style="color: #006600;">GetAngle</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> * <span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">180</span> / <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">PI</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span>&nbsp; &nbsp;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bb.<span style="color: #006600;">m_userData</span>.<span style="color: #006600;">spt</span>.<span style="color: #006600;">x</span> = bb.<span style="color: #006600;">GetPosition</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">x</span> * <span style="color: #cc66cc;color:#800000;">45</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bb.<span style="color: #006600;">m_userData</span>.<span style="color: #006600;">spt</span>.<span style="color: #006600;">y</span> = bb.<span style="color: #006600;">GetPosition</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">y</span> * <span style="color: #cc66cc;color:#800000;">45</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 箱生命体は、決して倒れない！</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> xform:b2XForm = square.<span style="color: #006600;">GetXForm</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; square.<span style="color: #006600;">SetXForm</span><span style="color: #66cc66;">&#40;</span>xform.<span style="color: #0066CC;">position</span>, <span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> shape:b2Shape;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//　衝突判定　箱生命体</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">/*&nbsp; 今回はとりあえず箱との衝突はカウントしない方向で。</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (var ce:b2ContactEdge = square.m_contactList; ce != null; ce = ce.next) {&nbsp; </span></li>
				<li style="color:#26536A;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var obj1:b2Body = ce.contact.GetShape1().m_body;//1つ目のオブジェクト </span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var obj2:b2Body = ce.contact.GetShape2().m_body;//2つ目のオブジェクト</span></li>
				<li style="color:#26536A;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(obj1.m_userData &amp;&amp; obj2.m_userData &amp;&amp; ce.contact.GetManifoldCount() == 1){&nbsp; </span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (obj2.m_userData.id == &quot;dropbox&quot;) {</span></li>
				<li style="color:#26536A;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (obj2.m_userData.crash&gt; 2){</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shape = obj2.GetShapeList();</span></li>
				<li style="color:#26536A;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shape.m_filter.maskBits = 0x00;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }else {</span></li>
				<li style="color:#26536A;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; obj2.m_userData.crash++;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</span></li>
				<li style="color:#26536A;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; </span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</span></li>
				<li style="color:#26536A;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; */</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 衝突判定　床</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ground = <span style="color: #000000; font-weight: bold;">false</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> ce:b2ContactEdge = <span style="color: #0066CC;">floor</span>.<span style="color: #006600;">m_contactList</span>; ce != <span style="color: #000000; font-weight: bold;">null</span>; ce = ce.<span style="color: #006600;">next</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>&nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> obj1:b2Body = ce.<span style="color: #006600;">contact</span>.<span style="color: #006600;">GetShape1</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">m_body</span>;<span style="color: #808080; font-style: italic;">//1つ目のオブジェクト </span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> obj2:b2Body = ce.<span style="color: #006600;">contact</span>.<span style="color: #006600;">GetShape2</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">m_body</span>;<span style="color: #808080; font-style: italic;">//2つ目のオブジェクト</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>obj1.<span style="color: #006600;">m_userData</span> &amp;&amp; obj2.<span style="color: #006600;">m_userData</span> &amp;&amp; ce.<span style="color: #006600;">contact</span>.<span style="color: #006600;">GetManifoldCount</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> == <span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>&nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>obj2.<span style="color: #006600;">m_userData</span>.<span style="color: #006600;">id</span> == <span style="color: #ff0000;">"dropbox"</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>obj2.<span style="color: #006600;">m_userData</span>.<span style="color: #006600;">crash</span>&gt; <span style="color: #cc66cc;color:#800000;">2</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shape = obj2.<span style="color: #006600;">GetShapeList</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shape.<span style="color: #006600;">m_filter</span>.<span style="color: #006600;">maskBits</span> = 0x00;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; obj2.<span style="color: #006600;">m_userData</span>.<span style="color: #006600;">crash</span>++;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>obj2.<span style="color: #006600;">m_userData</span>.<span style="color: #006600;">id</span> == <span style="color: #ff0000;">"hako"</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span> <span style="color: #808080; font-style: italic;">// 地面とプレーヤーが接触</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ground = <span style="color: #000000; font-weight: bold;">true</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>m_InputS == <span style="color: #cc66cc;color:#800000;">1</span> &amp;&amp; ground <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; square.<span style="color: #006600;">m_linearVelocity</span>.<span style="color: #006600;">y</span> = -<span style="color: #cc66cc;color:#800000;">7</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>m_InputL&gt; <span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> leftForce:<span style="color: #0066CC;">Number</span> = <span style="color: #0066CC;">this</span>.<span style="color: #006600;">easeInOutQuad</span><span style="color: #66cc66;">&#40;</span>moveTime, <span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">5</span>, <span style="color: #cc66cc;color:#800000;">6</span>, <span style="color: #cc66cc;color:#800000;">30</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>moveTime &lt;<span style="color: #cc66cc;color:#800000;">30</span><span style="color: #66cc66;">&#41;</span> moveTime++;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; square.<span style="color: #006600;">m_linearVelocity</span>.<span style="color: #006600;">x</span> = -leftForce;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; square.<span style="color: #006600;">m_userData</span>.<span style="color: #006600;">spt</span>.<span style="color: #006600;">scaleX</span> = -<span style="color: #cc66cc;color:#800000;">1</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>m_InputR&gt; <span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>moveTime &lt;<span style="color: #cc66cc;color:#800000;">30</span><span style="color: #66cc66;">&#41;</span> moveTime++;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> rightForce:<span style="color: #0066CC;">Number</span> = <span style="color: #0066CC;">this</span>.<span style="color: #006600;">easeInOutQuad</span><span style="color: #66cc66;">&#40;</span>moveTime, <span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">5</span>, <span style="color: #cc66cc;color:#800000;">6</span>, <span style="color: #cc66cc;color:#800000;">30</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; square.<span style="color: #006600;">m_linearVelocity</span>.<span style="color: #006600;">x</span> = rightForce;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; square.<span style="color: #006600;">m_userData</span>.<span style="color: #006600;">spt</span>.<span style="color: #006600;">scaleX</span> = <span style="color: #cc66cc;color:#800000;">1</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>world == <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// Flashはデフォルトで秒間24フレームなので、</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 物理シミュレーションを1/24秒進める</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; world.<span style="color: #006600;">Step</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">1</span> / <span style="color: #cc66cc;color:#800000;">24</span>, <span style="color: #cc66cc;color:#800000;">10</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">/**</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; &nbsp; &nbsp; 　* t = time</span></li>
				<li style="color:#26536A;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; &nbsp; &nbsp; 　* b = beginning value</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;　* c = change in value</span></li>
				<li style="color:#26536A;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;　* d = duration</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;　*/</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> easeInOutQuad<span style="color: #66cc66;">&#40;</span>t:<span style="color: #0066CC;">Number</span>, b:<span style="color: #0066CC;">Number</span>, c:<span style="color: #0066CC;">Number</span>, d:<span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Number</span> <span style="color: #66cc66;">&#123;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>t/=d/<span style="color: #cc66cc;color:#800000;">2</span><span style="color: #66cc66;">&#41;</span> &lt;<span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span> <span style="color: #b1b100;">return</span> c/<span style="color: #cc66cc;color:#800000;">2</span>*t*t + b;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> -c/<span style="color: #cc66cc;color:#800000;">2</span> * <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>--t<span style="color: #66cc66;">&#41;</span>*<span style="color: #66cc66;">&#40;</span>t-<span style="color: #cc66cc;color:#800000;">2</span><span style="color: #66cc66;">&#41;</span> - <span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span> + b;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span>; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> xRandomInt <span style="color: #66cc66;">&#40;</span>nMax:<span style="color: #0066CC;">Number</span>, nMin:<span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Number</span> <span style="color: #66cc66;">&#123;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// nMinからnMaxまでのランダムな整数を返す</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> nRandomInt:<span style="color: #0066CC;">Number</span> = <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">floor</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">random</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>*<span style="color: #66cc66;">&#40;</span>nMax-nMin+<span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>+nMin;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> nRandomInt;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span> </li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><span style="color: #66cc66;">&#125;</span> </li>
				</ol>
				</div>
				</div>
				</div>
				<p>なんか、あんまテストしないで、できた勢いでアップしてみたけど、、、<br />
				♪ ←　ありがイッパイいるみたいでキモー！</p>
]]></content:encoded>
			<wfw:commentRss>http://parpue.net/web/38/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Box2d で降りしきる箱と戯れる箱</title>
		<link>http://parpue.net/web/35</link>
		<comments>http://parpue.net/web/35#comments</comments>
		<pubDate>Mon, 07 Jul 2008 06:09:08 +0000</pubDate>
		<dc:creator>okm</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[WEB]]></category>
		<category><![CDATA[actionscript3]]></category>
		<category><![CDATA[Box2D]]></category>
		<category><![CDATA[衝突]]></category>

		<guid isPermaLink="false">http://parpue.net/?p=35</guid>
		<description><![CDATA[				前回に続きまして、四角の一人四角遊びです（？）
				
				
				
				画面をクリックした後、「←」「→」で左右移動、「s」キーでジャンプです。
				前回同様、「s」キー連打で多段ジャンプ！
				↓参考にさせていただきました。
				■Box2Dサンプル maskBitsによる衝突フィルタリング
				今回やりたかったのは、上からものを落として、
				何回かぶつかったら、部屋から立ち去らせるということ。
				具体的には、
				3回、床との衝突を検知したら、
				落ちてくる箱の衝突フィルタの値を変更するということをやりたかった。
				箱を定義するときにIDを指定しておくことで、何と何が衝突したか検知できる。
				&#62;&#62;text
				ACTIONSCRIPT:
				
				
				
				var floorBodyDef:b2BodyDef = new b2BodyDef&#40;&#41;;
				&#160; &#160; // 床のIDを floor としておく
				&#160; &#160; floorBodyDef.userData = new Object;
				&#160; &#160; floorBodyDef.userData.id = "floor";
				&#160; &#160; floorBodyDef.position.Set&#40;6, 8&#41;; 
				
				
				
				
				3回衝突を検知したら、maskBitsの値を0x00に変更して、誰とも衝突しないようにする。
				Box2Dのソースから追って、filterを再度ゲットできるところを探したんだけど、
				これでよかったんだろうか。
				&#62;&#62;text
				ACTIONSCRIPT:
				
				
				
				for &#40;var ce:b2ContactEdge = floor.m_contactList; ce != null; ce = ce.next&#41; &#123;&#160; 
				&#160; &#160; var obj1:b2Body = ce.contact.GetShape1&#40;&#41;.m_body;//1つ目のオブジェクト 
				&#160; &#160; var obj2:b2Body = ce.contact.GetShape2&#40;&#41;.m_body;//2つ目のオブジェクト
				&#160; &#160; if&#40;obj1.m_userData &#38;&#38; obj2.m_userData &#38;&#38; ce.contact.GetManifoldCount&#40;&#41; == 1&#41;&#123;&#160;  [...]]]></description>
			<content:encoded><![CDATA[				<p>前回に続きまして、四角の一人四角遊びです（？）</p>
				<div style="border:solid 1px;padding:0;margin:0;width:540px;height:360px">
				<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="540" height="360"><param name="id" value="labyrinssuite" /><param name="align" value="middle" /><param name="allowScriptAccess" value="sameDomain" /><param name="quality" value="high" /><param name="scale" value="noscale" /><param name="src" value="http://parpue.net/wp-content/labyrinssuite3.swf"/><embed id="labyrinssuite" type="application/x-shockwave-flash" width="540" height="360" src="http://parpue.net/wp-content/labyrinssuite3.swf"  scale="noscale" quality="high" allowscriptaccess="sameDomain" align="middle"></embed></object>
				</div>
				<p>画面をクリックした後、<b>「←」「→」</b>で左右移動、<b>「s」</b>キーでジャンプです。<br />
				前回同様、「s」キー連打で多段ジャンプ！</p>
				<p>↓参考にさせていただきました。<br />
				■<a href="http://www.matzmtok.com/blog/?p=53">Box2Dサンプル maskBitsによる衝突フィルタリング</a></p>
				<p>今回やりたかったのは、上からものを落として、<br />
				<b>何回かぶつかったら、部屋から立ち去らせる</b>ということ。</p>
				<p>具体的には、<br />
				3回、床との衝突を検知したら、<br />
				落ちてくる箱の衝突フィルタの値を変更するということをやりたかった。</p>
				<p>箱を定義するときにIDを指定しておくことで、何と何が衝突したか検知できる。</p>
				<div class="igBar"><span id="lactionscript-32"><a href="#" onclick="javascript:showPlainTxt('actionscript-32'); return false;">&gt;&gt;text</a></span></div>
				<div class="syntax_hilite"><span class="langName">ACTIONSCRIPT:</span>
				<div id="actionscript-32">
				<div class="actionscript">
				<ol start="64" style="margin:0px; padding:0px" >
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><span style="color: #000000; font-weight: bold;">var</span> floorBodyDef:b2BodyDef = <span style="color: #000000; font-weight: bold;">new</span> b2BodyDef<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 床のIDを floor としておく</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; floorBodyDef.<span style="color: #006600;">userData</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Object</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; floorBodyDef.<span style="color: #006600;">userData</span>.<span style="color: #006600;">id</span> = <span style="color: #ff0000;">"floor"</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; floorBodyDef.<span style="color: #0066CC;">position</span>.<span style="color: #0066CC;">Set</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">6</span>, <span style="color: #cc66cc;color:#800000;">8</span><span style="color: #66cc66;">&#41;</span>; </li>
				</ol>
				</div>
				</div>
				</div>
				<p>3回衝突を検知したら、maskBitsの値を0x00に変更して、誰とも衝突しないようにする。<br />
				Box2Dのソースから追って、filterを再度ゲットできるところを探したんだけど、<br />
				これでよかったんだろうか。</p>
				<div class="igBar"><span id="lactionscript-33"><a href="#" onclick="javascript:showPlainTxt('actionscript-33'); return false;">&gt;&gt;text</a></span></div>
				<div class="syntax_hilite"><span class="langName">ACTIONSCRIPT:</span>
				<div id="actionscript-33">
				<div class="actionscript">
				<ol start="253" style="margin:0px; padding:0px" >
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> ce:b2ContactEdge = <span style="color: #0066CC;">floor</span>.<span style="color: #006600;">m_contactList</span>; ce != <span style="color: #000000; font-weight: bold;">null</span>; ce = ce.<span style="color: #006600;">next</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>&nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> obj1:b2Body = ce.<span style="color: #006600;">contact</span>.<span style="color: #006600;">GetShape1</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">m_body</span>;<span style="color: #808080; font-style: italic;">//1つ目のオブジェクト </span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> obj2:b2Body = ce.<span style="color: #006600;">contact</span>.<span style="color: #006600;">GetShape2</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">m_body</span>;<span style="color: #808080; font-style: italic;">//2つ目のオブジェクト</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>obj1.<span style="color: #006600;">m_userData</span> &amp;&amp; obj2.<span style="color: #006600;">m_userData</span> &amp;&amp; ce.<span style="color: #006600;">contact</span>.<span style="color: #006600;">GetManifoldCount</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> == <span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>&nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>obj2.<span style="color: #006600;">m_userData</span>.<span style="color: #006600;">id</span> == <span style="color: #ff0000;">"dropbox"</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>obj2.<span style="color: #006600;">m_userData</span>.<span style="color: #006600;">crash</span>&gt; <span style="color: #cc66cc;color:#800000;">2</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shape = obj2.<span style="color: #006600;">GetShapeList</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shape.<span style="color: #006600;">m_filter</span>.<span style="color: #006600;">maskBits</span> = 0x00;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; obj2.<span style="color: #006600;">m_userData</span>.<span style="color: #006600;">crash</span>++;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span>&nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="color:#26536A;"><span style="color: #66cc66;">&#125;</span> </li>
				</ol>
				</div>
				</div>
				</div>
				<p>だいぶ作りたいものに近づいてきました！<br />
				次はShapeで絵をちゃんと重ねよう！</p>
				<p>↓ソース全部<br />
				<span id="more-35"></span></p>
				<div class="igBar"><span id="lactionscript-34"><a href="#" onclick="javascript:showPlainTxt('actionscript-34'); return false;">&gt;&gt;text</a></span></div>
				<div class="syntax_hilite"><span class="langName">ACTIONSCRIPT:</span>
				<div id="actionscript-34">
				<div class="actionscript">
				<ol style="margin:0px; padding:0px" >
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">package src <span style="color: #66cc66;">&#123;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> Box2D.<span style="color: #006600;">Collision</span>.<span style="color: #006600;">b2AABB</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> Box2D.<span style="color: #006600;">Collision</span>.<span style="color: #006600;">b2ContactID</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> Box2D.<span style="color: #006600;">Collision</span>.<span style="color: #006600;">Shapes</span>.<span style="color: #006600;">b2CircleDef</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> Box2D.<span style="color: #006600;">Collision</span>.<span style="color: #006600;">Shapes</span>.<span style="color: #006600;">b2PolygonDef</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> Box2D.<span style="color: #006600;">Collision</span>.<span style="color: #006600;">Shapes</span>.<span style="color: #006600;">b2Shape</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> Box2D.<span style="color: #006600;">Common</span>.<span style="color: #0066CC;">Math</span>.<span style="color: #006600;">b2Vec2</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> Box2D.<span style="color: #006600;">Dynamics</span>.<span style="color: #006600;">b2Body</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> Box2D.<span style="color: #006600;">Dynamics</span>.<span style="color: #006600;">b2BodyDef</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> Box2D.<span style="color: #006600;">Dynamics</span>.<span style="color: #006600;">b2DebugDraw</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> Box2D.<span style="color: #006600;">Dynamics</span>.<span style="color: #006600;">b2World</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> Box2D.<span style="color: #006600;">Dynamics</span>.<span style="color: #006600;">Contacts</span>.<span style="color: #006600;">b2ContactEdge</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">Sprite</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #006600;">Event</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #006600;">KeyboardEvent</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #006600;">MouseEvent</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #006600;">TextEvent</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> flash.<span style="color: #0066CC;">text</span>.<span style="color: #0066CC;">TextField</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">ui</span>.<span style="color: #006600;">Keyboard</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">utils</span>.*;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">/**</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; * @author okm</span></li>
				<li style="color:#26536A;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; */</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> LabyrinsSuite <span style="color: #0066CC;">extends</span> Sprite<span style="color: #66cc66;">&#123;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> world:b2World;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> square:b2Body;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">floor</span>:b2Body;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> LabyrinsSuite<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">textField</span>:<span style="color: #0066CC;">TextField</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">TextField</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">textField</span>.<span style="color: #0066CC;">text</span> = <span style="color: #ff0000;">"click me "</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">textField</span>.<span style="color: #006600;">x</span> = <span style="color: #cc66cc;color:#800000;">100</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">textField</span>.<span style="color: #006600;">y</span> = <span style="color: #cc66cc;color:#800000;">100</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">textField</span>.<span style="color: #0066CC;">selectable</span> = <span style="color: #000000; font-weight: bold;">false</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">this</span>.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">textField</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">stage</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">CLICK</span>, go<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> go<span style="color: #66cc66;">&#40;</span>event:MouseEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">stage</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>KeyboardEvent.<span style="color: #006600;">KEY_DOWN</span>, keyDownHandler<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">stage</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>KeyboardEvent.<span style="color: #006600;">KEY_UP</span>, keyUpHandler<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">////////////////////////////////////////</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 物理エンジンのセットアップ</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 縦横２００メートルの世界を作成</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> worldAABB:b2AABB = <span style="color: #000000; font-weight: bold;">new</span> b2AABB<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; worldAABB.<span style="color: #006600;">lowerBound</span>.<span style="color: #0066CC;">Set</span><span style="color: #66cc66;">&#40;</span>-<span style="color: #cc66cc;color:#800000;">100</span>, -<span style="color: #cc66cc;color:#800000;">100</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; worldAABB.<span style="color: #006600;">upperBound</span>.<span style="color: #0066CC;">Set</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">100</span>, <span style="color: #cc66cc;color:#800000;">100</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 重力を下方向に10m/s^2とする</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> gravity:b2Vec2 = <span style="color: #000000; font-weight: bold;">new</span> b2Vec2<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">0</span>, <span style="color: #cc66cc;color:#800000;">10</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 外枠と重力を指定して、物理エンジン全体をセットアップする</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; world = <span style="color: #000000; font-weight: bold;">new</span> b2World<span style="color: #66cc66;">&#40;</span>worldAABB, gravity, <span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">/////////////////////////////////////////////</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 部屋の作成 横幅 12M 高さ 8M の部屋を作成</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">/////////////////////////////////////////////</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 床</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 天井の高さは 8M 床の 中心X座標は　7.5M(真ん中)</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> floorBodyDef:b2BodyDef = <span style="color: #000000; font-weight: bold;">new</span> b2BodyDef<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 床のIDを floor としておく</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; floorBodyDef.<span style="color: #006600;">userData</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Object</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; floorBodyDef.<span style="color: #006600;">userData</span>.<span style="color: #006600;">id</span> = <span style="color: #ff0000;">"floor"</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; floorBodyDef.<span style="color: #0066CC;">position</span>.<span style="color: #0066CC;">Set</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">6</span>, <span style="color: #cc66cc;color:#800000;">8</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 床の形を、幅12m、厚さ20cmとする</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 指定するのはその半分の値</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> floorShapeDef:b2PolygonDef = <span style="color: #000000; font-weight: bold;">new</span> b2PolygonDef<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; floorShapeDef.<span style="color: #006600;">friction</span> = <span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">1</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; floorShapeDef.<span style="color: #006600;">SetAsBox</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">6</span>, <span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 床のcategoryBits/maskBits</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; floorShapeDef.<span style="color: #006600;">filter</span>.<span style="color: #006600;">maskBits</span> = 0x01;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; floorShapeDef.<span style="color: #006600;">filter</span>.<span style="color: #006600;">categoryBits</span> = 0x01;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 床を動かない物体として作る</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">floor</span> = world.<span style="color: #006600;">CreateBody</span><span style="color: #66cc66;">&#40;</span>floorBodyDef<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">floor</span>.<span style="color: #006600;">CreateShape</span><span style="color: #66cc66;">&#40;</span>floorShapeDef<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 両端の壁　高さは 8M 幅 10cm</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 左壁</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> leftWallBodyDef:b2BodyDef = <span style="color: #000000; font-weight: bold;">new</span> b2BodyDef<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; leftWallBodyDef.<span style="color: #006600;">userData</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Object</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; leftWallBodyDef.<span style="color: #006600;">userData</span>.<span style="color: #006600;">id</span> = <span style="color: #ff0000;">"left"</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; leftWallBodyDef.<span style="color: #0066CC;">position</span>.<span style="color: #0066CC;">Set</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">05</span>, <span style="color: #cc66cc;color:#800000;">4</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> wallShapeDef:b2PolygonDef = <span style="color: #000000; font-weight: bold;">new</span> b2PolygonDef<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; wallShapeDef.<span style="color: #006600;">friction</span> = <span style="color: #cc66cc;color:#800000;">0</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; wallShapeDef.<span style="color: #006600;">SetAsBox</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">05</span>, <span style="color: #cc66cc;color:#800000;">4</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> leftWall:b2Body = world.<span style="color: #006600;">CreateBody</span><span style="color: #66cc66;">&#40;</span>leftWallBodyDef<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; leftWall.<span style="color: #006600;">CreateShape</span><span style="color: #66cc66;">&#40;</span>wallShapeDef<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 右壁</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> rightWallBodyDef:b2BodyDef = <span style="color: #000000; font-weight: bold;">new</span> b2BodyDef<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rightWallBodyDef.<span style="color: #006600;">userData</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Object</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rightWallBodyDef.<span style="color: #006600;">userData</span>.<span style="color: #006600;">id</span> = <span style="color: #ff0000;">"right"</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rightWallBodyDef.<span style="color: #0066CC;">position</span>.<span style="color: #0066CC;">Set</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">11</span>.<span style="color: #cc66cc;color:#800000;">95</span>, <span style="color: #cc66cc;color:#800000;">4</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> rightWall:b2Body = world.<span style="color: #006600;">CreateBody</span><span style="color: #66cc66;">&#40;</span>rightWallBodyDef<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rightWall.<span style="color: #006600;">CreateShape</span><span style="color: #66cc66;">&#40;</span>wallShapeDef<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">////////////////////////////////////////</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 箱生命体</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">////////////////////////////////////////</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 箱の位置を左から2.5m、上から1mとする</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> boxBodyDef:b2BodyDef = <span style="color: #000000; font-weight: bold;">new</span> b2BodyDef<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; boxBodyDef.<span style="color: #006600;">userData</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Object</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; boxBodyDef.<span style="color: #006600;">userData</span>.<span style="color: #006600;">id</span> = <span style="color: #ff0000;">"hako"</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; boxBodyDef.<span style="color: #0066CC;">position</span>.<span style="color: #0066CC;">Set</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">2</span>.<span style="color: #cc66cc;color:#800000;">5</span>, <span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 箱の幅 60cm 高さ 1M　重さは 30kg とする</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> boxShapeDef:b2PolygonDef= <span style="color: #000000; font-weight: bold;">new</span> b2PolygonDef<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//boxShapeDef.SetAsOrientedBox(0.3, 0.2, new b2Vec2(0, 0), 0.8);</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; boxShapeDef.<span style="color: #006600;">SetAsBox</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">6</span>, <span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; boxShapeDef.<span style="color: #006600;">density</span> = <span style="color: #cc66cc;color:#800000;">50</span>;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 密度 [kg/m^2] 30/0.6*1</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; boxShapeDef.<span style="color: #006600;">friction</span> = <span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">2</span>;&nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 摩擦係数</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; boxShapeDef.<span style="color: #006600;">restitution</span> = <span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">3</span>;&nbsp; &nbsp;<span style="color: #808080; font-style: italic;">// 反発係数、通常は0～1</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 箱を動く物体として作る</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> boxBody:b2Body = world.<span style="color: #006600;">CreateBody</span><span style="color: #66cc66;">&#40;</span>boxBodyDef<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; boxBody.<span style="color: #006600;">CreateShape</span><span style="color: #66cc66;">&#40;</span>boxShapeDef<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// SetMassFromShapes で重力が有効になる</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; boxBody.<span style="color: #006600;">SetMassFromShapes</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; square = boxBody;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">////////////////////////////////////////</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 描画設定</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> debugDraw:b2DebugDraw = <span style="color: #000000; font-weight: bold;">new</span> b2DebugDraw<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; debugDraw.<span style="color: #006600;">m_sprite</span> = <span style="color: #0066CC;">this</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; debugDraw.<span style="color: #006600;">m_drawScale</span> = <span style="color: #cc66cc;color:#800000;">45</span>; <span style="color: #808080; font-style: italic;">// 1mを45ピクセルにする</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; debugDraw.<span style="color: #006600;">m_fillAlpha</span> = <span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">3</span>; <span style="color: #808080; font-style: italic;">// 不透明度</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; debugDraw.<span style="color: #006600;">m_lineThickness</span> = <span style="color: #cc66cc;color:#800000;">1</span>; <span style="color: #808080; font-style: italic;">// 線の太さ</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; debugDraw.<span style="color: #006600;">m_drawFlags</span> = b2DebugDraw.<span style="color: #006600;">e_shapeBit</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; world.<span style="color: #006600;">SetDebugDraw</span><span style="color: #66cc66;">&#40;</span>debugDraw<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">this</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>Event.<span style="color: #006600;">ENTER_FRAME</span>, enterFrameHandler<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">setInterval</span><span style="color: #66cc66;">&#40;</span>dropBox, <span style="color: #cc66cc;color:#800000;">700</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> dropBox<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> dropbox_x:<span style="color: #0066CC;">Number</span> = <span style="color: #0066CC;">this</span>.<span style="color: #006600;">xRandomInt</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">11</span>, <span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> dropboxBodyDef:b2BodyDef = <span style="color: #000000; font-weight: bold;">new</span> b2BodyDef<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dropboxBodyDef.<span style="color: #006600;">userData</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Object</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dropboxBodyDef.<span style="color: #006600;">userData</span>.<span style="color: #006600;">id</span> = <span style="color: #ff0000;">"dropbox"</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dropboxBodyDef.<span style="color: #006600;">userData</span>.<span style="color: #006600;">crash</span> = <span style="color: #cc66cc;color:#800000;">0</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dropboxBodyDef.<span style="color: #006600;">angle</span> = <span style="color: #0066CC;">this</span>.<span style="color: #006600;">xRandomInt</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">5</span>, <span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#41;</span> / <span style="color: #cc66cc;color:#800000;">10</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dropboxBodyDef.<span style="color: #0066CC;">position</span>.<span style="color: #0066CC;">Set</span><span style="color: #66cc66;">&#40;</span>dropbox_x, <span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">5</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 箱の幅 15cm 高さ 15cm　重さは 1kg とする</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> dropboxShapeDef:b2PolygonDef= <span style="color: #000000; font-weight: bold;">new</span> b2PolygonDef<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//boxShapeDef.SetAsOrientedBox(0.3, 0.2, new b2Vec2(0, 0), 0.8);</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dropboxShapeDef.<span style="color: #006600;">SetAsBox</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">15</span>, <span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">15</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dropboxShapeDef.<span style="color: #006600;">density</span> = <span style="color: #cc66cc;color:#800000;">25</span>;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 密度</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dropboxShapeDef.<span style="color: #006600;">friction</span> = <span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">2</span>;&nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 摩擦係数</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dropboxShapeDef.<span style="color: #006600;">restitution</span> = <span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">7</span>;&nbsp; &nbsp;<span style="color: #808080; font-style: italic;">// 反発係数、通常は0～1</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 箱を動く物体として作る</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> dropboxBody:b2Body = world.<span style="color: #006600;">CreateBody</span><span style="color: #66cc66;">&#40;</span>dropboxBodyDef<span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//dropboxBody.CreateShape(dropboxShapeDef);</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// SetMassFromShapes で重力が有効になる</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//dropboxBody.SetMassFromShapes();</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// ボールのcategoryBits/maskBits</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dropboxShapeDef.<span style="color: #006600;">filter</span>.<span style="color: #006600;">categoryBits</span> = 0x01;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dropboxShapeDef.<span style="color: #006600;">filter</span>.<span style="color: #006600;">maskBits</span> = 0x01;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> dropbox:b2Body = world.<span style="color: #006600;">CreateBody</span><span style="color: #66cc66;">&#40;</span>dropboxBodyDef<span style="color: #66cc66;">&#41;</span>; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dropbox.<span style="color: #006600;">CreateShape</span><span style="color: #66cc66;">&#40;</span>dropboxShapeDef<span style="color: #66cc66;">&#41;</span>;&nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dropbox.<span style="color: #006600;">SetMassFromShapes</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> m_InputL:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;color:#800000;">0</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> m_InputR:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;color:#800000;">0</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> m_InputS:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;color:#800000;">0</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> m_Dir:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;color:#800000;">0</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> moveTime:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;color:#800000;">0</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// キーが押されたときの処理</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> keyDownHandler<span style="color: #66cc66;">&#40;</span>event:KeyboardEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; square.<span style="color: #006600;">WakeUp</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>event.<span style="color: #006600;">keyCode</span> == Keyboard.<span style="color: #0066CC;">LEFT</span> &amp;&amp; m_InputL != <span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; m_InputL = <span style="color: #cc66cc;color:#800000;">1</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; m_InputR = <span style="color: #cc66cc;color:#800000;">0</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; m_Dir = -<span style="color: #cc66cc;color:#800000;">1</span>.<span style="color: #cc66cc;color:#800000;">0</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; moveTime = <span style="color: #cc66cc;color:#800000;">0</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>event.<span style="color: #006600;">keyCode</span> == Keyboard.<span style="color: #0066CC;">RIGHT</span> &amp;&amp; m_InputR != <span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; m_InputR = <span style="color: #cc66cc;color:#800000;">1</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; m_InputL = <span style="color: #cc66cc;color:#800000;">0</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; m_Dir = <span style="color: #cc66cc;color:#800000;">1</span>.<span style="color: #cc66cc;color:#800000;">0</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; moveTime = <span style="color: #cc66cc;color:#800000;">0</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>event.<span style="color: #006600;">keyCode</span> == <span style="color: #cc66cc;color:#800000;">83</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span> <span style="color: #808080; font-style: italic;">// s</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; m_InputS = <span style="color: #cc66cc;color:#800000;">1</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> keyUpHandler<span style="color: #66cc66;">&#40;</span>event:KeyboardEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>event.<span style="color: #006600;">keyCode</span> == Keyboard.<span style="color: #0066CC;">LEFT</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; m_InputL = <span style="color: #cc66cc;color:#800000;">0</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>event.<span style="color: #006600;">keyCode</span> == Keyboard.<span style="color: #0066CC;">RIGHT</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; m_InputR = <span style="color: #cc66cc;color:#800000;">0</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>event.<span style="color: #006600;">keyCode</span> == <span style="color: #cc66cc;color:#800000;">83</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span> <span style="color: #808080; font-style: italic;">// s</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; m_InputS = <span style="color: #cc66cc;color:#800000;">0</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="color:#26536A;">&nbsp;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> enterFrameHandler<span style="color: #66cc66;">&#40;</span>event:Event<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>m_InputS == <span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; square.<span style="color: #006600;">m_linearVelocity</span>.<span style="color: #006600;">y</span> = -<span style="color: #cc66cc;color:#800000;">4</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>m_InputL&gt; <span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> leftForce:<span style="color: #0066CC;">Number</span> = <span style="color: #0066CC;">this</span>.<span style="color: #006600;">easeInOutQuad</span><span style="color: #66cc66;">&#40;</span>moveTime, <span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">5</span>, <span style="color: #cc66cc;color:#800000;">6</span>, <span style="color: #cc66cc;color:#800000;">30</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>moveTime &lt;<span style="color: #cc66cc;color:#800000;">30</span><span style="color: #66cc66;">&#41;</span> moveTime++;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; square.<span style="color: #006600;">m_linearVelocity</span>.<span style="color: #006600;">x</span> = -leftForce;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>m_InputR&gt; <span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> rightForce:<span style="color: #0066CC;">Number</span> = <span style="color: #0066CC;">this</span>.<span style="color: #006600;">easeInOutQuad</span><span style="color: #66cc66;">&#40;</span>moveTime, <span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">5</span>, <span style="color: #cc66cc;color:#800000;">6</span>, <span style="color: #cc66cc;color:#800000;">30</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>moveTime &lt;<span style="color: #cc66cc;color:#800000;">30</span><span style="color: #66cc66;">&#41;</span> moveTime++;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; square.<span style="color: #006600;">m_linearVelocity</span>.<span style="color: #006600;">x</span> = rightForce;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>world == <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="color:#26536A;">&nbsp;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> shape:b2Shape;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//　衝突判定　箱生命体</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">/*&nbsp; 今回はとりあえず箱との衝突はカウントしない方向で。</span></li>
				<li style="color:#26536A;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (var ce:b2ContactEdge = square.m_contactList; ce != null; ce = ce.next) {&nbsp; </span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var obj1:b2Body = ce.contact.GetShape1().m_body;//1つ目のオブジェクト </span></li>
				<li style="color:#26536A;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var obj2:b2Body = ce.contact.GetShape2().m_body;//2つ目のオブジェクト</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(obj1.m_userData &amp;&amp; obj2.m_userData &amp;&amp; ce.contact.GetManifoldCount() == 1){&nbsp; </span></li>
				<li style="color:#26536A;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (obj2.m_userData.id == &quot;dropbox&quot;) {</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (obj2.m_userData.crash&gt; 2){</span></li>
				<li style="color:#26536A;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shape = obj2.GetShapeList();</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shape.m_filter.maskBits = 0x00;</span></li>
				<li style="color:#26536A;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }else {</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; obj2.m_userData.crash++;</span></li>
				<li style="color:#26536A;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; </span></li>
				<li style="color:#26536A;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</span></li>
				<li style="color:#26536A;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; */</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 衝突判定　床</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> ce:b2ContactEdge = <span style="color: #0066CC;">floor</span>.<span style="color: #006600;">m_contactList</span>; ce != <span style="color: #000000; font-weight: bold;">null</span>; ce = ce.<span style="color: #006600;">next</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>&nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> obj1:b2Body = ce.<span style="color: #006600;">contact</span>.<span style="color: #006600;">GetShape1</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">m_body</span>;<span style="color: #808080; font-style: italic;">//1つ目のオブジェクト </span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> obj2:b2Body = ce.<span style="color: #006600;">contact</span>.<span style="color: #006600;">GetShape2</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">m_body</span>;<span style="color: #808080; font-style: italic;">//2つ目のオブジェクト</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>obj1.<span style="color: #006600;">m_userData</span> &amp;&amp; obj2.<span style="color: #006600;">m_userData</span> &amp;&amp; ce.<span style="color: #006600;">contact</span>.<span style="color: #006600;">GetManifoldCount</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> == <span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>&nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span>obj2.<span style="color: #006600;">m_userData</span>.<span style="color: #006600;">id</span> == <span style="color: #ff0000;">"dropbox"</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>obj2.<span style="color: #006600;">m_userData</span>.<span style="color: #006600;">crash</span>&gt; <span style="color: #cc66cc;color:#800000;">2</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shape = obj2.<span style="color: #006600;">GetShapeList</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shape.<span style="color: #006600;">m_filter</span>.<span style="color: #006600;">maskBits</span> = 0x00;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; obj2.<span style="color: #006600;">m_userData</span>.<span style="color: #006600;">crash</span>++;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span>&nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// Flashはデフォルトで秒間24フレームなので、</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// 物理シミュレーションを1/24秒進める</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; world.<span style="color: #006600;">Step</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">1</span> / <span style="color: #cc66cc;color:#800000;">24</span>, <span style="color: #cc66cc;color:#800000;">10</span><span style="color: #66cc66;">&#41;</span>;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">/**</span></li>
				<li style="color:#26536A;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; &nbsp; &nbsp; 　* t = time</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp; &nbsp; &nbsp; 　* b = beginning value</span></li>
				<li style="color:#26536A;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;　* c = change in value</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;　* d = duration</span></li>
				<li style="color:#26536A;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;　*/</span></li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> easeInOutQuad<span style="color: #66cc66;">&#40;</span>t:<span style="color: #0066CC;">Number</span>, b:<span style="color: #0066CC;">Number</span>, c:<span style="color: #0066CC;">Number</span>, d:<span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Number</span> <span style="color: #66cc66;">&#123;</span></li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>t/=d/<span style="color: #cc66cc;color:#800000;">2</span><span style="color: #66cc66;">&#41;</span> &lt;<span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span> <span style="color: #b1b100;">return</span> c/<span style="color: #cc66cc;color:#800000;">2</span>*t*t + b;</li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> -c/<span style="color: #cc66cc;color:#800000;">2</span> * <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>--t<span style="color: #66cc66;">&#41;</span>*<span style="color: #66cc66;">&#40;</span>t-<span style="color: #cc66cc;color:#800000;">2</span><span style="color: #66cc66;">&#41;</span> - <span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span> + b;</li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span>; </li>
				<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">&nbsp; &nbsp; &nbsp; &nbsp; </li>
				<li style="color:#26536A;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> xRandomInt <span style="color: #66cc66;">&#40;</span>nMax:<span style="color: #0066CC;">Number</span>, nMin:<span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Number</span> <span style="color: #66cc66;">&#123;</span></li>
				<li style="font-family: 'Courier New'