In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

nium先生を作ろう!β版 forked from: Progression4 Amateur

forked from checkmate's Progression4 Amateur
* @OKASUKE
* ゲームバランスは皆無です。運です 無駄にソースが長い・・・試行錯誤中
* 10/18 とりあえずiPhoneやAndroidにも移植できそうな・・・タッチ&リリース
* 10/19 アルファ版 絶対書き方間違ってる!
* 10/20 不具合を修正・点数計算方法(大雑把)を考える。
* 10/21 動きにフィルタをつける予定…いまいちなので中止
* 10/23 完成予定
* 10/31 称号Knightありがとうございます。
* 回転が0~180ではなくProgression上は-90~90ということに気づく
Get Adobe Flash player
by OKASUKE 01 Nov 2009
/**
 * Copyright OKASUKE ( http://wonderfl.net/user/OKASUKE )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/awki
 */

/*forked from checkmate's Progression4 Amateur
* @OKASUKE
* ゲームバランスは皆無です。運です 無駄にソースが長い・・・試行錯誤中
* 10/18 とりあえずiPhoneやAndroidにも移植できそうな・・・タッチ&リリース
* 10/19 アルファ版 絶対書き方間違ってる!
* 10/20 不具合を修正・点数計算方法(大雑把)を考える。
* 10/21 動きにフィルタをつける予定…いまいちなので中止
* 10/23 完成予定
* 10/31 称号Knightありがとうございます。
* 回転が0~180ではなくProgression上は-90~90ということに気づく
*/

