/*-----重力設定--------------------------*/
GSet(global.G,global.Gdir,0.95,1,0,0.95,1,1);

with(objEnemyEdit){ if(Edit_Play) exit; }
/*-----キャラクタとの情報の取得---------------*/
playerDistanceX = abs(x - objPlayerDoll.x);
playerDistance = point_distance(x,y,objPlayerDoll.x,objPlayerDoll.y);
playerDirection = point_direction(x,y,objPlayerDoll.x,objPlayerDoll.y);

/*-----モーション毎の処理--------------------*/
DAMAGE_ACTIVE = 0;

HeadPosX = Process[ProcessNum[PARTS_EYE]].x;
HeadPosY = Process[ProcessNum[PARTS_EYE]].y;
with(HeadCollision){
	if(RECV_DAMAGE){
		if(!INV){
			with(other){ playEnemySound(SOUND_DAMAGE); }
			Fluid(x,y,make_color_rgb(263,73,164),15,5,20,0,360,0.7);
		}
	}
	depth = -100000;
	x = other.HeadPosX;
	y = other.HeadPosY;
	if(place_meeting(other.HeadPosX,other.HeadPosY,objBlock)){
		x = xprevious;
		y = yprevious;
	}

	other.HP = HP + global.BOSSHPMAX;
}

if(HP<0){
	if(!ChangeMotion){
		if(MotionNum!=DEAD_MOTION){
			Quake(35,35);
			MotionChange(DEAD_MOTION,0,1);
		}
	}
}

INV = 1;
switch(MotionNum){
	case CATCH2_EAT:
	case CATCH2_TIGIRI:
		DepthSet(objPlayerDoll.depth + 1000);
		Process[ProcessNum[PARTS_HAND_ABOVE]].depth = objPlayerDoll.depth - 1000;
		Process[ProcessNum[PARTS_ARM1_ABOVE]].depth = objPlayerDoll.depth - 1001;
		Process[ProcessNum[PARTS_ARM2_ABOVE]].depth = objPlayerDoll.depth - 1002;
		Process[ProcessNum[PARTS_BODY]].depth = objPlayerDoll.depth - 1000;
		with(objController){
			with(CtrlTarget){
				global.BindMax = 24+0.1*(100-global.PlayerHP);
				if( other.BindCounter>24+0.1*(100-global.PlayerHP) ){
					other.BindCounter = 0;
					move_outside_afterBind();
					BINDED = 0;
				}
			}
		}
		break;

	case CATCH2_KUBIORI:
	case CATCH_NIGIRI:
		DepthSet(objPlayerDoll.depth + 1000);
		Process[ProcessNum[PARTS_HAND_ABOVE]].depth = objPlayerDoll.depth - 1000;
		Process[ProcessNum[PARTS_ARM1_ABOVE]].depth = objPlayerDoll.depth - 1001;
		Process[ProcessNum[PARTS_ARM2_ABOVE]].depth = objPlayerDoll.depth - 1002;
		with(objController){
			with(CtrlTarget){
				global.BindMax = 30+0.1*(100-global.PlayerHP);
				if( other.BindCounter>30+0.1*(100-global.PlayerHP) ){
					other.BindCounter = 0;
					move_outside_afterBind();
					BINDED = 0;
				}
			}
		}
		break;
}