package {

	import adobe.utils.CustomActions;
	import flash.display.*;
	import flash.events.*;
	import flash.geom.*;
         import flash.text.TextField;
         import flash.text.TextFieldType;
	import flash.text.TextFormat;
	import flash.text.TextFormatAlign;
	import flash.text.TextFieldAutoSize;	
	import flash.text.AntiAliasType;
	import flash.events.MouseEvent;
		
	import jp.progression.casts.*;
	import jp.progression.commands.*;
	import jp.progression.commands.lists.*;
	import jp.progression.commands.net.*;
	import jp.progression.config.*;
	import jp.progression.data.*;
	import jp.progression.events.*;
	import jp.progression.scenes.*;
	import jp.progression.*;
	
	[SWF( width=465, height=465, backgroundColor=0xFFFFFF, frameRate=30 )]

	public class Amateur extends Sprite {		

		public var manager:Progression, self:Amateur;

		//Graphics

		public var face:MovieClip;
		public var hair:MovieClip;
		public var eyeBrowLeft:MovieClip, eyeBrowRight:MovieClip;
		public var eyeLeft:MovieClip, eyeRight:MovieClip;
		public var nose:MovieClip;
		public var mouth:MovieClip;

		private var _status:Array;
                
		//*********************************
                  private var _tensu:TextField = new TextField;  
		private var _powerbar:Sprite;
		private var _mark:Sprite;
		private var _movebar:Sprite = new Sprite();
		private var _arrow:Sprite;
		
		private var _testball:Sprite;
		private var _testball2:Sprite;
			
		private var _friction:Number = 0.96;
		
		private var _count:int;
		
		private var _left:int = 0;
		private var _right:int = 465;		
		private var _top:int = 0;
		private var _bottom:int = 465;
			
		private var _rotface:int = 2;
		private var _rotmouth:int = 2;
		private var _rotnose:int = 2;
		private var _rothair:int = 2;
		private var _roteyeLeft:int = 2;
		private var _roteyeRight:int = 2;
		private var _roteyeBrowLeft:int = 2;
		private var _roteyeBrowRight:int = 2;		
		
		private var _canvasbd:BitmapData;
		private var _coltrf:ColorTransform;
					
		private var _powerface:Number;
		private var _powermouth:Number;
		private var _powernose:Number;
		private var _powerhair:Number;
		private var _powereyeLeft:Number;
		private var _powereyeRight:Number;
		private var _powereyeBrowLeft:Number;
		private var _powereyeBrowRight:Number;		
			
		private var _seek:int = 20;
		private var _arrowseek:Number = 0.96;		
		
                  //ここは意味ない。あとで  
		private var _vx:Number = 10;
		private var _vy:Number = 10;
		private var _vx2:Number = 10;
		private var _vy2:Number = 10;
		private var _vx3:Number = 10;
		private var _vy3:Number = 10;
		private var _vx4:Number = 10;
		private var _vy4:Number = 10;
		private var _vx5:Number = 10;
		private var _vy5:Number = 10;
		private var _vx6:Number = 10;
		private var _vy6:Number = 10;
		private var _vx7:Number = 10;
		private var _vy7:Number = 10;
		private var _vx8:Number = 10;
		private var _vy8:Number = 10;
				
		private var _bounce:Number = -0.98;
		private var _bounce2:Number = -0.98;
		private var _bounce3:Number = -0.98;
		private var _bounce4:Number = -0.98;
		private var _bounce5:Number = -0.98;
		private var _bounce6:Number = -0.98;
		private var _bounce7:Number = -0.98;
		private var _bounce8:Number = -0.98;	
		
		//***************************************
		// Do Something

		public function atReady():void {

			addChild( face );
			addChild( mouth );
			addChild( hair );
			addChild( nose );
			addChild( eyeLeft );
			addChild( eyeRight );
			addChild( eyeBrowRight );
			addChild( eyeBrowLeft );
			
			
			_status = [];

			for ( var i:int = 0, l:int = numChildren; i < l; i++ ) {

				var child:DisplayObject = getChildAt( i );
	
				_status.push( {
					x:child.x,
					y:child.y,
					scaleX:child.scaleX,
					scaleY:child.scaleY,
					rotation:child.rotation,
					visible:false
				} );
			}		
			
			setStage();
			//stage.addEventListener( MouseEvent.CLICK, _click );			
		}
		private var _num:int = 0;
		private function setStage():void {
			
			_count = 1;			
			
			_coltrf = new ColorTransform( 0.8, 0.8, 0.8, 1.0);
			_canvasbd = new BitmapData( stage.stageWidth, stage.stageHeight, false, 0x000000 );	
			addChild( new Bitmap( _canvasbd ) );
			
                           for (var i:int = 0; i < 1000; i++) {
				var star:Sprite = new Sprite();
				star.graphics.beginFill(0xFFFFFF, Math.random());
				star.graphics.drawCircle(Math.random() * 465, Math.random() * 465, 1);
				star.graphics.endFill();
				addChild(star);
			}



			_powerbar = new Sprite();
			_powerbar.graphics.beginFill(0xFFFFFF);
			_powerbar.graphics.drawRect(0, 0, 15, 300);
			_powerbar.graphics.endFill();
			_powerbar.x = 20;
			_powerbar.y = 50;
			addChild( _powerbar);	
			
			_movebar.graphics.beginFill(0xFFFFFF, 0.1);
			_movebar.graphics.lineStyle(1, 0xFFFFFF);
			_movebar.graphics.drawCircle(0, 0, 50);
			_movebar.graphics.endFill();
			_movebar.x = 200;
			_movebar.y = 420;
			//_movebar.width = 50;
			addChild( _movebar);
			
			_arrow = new Arrow();
			_arrow.x = 35;
			_arrow.y = 350 - _arrow.height/2;		
			addChild( _arrow);			
			
                            //
                            var format:TextFormat = new TextFormat();
			format.font = "Impact";
			format.size = 24;
			format.align = TextFormatAlign.CENTER;
			                           
			_tensu.x = 30;
			_tensu.y = 10; 
			//_tensu.alpha = 1.0
			_tensu.text = "??点";
			_tensu.selectable = false;					
			_tensu.type = TextFieldType.DYNAMIC;
			_tensu.antiAliasType = AntiAliasType.ADVANCED;
			_tensu.autoSize = TextFieldAutoSize.CENTER;
			_tensu.textColor = 0xFFFFFF;
			_tensu.defaultTextFormat = format;
			addChild(_tensu);

                            
                           var daitext:TextField = new TextField();
			daitext.text = "強";
                           daitext.textColor = 0xFFFFFF;
			daitext.x = 20;
			daitext.y = 350;
			var syoutext:TextField = new TextField();
			syoutext.text = "弱";
                            syoutext.textColor = 0xFFFFFF;
			syoutext.x = 20;
			syoutext.y = 30;
			
			addChild(daitext);
			addChild(syoutext);			



			
			setPARTS(_num);
			
			stage.addEventListener(Event.ENTER_FRAME, onloop, false, 10);	
			stage.addEventListener(MouseEvent.MOUSE_DOWN, ondown);
		}
		
		private function setPARTS(num:int):void {
			var child:DisplayObject = getChildAt( num );
			var status:Object = _status[num];
		    //var color:ColorTransform = new ColorTransform(Math.random(), Math.random(), Math.random(), 1.0, 0.0, 0.0, 0.0, 0.0);
			switch(num) {				
				case 0:				
					child.visible = true; 
					child.x = 200;
					child.y = 420;
					child.scaleX = 0.5;
					child.scaleY = 0.5;
					//child.transform.colorTransform = color;
					
					setChildIndex(child, numChildren-1);
					break;
				case 1:
					mouth.x = 200;
					mouth.y = 420;
					mouth.scaleX = 0.5;
					mouth.scaleY = 0.5;
					mouth.visible = true;
					//addChild(mouth);
					break;
				case 2:
					hair.x = 200;
					hair.y = 420;
					hair.scaleX = 0.5;
					hair.scaleY = 0.5;
					//addChild(hair);				
					break;
				case 3:
					nose.x = 200;
					nose.y = 420;
					nose.scaleX = 0.5;
					nose.scaleY = 0.5;
					//addChild(nose);
					break;
				case 4:
					eyeBrowLeft.x = 200;
					eyeBrowLeft.y = 420;
					//addChild(eyeBrowLeft);					
					break;	
				default:
					break;			
			}
		}
			
		//EnterFrame
		private function onloop(e:Event):void {			
			_tensu.text = "0点";
			if (_movebar.x >= (465 - _movebar.width)) {
				_movebar.x = 465 - _movebar.width;
				_seek *= -1;
			}else if (_movebar.x <= 0) {
				_movebar.x = 0;
				_seek *= -1;
			}
			_movebar.x = _movebar.x + Math.random() * _seek;
			//child:DisplayObject = getChildAt( num )だとうまくいかないので
                                //コマンドをうまく使えばいいのかな? とりあえずお試し中
			//trace(_count);
			switch(_count) {
				case 1:	
					//trace("1");
					face.addEventListener(Event.ENTER_FRAME, moveFace);
					break;
				case 2:
					//trace("2");
					mouth.addEventListener(Event.ENTER_FRAME, moveMouth);						
					break;
				case 3:
					//trace("3");
					hair.addEventListener(Event.ENTER_FRAME, moveHair);						
					break;
				case 4:
					//trace("4");
					nose.addEventListener(Event.ENTER_FRAME, moveNose);						
					break;
				case 5:
					//trace("5");
					eyeLeft.addEventListener(Event.ENTER_FRAME, moveeyeLeft);						
					break;
				case 6:
					//trace("6");
					eyeRight.addEventListener(Event.ENTER_FRAME, moveeyeRight);	
					break;
				case 7:
					//trace("7");
					eyeBrowRight.addEventListener(Event.ENTER_FRAME, moveeyeBrowRight);	
					break;
				case 8:
					//trace("8");
					eyeBrowLeft.addEventListener(Event.ENTER_FRAME, moveeyeBrowLeft);	
					break;
				default:				
					break;
			}
				
			if (_arrow.y >= 350 - _arrow.height/2) {
				_arrow.y = 350 - _arrow.height / 2;
				_arrowseek *= -1;
			}else if (_arrow.y <= 50) {
				_arrow.y = 50;
				_arrowseek *= -1;
			}			
			_arrow.y = (_arrow.y + 5 * _arrowseek);
                           
                            //**************************************
			if (_powerface == 0) {
				face.removeEventListener(Event.ENTER_FRAME, goface);
			}
			if (_powermouth == 0) {
				mouth.removeEventListener(Event.ENTER_FRAME, gomouth);
			}
			if(_powerhair == 0) {
				hair.removeEventListener(Event.ENTER_FRAME, gohair);
			}
			if(_powernose == 0) {
				nose.removeEventListener(Event.ENTER_FRAME, gonose);
			}
			if(_powereyeRight == 0) {
				eyeRight.removeEventListener(Event.ENTER_FRAME, goeyeright);
			}
			if(_powereyeLeft == 0) {
				eyeLeft.removeEventListener(Event.ENTER_FRAME, goeyeleft);
			}
			if(_powereyeBrowRight == 0) {
				eyeBrowRight.removeEventListener(Event.ENTER_FRAME, goeyebrowright);
			}
			if(_powereyeBrowLeft == 0) {
				eyeBrowLeft.removeEventListener(Event.ENTER_FRAME, goeyebrowleft);
			}
			if (_powerface + _powermouth + _powerhair + _powernose + _powereyeRight + _powereyeLeft + _powereyeBrowRight + _powereyeBrowLeft == 0) {
                                    //点数計算a
                                    lastcalc();                                        
				stage.removeEventListener(Event.ENTER_FRAME, onloop);
                                     		                    	
                
                            }
		}

                  private function lastcalc():void {
                    //face+nose+hair+moutheyeRight+mouth+eyeLeft+eyeLeft+eyeRight + 16
                    var kao:Number = (234 + 242) + (242 + 322) + (233 + 194) + (236 + 275) + (272 + 243) + (190 + 248) + (190 + 218) + (270 + 218) + 16
					
                    var kaox:Number = (face.x + face.y + face.scaleX + face.scaleY) + (nose.x + nose.y + nose.scaleX + nose.scaleY) + (hair.x + hair.y+ hair.scaleX + hair.scaleY) + (mouth.x + mouth.y+ mouth.scaleX + mouth.scaleY) + 
 (eyeLeft.x + eyeLeft.y + eyeLeft.scaleX + eyeLeft.scaleY ) + (eyeRight.x + eyeRight.y + eyeRight.scaleX * eyeRight.scaleY) +
 (eyeBrowLeft.x + eyeBrowLeft.y+ eyeBrowLeft.scaleX + eyeBrowLeft.scaleY) +(eyeBrowRight.x + eyeBrowRight.y + eyeBrowRight.scaleX + eyeBrowRight.scaleY);
                    var genten:Number = 0;
                    //abs()が速いのか?
                    if (kao >= kaox) {
                        genten = kao - kaox;
                    } else {
                        genten = kaox - kao;
                    }
                    var kaoten:Number = 100 - genten;             

                    //var kaoten:Number = (100 * kaox) / kao;
                    _tensu.text = Math.round(kaoten * 1000) / 1000 + "点";
                    
                    //stage.addChild(tensu);
                  }
  
                  private function moveFace(e:Event):void {
			//var child:DisplayObject = getChildAt( numChildren-1 );
			//var status:Object = _status[numChildren-1];
			//trace("moveF");
			//trace(child);
			face.x = _movebar.x; //+ _movebar.width / 2;					
			if (face.rotation >= 90) {
				_rotface *= -1;
			} else if (face.rotation <= -90) {
				_rotface *= -1;
			}			
			face.rotation += _rotface;
		}
		
		private function moveMouth(e:Event):void {
			//var child:DisplayObject = getChildAt( numChildren-1 );
			//var status:Object = _status[numChildren-1];
			//trace("moveM");
			//trace(child);
			mouth.x = _movebar.x; // + _movebar.width / 2;					
			if (mouth.rotation >= 90) {
				_rotmouth *= -1;
			} else if (mouth.rotation <= -90) {
				_rotmouth *= -1;
			}			
			mouth.rotation += _rotmouth;			
		}
		
		private function moveHair(e:Event):void {
			//var child:DisplayObject = getChildAt( numChildren-1 );
			//var status:Object = _status[numChildren-1];
			//trace("moveH");
			//trace(child);
			hair.x = _movebar.x;  //+ _movebar.width / 2;					
			if (hair.rotation >= 90) {
				_rothair *= -1;
			} else if (hair.rotation <= -90) {
				_rothair *= -1;
			}
			hair.rotation += _rothair;			
		}
		
		private function moveNose(e:Event):void {
			nose.x = _movebar.x; //+ _movebar.width / 2;					
			if (nose.rotation >= 90) {
				_rotnose *= -1;
			} else if (nose.rotation <= -90) {
				_rotnose *= -1;
			}
			nose.rotation += _rotnose;			
		}
		
		private function moveeyeLeft(e:Event):void {
			eyeLeft.x = _movebar.x; // + _movebar.width / 2;					
			if (eyeLeft.rotation >= 90) {
				_roteyeLeft *= -1;
			} else if (eyeLeft.rotation <= -90) {
				_roteyeLeft *= -1;
			}
			eyeLeft.rotation += _roteyeLeft;			
		}
		
		private function moveeyeRight(e:Event):void {
			eyeRight.x = _movebar.x; //+ _movebar.width / 2;					
			if (eyeRight.rotation >= 90) {
				_roteyeRight *= -1;
			} else if (eyeRight.rotation <= -90) {
				_roteyeRight *= -1;
			}
			eyeRight.rotation += _roteyeRight;			
		}
		
		private function moveeyeBrowLeft(e:Event):void {
			eyeBrowLeft.x = _movebar.x;  //+ _movebar.width / 2;					
			if (eyeBrowLeft.rotation >= 90) {
				_roteyeBrowLeft *= -1;
			} else if (eyeBrowLeft.rotation <= -90) {
				_roteyeBrowLeft *= -1;
			}
			eyeBrowLeft.rotation += _roteyeBrowLeft;			
		}
		
		private function moveeyeBrowRight(e:Event):void {
			eyeBrowRight.x = _movebar.x;  //+ _movebar.width / 2;					
			if (eyeBrowRight.rotation >= 90) {
				_roteyeBrowRight *= -1;
			} else if (eyeBrowRight.rotation <= -90) {
				_roteyeBrowRight *= -1;
			}
			eyeBrowRight.rotation += _roteyeBrowRight;		
		}		
		
		//***********************************************************
		
		private function ondown(e:MouseEvent):void {
			var arrowp:Number;
			var movebarp:Number;
			var power:Number;
			//trace("ondown");
			//stage.removeEventListener(Event.ENTER_FRAME, onloop);
			
			stage.removeEventListener(MouseEvent.MOUSE_DOWN, ondown);	
			
			//movebarp = _movebar.x;
			switch(_count) {
				case 1:					
					_powerface = _arrow.y;
					face.addEventListener(Event.ENTER_FRAME, goface);				
					break;
				case 2:				
					_powermouth = _arrow.y;
					mouth.addEventListener(Event.ENTER_FRAME, gomouth);				
					break;
				case 3:
					_powerhair = _arrow.y;
					hair.addEventListener(Event.ENTER_FRAME, gohair);					
					break;
				case 4:
					_powernose = _arrow.y;
					nose.addEventListener(Event.ENTER_FRAME, gonose);
					break;
				case 5:
					_powereyeLeft = _arrow.y;
					eyeLeft.addEventListener(Event.ENTER_FRAME, goeyeleft);
					break;
				case 6:
					_powereyeRight = _arrow.y;
					eyeRight.addEventListener(Event.ENTER_FRAME, goeyeright);
					break;
				case 7:
					_powereyeBrowRight = _arrow.y;
					eyeBrowRight.addEventListener(Event.ENTER_FRAME, goeyebrowright);
					break;
				case 8:
					_powereyeBrowLeft = _arrow.y;
					eyeBrowLeft.addEventListener(Event.ENTER_FRAME, goeyebrowleft);
					break;
				default:
					break;				
			}
				
			stage.addEventListener(MouseEvent.MOUSE_UP, onup);	
		}
			
		private function goface(e:Event):void {
			
			var mtx:Matrix = new Matrix();
			//trace("aaa");
			face.y += Math.sin(face.rotation * Math.PI / 180) * _vy * _powerface / 10;
			face.x += Math.cos(face.rotation * Math.PI / 180) * _vx * _powerface / 10;
			mtx.rotate(face.rotation * Math.PI / 180);
			mtx.scale(0.5, 0.5);
			mtx.tx = face.x;
			mtx.ty = face.y;
			_canvasbd.draw(face, mtx );
			//trace(_testball.rotation);
			_canvasbd.colorTransform(_canvasbd.rect, _coltrf );
			
			hitWallFace();
                            if (_powerface <= 5) {
				_powerface = 0;
				face.x = 234 + ( Math.random() - 0.5 ) * 10; //232;
				face.y = 242 + ( Math.random() - 0.5 ) * 10; //232;
				face.scaleX = 1 + ( Math.random() - 0.5 ) / 2; //1.0;
				face.scaleY = 1 + ( Math.random() - 0.5 ) / 2; //1.0;
				face.rotation = 0 + ( Math.random() - 0.5 ) * 10;
				face.removeEventListener(Event.ENTER_FRAME, moveFace);				
			} else {
				_powerface -= 2;				
			}				
		}
			
		private function gomouth(e:Event):void {		
			
			var mtx:Matrix = new Matrix();			
			mouth.y += Math.sin(mouth.rotation * Math.PI / 180) * _vy2 * _powermouth / 10;
			mouth.x += Math.cos(mouth.rotation * Math.PI / 180) * _vx2 * _powermouth / 10;
			mtx.rotate(mouth.rotation * Math.PI / 180);
			//mtx.scale(1, 1);
			mtx.tx = mouth.x;
			mtx.ty = mouth.y;
			_canvasbd.draw(mouth, mtx );
			//trace(_testball.rotation);
			_canvasbd.colorTransform(_canvasbd.rect, _coltrf );
			
			hitWallMouth();			
			//x,y 242,322		
			if (_powermouth <= 5) {
				_powermouth = 0;
				mouth.x = 242 + ( Math.random() - 0.5 ) * 10;
				mouth.y = 322 + ( Math.random() - 0.5 ) * 10;
				mouth.scaleX = 1 + ( Math.random() - 0.5 ) / 2;
				mouth.scaleY = 1 + ( Math.random() - 0.5 ) / 2;
				mouth.rotation = 1 + ( Math.random() - 0.5 ) * 10;
				//face.removeEventListener(Event.ENTER_FRAME, goface);
				mouth.removeEventListener(Event.ENTER_FRAME, moveMouth);				
			} else {
				_powermouth -= 2;				
			}			
		}
		
		private function gohair(e:Event):void {		
			
			var mtx:Matrix = new Matrix();		
			hair.y += Math.sin(hair.rotation * Math.PI / 180) * _vy3 * _powerhair / 10;
			hair.x += Math.cos(hair.rotation * Math.PI / 180) * _vx3 * _powerhair / 10;
			mtx.rotate(hair.rotation * Math.PI / 180);
			mtx.scale(0.5, 0.5);
			mtx.tx = hair.x;
			mtx.ty = hair.y;
			_canvasbd.draw(hair, mtx );
			//trace(_testball.rotation);
			_canvasbd.colorTransform(_canvasbd.rect, _coltrf );
			
			hitWallHair();			
			//233,194ꏊ			
			if (_powerhair <= 5) {
				_powerhair = 0;
				hair.x = 233 + ( Math.random() - 0.5 ) * 10;
				hair.y = 194 + ( Math.random() - 0.5 ) * 10;
				hair.scaleX = 1 + ( Math.random() - 0.5 ) / 2;
				hair.scaleY = 1 + ( Math.random() - 0.5 ) / 2;
				hair.rotation = 1 + ( Math.random() - 0.5 ) * 10;
				//mouth.removeEventListener(Event.ENTER_FRAME, gomouth);
				hair.removeEventListener(Event.ENTER_FRAME, moveHair);
				
			} else {				
				_powerhair -= 2;				
			}			
		}
		
		private function gonose(e:Event):void {		
			
			var mtx:Matrix = new Matrix();
			//trace("aaa");
			nose.y += Math.sin(nose.rotation * Math.PI / 180) * _vy4 * _powernose / 10;
			nose.x += Math.cos(nose.rotation * Math.PI / 180) * _vx4 * _powernose / 10;
			mtx.rotate(nose.rotation * Math.PI / 180);
			//mtx.scale(1, 1);
			mtx.tx = nose.x;
			mtx.ty = nose.y;
			_canvasbd.draw(nose, mtx );
			//trace(_testball.rotation);
			_canvasbd.colorTransform(_canvasbd.rect, _coltrf );
			
			hitWallNose();			
			//236,275			
			if (_powernose <= 5) {
				_powernose = 0;
				nose.x = 236 + ( Math.random() - 0.5 ) * 10;
				nose.y = 275 + ( Math.random() - 0.5 ) * 10;
				nose.scaleX = 1 + ( Math.random() - 0.5 ) / 2;
				nose.scaleY = 1 + ( Math.random() - 0.5 ) / 2;
				nose.rotation = 1 + ( Math.random() - 0.5 ) * 10;
				//hair.removeEventListener(Event.ENTER_FRAME, gohair);
				nose.removeEventListener(Event.ENTER_FRAME, moveNose);
			} else {
				_powernose -= 2;				
			}			
		}
		
		private function goeyeleft(e:Event):void {		
			
			var mtx:Matrix = new Matrix();
			//trace("aaa");
			eyeLeft.y += Math.sin(eyeLeft.rotation * Math.PI / 180) * _vy5 * _powereyeLeft / 10;
			eyeLeft.x += Math.cos(eyeLeft.rotation * Math.PI / 180) * _vx5 * _powereyeLeft / 10;
			mtx.rotate(eyeLeft.rotation * Math.PI / 180);
			//mtx.scale(1, 1);
			mtx.tx = eyeLeft.x;
			mtx.ty = eyeLeft.y;
			_canvasbd.draw(eyeLeft, mtx );
			//trace(_testball.rotation);
			_canvasbd.colorTransform(_canvasbd.rect, _coltrf );
				
			hitWalleyeLeft();
				
			//272, 243			
			if (_powereyeLeft <= 5) {
				_powereyeLeft = 0;
				eyeLeft.x = 272 + ( Math.random() - 0.5 ) * 10;
				eyeLeft.y = 243 + ( Math.random() - 0.5 ) * 10;
				eyeLeft.scaleX = 1 + ( Math.random() - 0.5 ) / 2;
				eyeLeft.scaleY = 1 + ( Math.random() - 0.5 ) / 2;
				eyeLeft.rotation = 1 + ( Math.random() - 0.5 ) * 10;
				//nose.removeEventListener(Event.ENTER_FRAME, gonose);
				eyeLeft.removeEventListener(Event.ENTER_FRAME, moveeyeLeft);
			} else {
				_powereyeLeft -= 2;				
			}			
		}
		
		private function goeyeright(e:Event):void {		
			
			var mtx:Matrix = new Matrix();
			//trace("aaa");
			eyeRight.y += Math.sin(eyeRight.rotation * Math.PI / 180) * _vy6 * _powereyeRight / 10;
			eyeRight.x += Math.cos(eyeRight.rotation * Math.PI / 180) * _vx6 * _powereyeRight / 10;
			mtx.rotate(eyeRight.rotation * Math.PI / 180);
			//mtx.scale(1, 1);
			mtx.tx = eyeRight.x;
			mtx.ty = eyeRight.y;
			_canvasbd.draw(eyeRight, mtx );
			//trace(_testball.rotation);
			_canvasbd.colorTransform(_canvasbd.rect, _coltrf );
			hitWalleyeRight()	
				
			//190,248			
			if (_powereyeRight <= 5) {
				_powereyeRight = 0;
				eyeRight.x = 190 + ( Math.random() - 0.5 ) * 10;
				eyeRight.y = 248 + ( Math.random() - 0.5 ) * 10;
				eyeRight.scaleX = 1 + ( Math.random() - 0.5 ) / 2;
				eyeRight.scaleY = 1 + ( Math.random() - 0.5 ) / 2;
				eyeRight.rotation = 1 + ( Math.random() - 0.5 ) * 10;
				//eyeLeft.removeEventListener(Event.ENTER_FRAME, goeyeleft);
				eyeRight.removeEventListener(Event.ENTER_FRAME, moveeyeRight);
			} else {
				_powereyeRight -= 2;				
			}			
		}
		
		private function goeyebrowright(e:Event):void {		
			
			var mtx:Matrix = new Matrix();
			//trace("aaa");
			eyeBrowRight.y += Math.sin(eyeBrowRight.rotation * Math.PI / 180) * _vy7 * _powereyeBrowRight / 10;
			eyeBrowRight.x += Math.cos(eyeBrowRight.rotation * Math.PI / 180) * _vx7 * _powereyeBrowRight / 10;
			mtx.rotate(eyeBrowRight.rotation * Math.PI / 180);
			//mtx.scale(1, 1);
			mtx.tx = eyeBrowRight.x;
			mtx.ty = eyeBrowRight.y;
			_canvasbd.draw(eyeBrowRight, mtx );
			//trace(_testball.rotation);
			_canvasbd.colorTransform(_canvasbd.rect, _coltrf );
			
			hitWalleyeBrowRight();			
			//190,218						
			if (_powereyeBrowRight <= 5) {
				_powereyeBrowRight = 0;
				eyeBrowRight.x = 190 + ( Math.random() - 0.5 ) * 10;
				eyeBrowRight.y = 218 + ( Math.random() - 0.5 ) * 10;
				eyeBrowRight.scaleX = 1 + ( Math.random() - 0.5 ) / 2;
				eyeBrowRight.scaleY = 1 + ( Math.random() - 0.5 ) / 2;
				eyeBrowRight.rotation = 1 + ( Math.random() - 0.5 ) * 10;
				//eyeRight.removeEventListener(Event.ENTER_FRAME, goeyeright);
				eyeBrowRight.removeEventListener(Event.ENTER_FRAME, moveeyeBrowRight);
			} else {
				_powereyeBrowRight -= 2;				
			}			
		}
		
		private function goeyebrowleft(e:Event):void {		
			
			var mtx:Matrix = new Matrix();
			//trace("aaa");
			eyeBrowLeft.y += Math.sin(eyeBrowLeft.rotation * Math.PI / 180) * _vy8 * _powereyeBrowLeft / 10;
			eyeBrowLeft.x += Math.cos(eyeBrowLeft.rotation * Math.PI / 180) * _vx8 * _powereyeBrowLeft / 10;
			mtx.rotate(eyeBrowLeft.rotation * Math.PI / 180);
			//mtx.scale(1, 1);
			mtx.tx = eyeBrowLeft.x;
			mtx.ty = eyeBrowLeft.y;
			_canvasbd.draw(eyeBrowLeft, mtx );
			//trace(_testball.rotation);
			_canvasbd.colorTransform(_canvasbd.rect, _coltrf );
			
			hitWalleyeBrowLeft();			
			//270,218		
			if (_powereyeBrowLeft <= 5) {
				_powereyeBrowLeft = 0;
				eyeBrowLeft.x = 270 + ( Math.random() - 0.5 ) * 10;
				eyeBrowLeft.y = 218 + ( Math.random() - 0.5 ) * 10;
				eyeBrowLeft.scaleX = 1 + ( Math.random() - 0.5 ) / 2;
				eyeBrowLeft.scaleY = 1 + ( Math.random() - 0.5 ) / 2;
				eyeBrowLeft.rotation = 1 + ( Math.random() - 0.5 ) * 10;
                                     //ここでも判定                                   //                                  
				if (_powerface == 0) {
					face.removeEventListener(Event.ENTER_FRAME, goface);
				}
				if (_powermouth == 0) {
					mouth.removeEventListener(Event.ENTER_FRAME, gomouth);
				}
				if(_powerhair == 0) {
					hair.removeEventListener(Event.ENTER_FRAME, gohair);
				}
				if(_powernose == 0) {
					nose.removeEventListener(Event.ENTER_FRAME, gonose);
				}
				if(_powereyeRight == 0) {
					eyeRight.removeEventListener(Event.ENTER_FRAME, goeyeright);
				}
				if(_powereyeLeft == 0) {
					eyeLeft.removeEventListener(Event.ENTER_FRAME, goeyeleft);
				}
				if(_powereyeBrowRight == 0) {
					eyeBrowRight.removeEventListener(Event.ENTER_FRAME, goeyebrowright);
				}
				if(_powereyeBrowLeft == 0) {
					eyeBrowLeft.removeEventListener(Event.ENTER_FRAME, goeyebrowleft);
				}

                                    eyeBrowLeft.removeEventListener(Event.ENTER_FRAME, moveeyeBrowLeft);
				
			} else {
				_powereyeBrowLeft -= 2;				
			}			
		}
			
		//hitTest
		private function hitWallFace():void {
			//trace(face.x);
			if (_left >= face.x) {
				face.x = 10;
				_vx *= _bounce;
			} else if (_right <= face.x) {
				face.x = 465;
				_vx *= _bounce;
			} else if (face.y >= _bottom) {
				face.y = 465;
				_vy *= _bounce;
			} else if (face.y <= _top) {
				face.y = 0;
				_vy *= _bounce;
			}
		}		
		private function hitWallMouth():void {
			//trace(face.x);
			if (_left >= mouth.x) {
				mouth.x = 10;
				_vx2 *= _bounce2;
			} else if (_right <= mouth.x) {
				mouth.x = 465;
				_vx2 *= _bounce2;
			} else if (mouth.y >= _bottom) {
				mouth.y = 465;
				_vy2 *= _bounce2;
			} else if (mouth.y <= _top) {
				mouth.y = 0;
				_vy2 *= _bounce2;
			}
		}
		private function hitWallNose():void {
			if (_left >= nose.x) {
				nose.x = 10;
				_vx4 *= _bounce4;
			} else if (_right <= nose.x) {
				nose.x = 465;
				_vx4 *= _bounce4;
			} else if (nose.y >= _bottom) {
				nose.y = 465;
				_vy4 *= _bounce4;
			} else if (nose.y <= _top) {
				nose.y = 0;
				_vy4 *= _bounce4;
			}
		}
		private function hitWallHair():void {
			if (_left >= hair.x) {
				hair.x = 10;
				_vx3 *= _bounce3;
			} else if (_right <= hair.x) {
				hair.x = 465;
				_vx3 *= _bounce3;
			} else if (hair.y >= _bottom) {
				hair.y = 465;
				_vy3 *= _bounce3;
			} else if (hair.y <= _top) {
				hair.y = 0;
				_vy3 *= _bounce3;
			}
		}
		private function hitWalleyeLeft():void {
			if (_left >= eyeLeft.x) {
				eyeLeft.x = 10;
				_vx5 *= _bounce5;
			} else if (_right <= eyeLeft.x) {
				eyeLeft.x = 465;
				_vx5 *= _bounce5;
			} else if (eyeLeft.y >= _bottom) {
				eyeLeft.y = 465;
				_vy5 *= _bounce5;
			} else if (eyeLeft.y <= _top) {
				eyeLeft.y = 0;
				_vy5 *= _bounce5;
			}
		}
		private function hitWalleyeRight():void {
			if (_left >= eyeRight.x) {
				eyeRight.x = 10;
				_vx6 *= _bounce6;
			} else if (_right <= eyeRight.x) {
				eyeRight.x = 465;
				_vx6 *= _bounce6;
			} else if (eyeRight.y >= _bottom) {
				eyeRight.y = 465;
				_vy6 *= _bounce6;
			} else if (eyeRight.y <= _top) {
				eyeRight.y = 0;
				_vy6 *= _bounce6;
			}
		}
				
		private function hitWalleyeBrowRight():void {
			if (_left >= eyeBrowRight.x) {
				eyeBrowRight.x = 10;
				_vx7 *= _bounce7;
			} else if (_right <= eyeBrowRight.x) {
				eyeBrowRight.x = 465;
				_vx7 *= _bounce7;
			} else if (eyeBrowRight.y >= _bottom) {
				eyeBrowRight.y = 465;
				_vy7 *= _bounce7;
			} else if (eyeBrowRight.y <= _top) {
				eyeBrowRight.y = 0;
				_vy7 *= _bounce7;
			}
		}			
		private function hitWalleyeBrowLeft():void {
			if (_left >= eyeBrowLeft.x) {
				eyeBrowLeft.x = 10;
				_vx8 *= _bounce8;
			} else if (_right <= eyeBrowLeft.x) {
				eyeBrowLeft.x = 465;
				_vx8 *= _bounce8;
			} else if (eyeBrowLeft.y >= _bottom) {
				eyeBrowLeft.y = 465;
				_vy8 *= _bounce8;
			} else if (eyeBrowLeft.y <= _top) {
				eyeBrowLeft.y = 0;
				_vy8 *= _bounce8;
			}
		}			
			
		private function onup(e:MouseEvent):void {
			stage.removeEventListener(MouseEvent.MOUSE_UP, onup);
			
			_count += 1;
			_num += 1;
			
			if (_count <= 8) {
				setPARTS(0);				
				stage.addEventListener(MouseEvent.MOUSE_DOWN, ondown);
			} else {
				_movebar.alpha = 0.1;
				//stage.removeEventListener(Event.ENTER_FRAME, onloop);
				
			}
			//trace("onup");
			//stage.addEventListener(Event.ENTER_FRAME, onloop);
			//trace("ondownList");
			
		}
	
		public function Amateur() {
			CheckmateBuilder.initialize( this );
		}
	}
}