if(!ChangeMotion){
	switch(MotionNum){
		case STAND :

			/* 相手の方を向く */
			if(objPlayerDoll.x > x) Direction = Right;
			else Direction = Left;

			/* 近づいたら歩く */
			if( !air && 200<playerDistance){ MotionChange(WALK,0,5); break; }

			if( !air ){
				if( 70 > playerDistanceX ){
					switch(irandom(10)){
						case 0: 
						case 1: 
						case 2: if(!collision_line( x,y,x+Direction*320,y,objBlock,0,1)) MotionChange(BACKSTEP,2,1); break;
						case 3: MotionChange(ATTACKUPPER,2,2); break;
						case 4: MotionChange(KICKCANON  ,2,2); break;
						case 5: if(y+100<objPlayerDoll.y && !collision_line( x,y,x-Direction*400,y,objBlock,0,1)) MotionChange(CATCH2,irandom(1),2); break;
						case 6: MotionChange(KICKPRESS  ,2,2); break;
					}
				}else if( 120 > playerDistanceX ){
					switch(irandom(5)){
						case 0: if(!collision_line( x,y,x+Direction*320,y,objBlock,0,1)) MotionChange(BACKSTEP,irandom(3),2); break;
						case 1: if(!collision_line( x,y,x+Direction*320,y,objBlock,0,1)) MotionChange(BACKSTEP,irandom(3),2); break;
						case 2: MotionChange(ATTACKUPPER,irandom(3),2); break;
						case 3: if(y+100<objPlayerDoll.y && !collision_line( x,y,x-Direction*400,y,objBlock,0,1)) MotionChange(CATCH ,irandom(1),2); break;
						case 4: if(y+100<objPlayerDoll.y && !collision_line( x,y,x-Direction*400,y,objBlock,0,1)) MotionChange(CATCH2,irandom(1),2); break;
					}
				}else if( 250 > playerDistanceX ){
					switch(irandom(5)){
						case 0: MotionChange(ATTACKUPPER,irandom(3),2); break;
						case 1: MotionChange(KICKPRESS  ,irandom(3),2); break;
						case 2: if(y+100<objPlayerDoll.y && !collision_line( x,y,x-Direction*320,y,objBlock,0,1)) MotionChange(CATCH ,irandom(1),2); break;
					}
				}else if( 350 > playerDistanceX ){
					switch(irandom(10)){
						case 0: if(y+100<objPlayerDoll.y && !collision_line( x,y,x-Direction*400,y,objBlock,0,1)) MotionChange(CATCH ,irandom(1),2); break;
						case 1: if(y+100<objPlayerDoll.y && !collision_line( x,y,x-Direction*400,y,objBlock,0,1)) MotionChange(CATCH2,irandom(1),2); break;
						case 2: MotionChange(ATTACKUPPER,irandom(3),2); break;
						case 3: MotionChange(KICKPRESS  ,irandom(3),2); break;
						case 4: MotionChange(ATTACKPUNCH,irandom(3),2); break;
					}
				}else if( 400 > playerDistanceX ){
					switch(irandom(10)){
						case 0: MotionChange(ATTACKPUNCH,irandom(3),2); break;
						case 1: MotionChange(ATTACKUPPER,irandom(3),2); break;
						case 2: MotionChange(KICKCANON  ,irandom(3),2); break;
						case 3: MotionChange(KICKPRESS  ,irandom(3),2); break;
						case 4: if(y+100<objPlayerDoll.y && !collision_line( x,y,x-Direction*320,y,objBlock,0,1)) MotionChange(CATCH2,irandom(1),2); break;
					}
				}
			}
			break;
		case WALK :
			/* 相手の方を向く */
			if(objPlayerDoll.x > x) Direction = Right;
			else Direction = Left;

			switch(KeyFrmNum){
				case 0 : Move(-10*Direction,0);                                            break;
				case 1 : Move(-10*Direction,0);                                            break;
				case 2 : Move(-10*Direction,0);                                            break;
				case 3 : Move(-10*Direction,0); if(KEYFRAME) playEnemySound(SOUND_TAKEON); break;
				case 6 : Move(-10*Direction,0);                                            ;break;
				case 7 : Move(-10*Direction,0);                                            break;
				case 8 : Move(-10*Direction,0);                                            break;
				case 9 : Move(-10*Direction,0); if(KEYFRAME) playEnemySound(SOUND_TAKEON); break;
				default: Move(-5*Direction,0); break;
			}

			if( !air ){
				if( 70 > playerDistanceX ){
					switch(irandom(10)){
						case 0: 
						case 1: 
						case 2: if(!collision_line( x,y,x+Direction*320,y,objBlock,0,1)) MotionChange(BACKSTEP,2,1); break;
						case 3: MotionChange(ATTACKUPPER,2,2); break;
						case 4: MotionChange(KICKCANON  ,2,2); break;
						case 5: if(y+100<objPlayerDoll.y && !collision_line( x,y,x-Direction*400,y,objBlock,0,1)) MotionChange(CATCH2,irandom(1),2); break;
						case 6: MotionChange(KICKPRESS  ,2,2); break;
					}
				}else if( 120 > playerDistanceX ){
					switch(irandom(5)){
						case 0: if(!collision_line( x,y,x+Direction*320,y,objBlock,0,1)) MotionChange(BACKSTEP,irandom(3),2); break;
						case 1: if(!collision_line( x,y,x+Direction*320,y,objBlock,0,1)) MotionChange(BACKSTEP,irandom(3),2); break;
						case 2: MotionChange(ATTACKUPPER,irandom(3),2); break;
						case 3: if(y+100<objPlayerDoll.y && !collision_line( x,y,x-Direction*400,y,objBlock,0,1)) MotionChange(CATCH ,irandom(1),2); break;
						case 4: if(y+100<objPlayerDoll.y && !collision_line( x,y,x-Direction*400,y,objBlock,0,1)) MotionChange(CATCH2,irandom(1),2); break;
					}
				}else if( 250 > playerDistanceX ){
					switch(irandom(5)){
						case 0: MotionChange(ATTACKUPPER,irandom(3),2); break;
						case 1: MotionChange(KICKPRESS  ,irandom(3),2); break;
						case 2: if(y+100<objPlayerDoll.y && !collision_line( x,y,x-Direction*320,y,objBlock,0,1)) MotionChange(CATCH ,irandom(1),2); break;
					}
				}else if( 350 > playerDistanceX ){
					switch(irandom(10)){
						case 0: if(y+100<objPlayerDoll.y && !collision_line( x,y,x-Direction*400,y,objBlock,0,1)) MotionChange(CATCH ,irandom(1),2); break;
						case 1: if(y+100<objPlayerDoll.y && !collision_line( x,y,x-Direction*400,y,objBlock,0,1)) MotionChange(CATCH2,irandom(1),2); break;
						case 2: MotionChange(ATTACKUPPER,irandom(3),2); break;
						case 3: MotionChange(KICKPRESS  ,irandom(3),2); break;
						case 4: MotionChange(ATTACKPUNCH,irandom(3),2); break;
					}
				}else if( 400 > playerDistanceX ){
					switch(irandom(10)){
						case 0: MotionChange(ATTACKPUNCH,irandom(3),2); break;
						case 1: MotionChange(ATTACKUPPER,irandom(3),2); break;
						case 2: MotionChange(KICKCANON  ,irandom(3),2); break;
						case 3: MotionChange(KICKPRESS  ,irandom(3),2); break;
						case 4: if(y+100<objPlayerDoll.y && !collision_line( x,y,x-Direction*320,y,objBlock,0,1)) MotionChange(CATCH2,irandom(1),2); break;
					}
				}
			}

			/* 近づきすぎたり離れたりしたら止まる */
			if( 150>playerDistance ){ MotionChange(STAND,0,5); break; }
			break;
		case ATTACKPUNCH :
			switch(KeyFrmNum){
				case 3 : 
					HitFlag = false;
					break;
				case 4 : 
					if(KEYFRAME) sound_play(sndSwing00);
				case 5 : 
					Move(-20*Direction,0);
					if(!HitFlag){
/*
						Line = drawLine(Process[PARTS_HAND_ABOVE].x, Process[PARTS_HAND_ABOVE].y+48,preHandPosX,preHandPosY+48);
						Line.Color = c_red; Line.Width = 3; Line.depth = -1000000;
						with( collision_line( Process[PARTS_HAND_ABOVE].x, Process[PARTS_HAND_ABOVE].y+48,preHandPosX,preHandPosY+48 ,objPlayerDoll,0,1) ){
						drawRect(x-Direction*100,y+150,x-Direction*350, y+300, c_red);
*/
						with( collision_rectangle( x-Direction*100,y+150,x-Direction*350, y+300 ,objPlayerDoll,0,1) ){
							if(!INV && !BINDED){
								PartsDamage(objCommon_Head,     - 20,0);
								PartsBloodDamage(objCommon_Head,-100,0);
								HitStop(35,null);
								other.HitFlag = true;
								DamageVoiceRandom_High();
								Direction = -1*other.Direction;
								addDamage(30,DAMAGED_BOSSHITO_FLYING_NORMAL, 0, 1, DAMAGED_BOSSHITO_FLYING_NORMAL, 0, 1);
								hspeed = 50*other.Direction*-1;
								vspeed = -3;
								direction += random(5);
								sound_play(sndHit00);
								with(other){ playEnemySound(SOUND_SMASH); }
								Quake(15,15);
							}
						}
					}
					break;
			}
			if(MOTIONEND) MotionChange(STAND,0,5);
			break;
		case ATTACKUPPER :
			switch(KeyFrmNum){
				case 5 : Move(-50*Direction,0);
				case 6 : Move(-20*Direction,0);
				case 7 : Move(- 3*Direction,0);
			}

			switch(KeyFrmNum){
				case 5 : 
					HitFlag = false;
					break;
				case 6 : 
					if(KEYFRAME) sound_play(sndSwing00);
					if(!HitFlag){
/*
						Line = drawLine(Process[PARTS_HAND_ABOVE].x, Process[PARTS_HAND_ABOVE].y+32,preHandPosX,preHandPosY+32);
						Line.Color = c_red; Line.Width = 3; Line.depth = -1000000;
						with( collision_line( Process[PARTS_HAND_ABOVE].x, Process[PARTS_HAND_ABOVE].y+32,preHandPosX,preHandPosY+32 ,objPlayerDoll,0,1) ){
						drawRect(x-Direction*100,y-200,x-Direction*300,y+300, c_red);
						drawRect(x+Direction*100,y+100,x-Direction*200,y+300, c_red);
*/
						col = collision_rectangle( x-Direction*100,y-200,x-Direction*300,y+300 ,objPlayerDoll,0,1);
						if( !col ) col = collision_rectangle( x+Direction*100,y+100,x-Direction*200,y+300 ,objPlayerDoll,0,1);
						with( col ){
							if(!INV && !BINDED){
								PartsDamage(objCommon_Head,     - 20,0);
								PartsBloodDamage(objCommon_Head,-100,0);
								HitStop(50,null);
								other.HitFlag = true;
								DamageVoiceRandom_High();
								Direction = -1*other.Direction;
								addDamage(30,DAMAGED_BOSSHITO_FLYING_FAST, 0, 1, DAMAGED_BOSSHITO_FLYING_FAST, 0, 1);
								hspeed = 15*other.Direction*-1;
								vspeed = -30;
								direction += random(5);
								sound_play(sndHit00);
								with(other){ playEnemySound(SOUND_SMASH); }
								Quake(15,15);
							}
						}
					}
					break;
			}
			if(MOTIONEND) MotionChange(STAND,0,5);
			break;
		case KICKCANON :
			switch(KeyFrmNum){
				case 4 : Move(-25*Direction,0);
				case 5 : Move(- 5*Direction,0);
				case 6 : Move(- 1*Direction,0);
			}

			switch(KeyFrmNum){
				case 4 : 
					HitFlag = false;
					break;
				case 5 : 
					if(KEYFRAME) sound_play(sndSwing00);
				case 6 : 
					if(!HitFlag){
/*
						Line = drawLine(Process[PARTS_FOOT2_ABOVE].x, Process[PARTS_FOOT2_ABOVE].y-64,preFootPosX,preFootPosY-64);
						Line.Color = c_red; Line.Width = 3; Line.depth = -1000000;
						with( collision_line( Process[PARTS_FOOT2_ABOVE].x, Process[PARTS_FOOT2_ABOVE].y-64,preFootPosX,preFootPosY-64, objPlayerDoll,0,1) ){
						drawRect(x,y+150,x-Direction*400,y+350, c_red);
*/
						with( collision_rectangle( x,y+150,x-Direction*400,y+350 ,objPlayerDoll,0,1) ){
							if(!INV && !BINDED){
								PartsDamage(objCommon_Head,     - 20,0);
								PartsBloodDamage(objCommon_Head,-100,0);
								HitStop(55,null);
								other.HitFlag = true;
								DamageVoiceRandom_High();
								Direction = -1*other.Direction;
								addDamage(30,DAMAGED_BOSSHITO_FLYING_SLOW, 0, 1, DAMAGED_BOSSHITO_FLYING_SLOW, 0, 1);
								hspeed = 50*other.Direction*-1;
								vspeed = -10;
								direction += random(5);
								sound_play(sndHit00);
								with(other){ playEnemySound(SOUND_SMASH); }
								Quake(15,15);
							}
						}
					}
					break;
			}
			if(MOTIONEND) MotionChange(STAND,0,5);
			break;
		case KICKPRESS :
			switch(KeyFrmNum){
				case 2 : Move(-40*Direction,0);
				case 3 : Move(-10*Direction,0);
				case 4 : Move(- 3*Direction,0);
						break;
				case 6 : Move(-30*Direction,0);
				case 7 : Move(- 5*Direction,0);
				case 8 : Move(- 1*Direction,0);
						break;
			}

			switch(KeyFrmNum){
				case 4 : 
					HitFlag = false;
					break;
				case 5 : 
					if(KEYFRAME) sound_play(sndSwing00);
					if(!HitFlag){
/*
						Line = drawLine(Process[PARTS_FOOT2_ABOVE].x, Process[PARTS_FOOT2_ABOVE].y-48,preFootPosX,preFootPosY-48);
						Line.Color = c_red; Line.Width = 3; Line.depth = -1000000;
						with( collision_line( Process[PARTS_FOOT2_ABOVE].x, Process[PARTS_FOOT2_ABOVE].y-48,preFootPosX,preFootPosY-48, objPlayerDoll,0,1) ){
						drawRect(x-Direction*100,y-200,x-Direction*250,y+300, c_red);
						drawRect(x,y+100,x-Direction*200,y+300, c_red);
*/
						col = collision_rectangle( x-Direction*100,y-200,x-Direction*250,y+300 ,objPlayerDoll,0,1);
						if( !col ) col = collision_rectangle( x,y+100,x-Direction*200,y+300 ,objPlayerDoll,0,1);
						with( col ){
							if(!INV && !BINDED){
								PartsDamage(objCommon_Head,     - 20,0);
								PartsBloodDamage(objCommon_Head,-100,0);
								HitStop(55,null);
								other.HitFlag = true;
								DamageVoiceRandom_High();
								Direction = -1*other.Direction;
								addDamage(30,DAMAGED_BOSSHITO_FLYING_FAST, 0, 1, DAMAGED_BOSSHITO_FLYING_FAST, 0, 1);
								hspeed = 5*other.Direction*-1;
								vspeed = -50;
								direction += random(5);
								sound_play(sndHit00);
								with(other){ playEnemySound(SOUND_SMASH); }
								Quake(15,15);
							}
						}
					}
					break;
				case 8 : 
					if(KEYFRAME) sound_play(sndSwing00);
				case 9 : 
					if(!HitFlag){
/*
						Line = drawLine(Process[PARTS_FOOT2_ABOVE].x, Process[PARTS_FOOT2_ABOVE].y,preFootPosX,preFootPosY);
						Line.Color = c_red; Line.Width = 3; Line.depth = -1000000;
						with( collision_line( Process[PARTS_FOOT2_ABOVE].x, Process[PARTS_FOOT2_ABOVE].y,preFootPosX,preFootPosY, objPlayerDoll,0,1) ){
						drawRect(x-Direction*150,y-100,x-Direction*300,y+300, c_red);
*/
						with( collision_rectangle( x-Direction*150,y-100,x-Direction*300,y+300 ,objPlayerDoll,0,1) ){
							if(!INV && !BINDED){
								if(!INV && !BINDED){
									other.HitFlag = true;
									with(other){ playEnemySound(SOUND_SMASH); }
									if( Direction ) addDamage(50,DOWN_0, 0, 1, DEATHPRESS_DOWN_0, 0, 2);
									else		    addDamage(50,DOWN_1_FRONT, 2, 1, DEATHPRESS_DOWN_1, 2, 2);
									vspeed = 40;
									DamageVoiceRandom_High();
									if(isGameOver()) SpecialVoice(V_MUSE,0);
								}
							}
						}
					}
					break;
				case 10 : 
					if(KEYFRAME){
						Quake(15,15);
						playEnemySound(SOUND_TAKEON);
					}
					break;
			}
			if(MOTIONEND) MotionChange(STAND,0,5);
			break;
		case CATCH :
			switch(KeyFrmNum){
				case 4 : Move(-10*Direction,0); break;
				case 5 : Move(- 3*Direction,0); break;
			}

			switch(KeyFrmNum){
				case 2 : 
					HitFlag = false;
					break;
				case 3 : 
				case 4 : 
				case 5 : 
					if(!HitFlag){
/*
						Line = drawLine(Process[PARTS_HAND_ABOVE].x, Process[PARTS_HAND_ABOVE].y+48,preHandPosX,preHandPosY+48);
						Line.Color = c_red; Line.Width = 3; Line.depth = -1000000;
*/
						with( collision_line( Process[PARTS_HAND_ABOVE].x, Process[PARTS_HAND_ABOVE].y+48,preHandPosX,preHandPosY+48 ,objPlayerDoll,0,1) ){
							if(!INV && !BINDED){
								other.HitFlag = true;
								DamageVoiceRandom_Low();
								Direction = -1*other.Direction;
								addDamage(5,-1,-1,-1,-1,-1,-1);
								speed = 0;
								sound_play(sndHit00);
								Quake(15,5);
								with(other){
									startBind( objPlayerDoll,BIND_CATCH,0,objPlayerDoll.BINDED_BOSSHITO_CATCH_NIGIRI,0,1 );
									MotionChange(CATCH_NIGIRI,0,1);
								}
							}
						}
					}
					break;
			}
			if(MOTIONEND) MotionChange(STAND,0,5);
			break;
		case CATCH_NIGIRI :
			if(BindTarget){
				if(!BindTarget.BINDED && !isGameOver()){
						DamageVoiceRandom_Low();
						with(BindTarget){ MotionChange(STAND_0,0,2); }
						endBind();
						MotionChange(STAND,0,20);
						break;
				}
			}
			switch(KeyFrmNum){
				case 6:
				case 11:
					if(KEYFRAME){
						HitStop(1,15);
						with(objPlayerDoll){
							if(HEAD.image_alpha){
								FluidWithScale(HEAD.x+Direction,HEAD.y,c_white,15,0,5,0,360,0.3,0.1,HEAD.depth-1000);
							}
						}
					}
					break;
				case 5:
					if(KEYFRAME){
						Quake(10,10);
						if(isGameOver()) SpecialVoice(V_OE,irandom(5));
						else DamageVoiceRandom_Mid();
						sound_play(sndBone00);
						addDamage(10,-1,-1,-1,-1,-1,-1);
					}
					with(objPlayerDoll){
						if(HEAD.image_alpha){
							FluidWithScale(HEAD.x+Direction,HEAD.y,c_white,20,0,5,0,360,0.3,0.1,HEAD.depth-1000);
						}
					}
					break;
				case 10:
					if(KEYFRAME){
						Quake(10,10);
						if(isGameOver()) SpecialVoice(V_OE,irandom(5));
						else DamageVoiceRandom_High();
						sound_play(sndGishi00);
						sound_play(sndBone00);
						Flash(c_red,0.5,0.1);
						addDamage(20,-1,-1,-1,-1,-1,-1);
					}
					break;
				case 14:
					if(KEYFRAME){
						Quake(30,20);
						if(isGameOver()) SpecialVoice(V_OE,irandom(5));
						else CryingVoiceRandom_High();
						sound_play(sndGishi00);
						sound_play(sndBone00);
						Flash(c_red,0.8,0.01);
						sound_play(sndGusha);
						addDamage(50,-1,-1,-1,-1,-1,-1);
					}
					with(objPlayerDoll){
						if(HEAD.image_alpha){
							FluidWithScale(HEAD.x+Direction,HEAD.y,COLOR_BLOOD,20,0,2,0,360,0.3,0.5,HEAD.depth-1000);
						}
					}
					break;
				case 15:
					if(KEYFRAME) HitStop(1,15);
				case 16:
				case 17:
				case 18:
					with(objPlayerDoll){
						if(HEAD.image_alpha){
							FluidWithScale(HEAD.x+Direction,HEAD.y,c_white,3,0,1,0,180,0.1,0.5,HEAD.depth-1000);
							FluidWithScale(HEAD.x+Direction,HEAD.y,COLOR_BLOOD,3,0,1,0,180,0.1,0.5,HEAD.depth-1000);
						}
					}
					break;
				case 19:
					with(BindTarget){
						MotionChange(DAMAGED_BOSSHITO_FLYING_SLOW,0,2);
						speed = 40;
						direction = -90-other.Direction*45;
					}
					endBind();
					break;
			}
			if(MOTIONEND) MotionChange(STAND,0,5);
			break;
		case CATCH2 :
			switch(KeyFrmNum){
				case 2 : Move(-20*Direction,0);
				case 3 : Move(-10*Direction,0);
				case 4 : Move(- 3*Direction,0);
			}

			switch(KeyFrmNum){
				case 2 : 
					HitFlag = false;
					break;
				case 3 : 
				case 4 : 
				case 5 : 
					if(!HitFlag){
/*
						Line = drawLine(Process[PARTS_HAND_ABOVE].x, Process[PARTS_HAND_ABOVE].y+48,preHandPosX,preHandPosY+48);
						Line.Color = c_red; Line.Width = 3; Line.depth = -1000000;
*/
						with( collision_line( Process[PARTS_HAND_ABOVE].x, Process[PARTS_HAND_ABOVE].y+48,preHandPosX,preHandPosY+48 ,objPlayerDoll,0,1) ){
							if(!INV && !BINDED){
								other.HitFlag = true;
								DamageVoiceRandom_Low();
								Direction = -1*other.Direction;
								addDamage(5,-1,-1,-1,-1,-1,-1);
								speed = 0;
								sound_play(sndHit00);
								Quake(15,5);
								with(other){
									switch(irandom(2)){
										case 0:
											if(objPlayerDoll.HEAD.image_alpha != 0){
												startBind( objPlayerDoll,BIND_CATCH,0,objPlayerDoll.BINDED_BOSSHITO_CATCH2_EAT,0,1 );
												MotionChange(CATCH2_EAT,0,1);
											}else if(objPlayerDoll.FOOT2_ABOVE.image_alpha != 0){
												startBind( objPlayerDoll,BIND_CATCH,0,objPlayerDoll.BINDED_BOSSHITO_CATCH2_TIGIRI,0,1 );
												MotionChange(CATCH2_TIGIRI,0,1);
											}
											break;
										case 1:
											if(objPlayerDoll.HEAD.image_alpha != 0){
												startBind( objPlayerDoll,BIND_CATCH,0,objPlayerDoll.BINDED_BOSSHITO_CATCH2_KUBIORI,0,1 );
												MotionChange(CATCH2_KUBIORI,0,1);
											}else if(objPlayerDoll.FOOT2_ABOVE.image_alpha != 0){
												startBind( objPlayerDoll,BIND_CATCH,0,objPlayerDoll.BINDED_BOSSHITO_CATCH2_TIGIRI,0,1 );
												MotionChange(CATCH2_TIGIRI,0,1);
											}
											break;
										case 2:
											if(objPlayerDoll.FOOT2_ABOVE.image_alpha != 0){
												startBind( objPlayerDoll,BIND_CATCH,0,objPlayerDoll.BINDED_BOSSHITO_CATCH2_TIGIRI,0,1 );
												MotionChange(CATCH2_TIGIRI,0,1);
											}else if(objPlayerDoll.HEAD.image_alpha != 0){
												startBind( objPlayerDoll,BIND_CATCH,0,objPlayerDoll.BINDED_BOSSHITO_CATCH2_KUBIORI,0,1 );
												MotionChange(CATCH2_KUBIORI,0,1);
											}
											break;
									}
								}
							}
						}
					}
					break;
			}
			if(MOTIONEND) MotionChange(STAND,0,5);
			break;
		case CATCH2_KUBIORI :
			if(BindTarget){
				if(!BindTarget.BINDED && !isGameOver()){
						DamageVoiceRandom_Low();
						with(BindTarget){ MotionChange(STAND_0,0,2); }
						endBind();
						MotionChange(STAND,0,20);
						break;
				}
			}
			switch(KeyFrmNum){
				case 4:
					if(KEYFRAME){
						HitStop(1,15);
						with(objPlayerDoll){
							if(HEAD.image_alpha){
								FluidWithScale(HEAD.x+Direction,HEAD.y,c_white,15,0,5,0,360,0.3,0.1,HEAD.depth-1);
							}
						}

						Quake(30,20);
						SpecialVoice(V_OE,irandom(5));
						sound_play(sndGishi00);
						sound_play(sndBone00);
						Flash(c_red,0.8,0.01);
						addDamage(150,-1,-1,-1,-1,-1,-1);
					}
					with(objPlayerDoll){
						if(HEAD.image_alpha){
							FluidWithScale(HEAD.x+Direction,HEAD.y,COLOR_BLOOD,20,0,2,0,360,0.3,0.5,HEAD.depth-1);
						}
					}
					break;
				case 11:
				case 12:
					with(BindTarget){
						if(random(100) < 2) MotionChange(MotionNum,10,1);
					}
				case  5:
				case  6:
				case  7:
				case  8:
				case  9:
					with(objPlayerDoll){
						if(HEAD.image_alpha){
							if(random(100) < 100+global.PlayerHP) FluidWithScale(10*Direction + HEAD.x+Direction,HEAD.y+8,c_white,1,0,0,0,360,0.3,0.3,HEAD.depth-1000);
							if(random(100) < 100+global.PlayerHP) FluidWithScale(10*Direction + HEAD.x+Direction,HEAD.y+8,COLOR_BLOOD,1,0,0,0,360,0.3,0.3,HEAD.depth-1000);
						}
					}
					break;
			}
			if(MOTIONEND){
				MotionChange(MotionNum,10,30);
				with(BindTarget) { MotionChange(MotionNum,10,30); }
				
			}
			break;
		case CATCH2_EAT :
			if(BindTarget){
				if(!BindTarget.BINDED && !isGameOver()){
						DamageVoiceRandom_Low();
						with(BindTarget){ MotionChange(STAND_0,0,2); }
						endBind();
						MotionChange(STAND,0,20);
						break;
				}
			}
			switch(KeyFrmNum){
				case 3:
					with(objDisplay){
						CamTempTGT_X = other.x;
						CamTempTGT_Y = other.y-200;
						alarm[2]=45;
					}
					break;
				case 8:
					if(KEYFRAME) VoreVoiceRandom_High();
					break;
				case 12:
					if(KEYFRAME){
						StopAllVoice();
						playEnemySound(SOUND_NIKU);
						sound_play(sndGishi00);
						sound_play(sndBone00);
						Flash(c_red,1.3,0.05);
						addDamage(200,-1,-1,-1,-1,-1,-1); 
						Fluid(BindTarget.x,BindTarget.y,COLOR_BLOOD,50,2,10,0,180,0.5);
						Flash(c_red,1,0.05);
						Quake(30,30);
						with(BindTarget){
							HEAD.image_alpha = 0;
							with(objCommon_Head){ image_alpha = 0; }
							with(objCommon_Body){ if(random(100)<50) FluidBreak = true; }
						}
					}
					break;
				case 13:
					with(BindTarget){
						MotionChange(DAMAGED_BOSSHITO_FLYING_SLOW,0,2);
						speed = 14;
						direction = 90+other.Direction*45;
					}
					objPlayerDoll.x = Process[PARTS_HAND_ABOVE].x;
					objPlayerDoll.y = Process[PARTS_HAND_ABOVE].y;
					endBind();
					break;
			}
			if(MOTIONEND){
				MotionChange(STAND,0,5);
			}
			break;
		case CATCH2_TIGIRI :
			if(BindTarget){
				if(!BindTarget.BINDED && !isGameOver()){
						DamageVoiceRandom_Low();
						with(BindTarget){ MotionChange(STAND_0,0,2); }
						endBind();
						MotionChange(STAND,0,20);
						break;
				}
			}
			switch(KeyFrmNum){
				case 3:
					if(KEYFRAME){
						CryingVoiceRandom_High();
						sound_play(sndBone00);
					}
					break;
				case 5:
					if(KEYFRAME){
						playEnemySound(SOUND_NIKU);
						sound_play(sndGishi00);

						Flash(c_red,1.3,0.05);
						addDamage(200,-1,-1,-1,-1,-1,-1); 
						Fluid(BindTarget.x,BindTarget.y,COLOR_BLOOD,50,2,10,0,180,0.5);
						Flash(c_red,1,0.05);
						Quake(30,30);
						Macro_CutFoot2_Above();
					}
					break;
				case 8:
					with(BindTarget){
						MotionChange(DAMAGED_BOSSHITO_FLYING_SLOW,1,2);
						speed = 10;
						direction = 270-other.Direction*80;
					}
					objPlayerDoll.x = Process[PARTS_HAND_BELOW].x;
					objPlayerDoll.y = Process[PARTS_HAND_BELOW].y;
					endBind();
					break;
			}
			if(MOTIONEND){
				MotionChange(STAND,0,5);
			}
			break;

		case BACKSTEP :
			switch(KeyFrmNum){
				case 3 : Move(50*Direction,0);
				case 4 : Move(35*Direction,0);
				case 5 : Move( 5*Direction,0); break;
				case 6 : 
					if(KEYFRAME){
						switch(irandom(12)){
							case 0: MotionChange(ATTACKPUNCH,3,2); break;
							case 1: MotionChange(ATTACKUPPER,3,2); break;
							case 2: MotionChange(KICKCANON  ,3,2); break;
							case 3: MotionChange(KICKPRESS  ,3,2); break;
							case 4: if(y+100<objPlayerDoll.y && !collision_line( x,y,x-Direction*400,y,objBlock,0,1)) MotionChange(CATCH ,1,2); break;
							case 5: if(y+100<objPlayerDoll.y && !collision_line( x,y,x-Direction*320,y,objBlock,0,1)) MotionChange(CATCH2,1,2); break;
						}
					}
			}
			if(MOTIONEND){
				MotionChange(STAND,0,5);
			}
			break

		case DEAD_MOTION :
			if(DeathFlag){
				for(i=0;i<PARTS_MAX;i+=1){
					with(Draw[i]){
						image_blend = make_color_rgb(other.Color,other.Color,other.Color);
						if(other.Color<0){
							image_blend = c_black;
							if(random(100)<50) effect_create_above(ef_smokeup, x -32+64*random(1),y -32+64*random(1), 1,c_black);
						}else other.Color-=0.5;
					}
				}
				DeathTime += 1;
				if(DeathTime == 190){
					new = instance_create(x,y,objChangeRoom);
					new.nextRoom = Stage5_Boss_Battle2;
				}
			}
			if(KeyFrmNum==1 && KEYFRAME){
				sound_play(sndHit02);
				Fluid(x,y,make_color_rgb(163,73,164),35,5,20,0,180,0.5);
				Quake(5,5);
			}
			if(MOTIONEND){
				DeathFlag = 1;
				MotionChange(DEAD_MOTION,6,10);
			}
			break;
	}
}

preHandPosX	= Process[PARTS_HAND_ABOVE].x;
preHandPosY	= Process[PARTS_HAND_ABOVE].y;
preFootPosX	= Process[PARTS_FOOT2_ABOVE].x;
preFootPosY	= Process[PARTS_FOOT2_ABOVE].y;