///////////////////////////////////////////////////////////////////////////////

import flash.display.*;
import flash.events.*;
import flash.net.URLRequest;
import flash.system.ApplicationDomain;

import jp.progression.casts.*;
import jp.progression.commands.*;
import jp.progression.commands.lists.*;
import jp.progression.commands.net.*;
import jp.progression.config.*;
import jp.progression.data.*;
import jp.progression.events.*;
import jp.progression.scenes.*;
import jp.progression.*;

class CheckmateBuilder extends EventDispatcher {

	public static var GRAPHICS_URL:String = "http://swf.wonderfl.net/static/assets/checkmate04/AmateurAssets.swf";
	private static var _target:Amateur;
	private static var _manager:Progression;

	public static function initialize( target:Amateur ):void {

		if ( _target ) { return; }

		_target = target;
		_target.self = target;

		Progression.initialize( new BasicAppConfig() );

		_manager = new Progression( "index", _target.stage );

		_manager.root.addEventListener( SceneEvent.SCENE_LOAD, _sceneLoad );
		
		_manager.root.addEventListener( SceneEvent.SCENE_INIT_COMPLETE, _sceneInitComplete );

		_manager.goto( _manager.root.sceneId );
	}

	private static function _sceneLoad( e:SceneEvent ):void {

		_manager.root.addCommand(

			new LoadSWF( new URLRequest( GRAPHICS_URL ) ),

			function():void {

				var loader:Loader = Loader( this.latestData );

				var domain:ApplicationDomain = loader.contentLoaderInfo.applicationDomain;

				_target.face = new ( domain.getDefinition( "Face" ) as Class );
				_target.face.x = 234;
				_target.face.y = 242;

				_target.hair = new ( domain.getDefinition( "Hair" ) as Class );
				_target.hair.x = 233;
				_target.hair.y = 194;

				_target.eyeBrowRight = new ( domain.getDefinition( "EyeBrowRight" ) as Class );
				_target.eyeBrowRight.x = 190;
				_target.eyeBrowRight.y = 218;

				_target.eyeBrowLeft = new ( domain.getDefinition( "EyeBrowLeft" ) as Class );
				_target.eyeBrowLeft.x = 270;
				_target.eyeBrowLeft.y = 218;

				_target.eyeRight = new ( domain.getDefinition( "EyeRight" ) as Class );
				_target.eyeRight.x = 190;
				_target.eyeRight.y = 248;

				_target.eyeLeft = new ( domain.getDefinition( "EyeLeft" ) as Class );
				_target.eyeLeft.x = 272;
				_target.eyeLeft.y = 243;

				_target.nose = new ( domain.getDefinition( "Nose" ) as Class );
				_target.nose.x = 236;
				_target.nose.y = 275;

				_target.mouth = new ( domain.getDefinition( "Mouth" ) as Class );
				_target.mouth.x = 242;
				_target.mouth.y = 322;
				
			}
		);
	}

	private static function _sceneInitComplete( e:SceneEvent ):void {
		_target.atReady();
	}
}

import flash.text.TextField;

internal class Arrow extends Sprite {
	
	public function Arrow() {		
		drawArrow();		
	}
	
	private function drawArrow():void {
		graphics.clear();
		graphics.beginFill(0x0000FF);
		graphics.lineStyle(1, 0xffffff);
		graphics.moveTo(10, 0);
		graphics.lineTo(10, 10);
		graphics.lineTo( 0, 5);
		graphics.lineTo(10, 0);
		graphics.endFill();		
	}
}