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

with(objEnemyEdit){ if(Edit_Play) exit; }
/*-----キャラクタとの情報の取得---------------*/
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_HEAD]].x;
HeadPosY = Process[ProcessNum[PARTS_HEAD]].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);
		}
	}
	INV = 1;
	depth = -100000;
	x = other.HeadPosX;
	y = other.HeadPosY;
	if(place_meeting(other.HeadPosX,other.HeadPosY,objBlock)){
		x = xprevious;
		y = yprevious;
	}

	if(HP<-2500){
		with(other){
			HP = -1;
			with(objHuta    ){ instance_destroy(); }
			with(objHutaLine){ instance_destroy(); }
			if(!ChangeMotion){
				if(MotionNum!=DEAD_MOTION){
					Quake(35,35);
					MotionChange(DEAD_MOTION,0,1);
				}
			}
		}
	}
}

INV = 1;
switch(MotionNum){
	case OUT :
	case BITE_HORIZON :
	case BITE_VERTICAL :
	case BITE_VERTICAL2 :
	case INTO :
	case INTOMOVE :
		GSet(0,0,0,0,0,0,0,0);
		break;
	case CATCH_HORIZON : 
		with(objController){
			with(CtrlTarget){
				if( other.BindCounter>20+0.1*(100-global.PlayerHP) ){
					other.BindCounter = 0;
					move_outside_afterBind();
					BINDED = 0;
				}
			}
		}
		DepthSet(objPlayerDoll.depth - 1000);
		with(objPlayerDoll){
			FOOT1_ABOVE.depth = objPlayerDoll.depth - 1515;
			FOOT2_ABOVE.depth = objPlayerDoll.depth - 1514;
			FOOT3_ABOVE.depth = objPlayerDoll.depth - 1513;
			HAND1_ABOVE.depth = objPlayerDoll.depth - 2015;
			HAND2_ABOVE.depth = objPlayerDoll.depth - 2014;
			HAND3_ABOVE.depth = objPlayerDoll.depth - 2013;
		}
		break;
	case CATCH_VERTICAL : 
	case CATCH_VERTICAL2 : 
		GSet(0,0,0,0,0,0,0,0);
		with(objController){
			with(CtrlTarget){
				if( other.BindCounter>20+0.1*(100-global.PlayerHP) ){
					other.BindCounter = 0;
					move_outside_afterBind();
					BINDED = 0;
				}
			}
		}
		DepthSet(objPlayerDoll.depth - 1000);
		break;
}

if(!ChangeMotion){
	switch(MotionNum){
		case STAND :
			if(playerDistance < 650){
				with(objHutaLine){ event_user(0); }
				with(objShutter_Akesime){ flag = 1; }
				MotionChange(WALK,0,2);
			}
			break;
		case WALK : 
			with(HeadCollision){INV = 0;}
			if(Move(-15.0*Direction,0)){
				if(random(100)<50){ MotionChange(INTO,0,1); y = Process[ProcessNum[PARTS_HEAD]].y };
				else			    MotionChange(TURN,0,2);
			}else{
				if(((!Direction && x<objPlayerDoll.x) || (Direction && x>objPlayerDoll.x)) && random(100)<10){
					MotionChange(TACKLE,0,3);
				}
			}
			break;
		case BITE_HORIZON :
			move_contact_solid(90-90*Direction,96);
			if(1<KeyFrmNum && KeyFrmNum<14){ with(HeadCollision){ INV = 0; } }
			switch(KeyFrmNum){
				case 1 : hitchk = 0; break;
				case 4 :
					if(KEYFRAME){
						Quake(15,15);
						playEnemySound(SOUND_TOBIDASU);
						repeat(15){	/* --------------------------------- */
							new = instance_create(x-32+64*random(1),y-32+64*random(1),objWallHahen);
							new.speed = random(10);
							new.direction = 90 + random(180*Direction);
							new.depth = depth - 10000;
						}			/* --------------------------------- */
					}
				case 5 :
				case 6 :
					if(!hitchk){
						col = collision_line( HeadPosX,HeadPosY,preHeadPosX,preHeadPosY,objPlayerDoll,0,1);
						with( col ){
							if(!INV && !BINDED){
								other.hitchk = 1;
								DamageVoiceRandom_Mid();
								if(global.PlayerHP != global.PlayerHPMAX){
									Direction = other.Direction*-1;
									addDamage(10,-1, -1, -1, -1, -1, -1);
									with(other){
										startBind( col,BIND_CATCH_HORIZON,0,other.BINDED_BOSSWORM_CATCH_HORIZON,0,1 );
										MotionChange(CATCH_HORIZON,0,1);
									}
								}else{
									if(Direction!=other.Direction)	addDamage(30,FLYING_0, 0, 1, FLYING_0, 0, 2);
									else							addDamage(30,FLYING_1, 0, 1, FLYING_1, 0, 2);
									hspeed = 60*other.Direction*-1;
									vspeed = -6;
								}
								sound_play(sndHit00);
								Quake(15,15);
							}
						}
					}
					break;
			}
			if(MOTIONEND){
				BiteCount += 1;
				hitchk = 0;
				y = objPlayerDoll.y-8+random(1)*16;
				if(BiteCount>3 || playerDistance>320) MotionChange(INTOMOVE,0,2);
				else								  MotionChange(BITE_HORIZON,2,2);
			}
			break;
		case CATCH_HORIZON :
			if(BindTarget){
				if(!BindTarget.BINDED && !isGameOver()){
						BiteCount = 5;
						DamageVoiceRandom_Low();
						with(BindTarget){ MotionChange(DOWN_0,0,2); }
						endBind();
						MotionChange(BITE_HORIZON,11,3);
						break;
				}
			}

			with(BindTarget){
				switch(KeyFrmNum){
					case  2 : if(KEYFRAME) DamageVoiceRandom_Mid(); break;
					case 33 : if(KEYFRAME) DamageVoiceRandom_Low(); break;
					case 37 : if(KEYFRAME){ dropWeapon(); global.GameOver = true; DamageVoiceRandom_High();sound_play(sndBone00); } break;
					case 39 :
						if(KEYFRAME){
							addDamage(20,-1,-1,-1,-1,-1,-1);
							sound_play(sndBone00);
							with(other){playEnemySound(SOUND_BITE);}
							with(other){playEnemySound(SOUND_CLASH);}
							SpecialVoice(V_MUSE,1);
							Flash(COLOR_BLOOD,1.0,0.1);
							Quake(15,15);
							Fluid(other.x+other.Direction*32,other.y,COLOR_BLOOD,55,5,20,90,other.Direction*180,0.5);
							DamageVoiceRandom_High();
							Direction = Direction*-1;
						}
						break;
					case 41 : if(KEYFRAME) DamageVoiceRandom_Low(); break;
					case 49 : 
						if(KEYFRAME){
							addDamage(60,-1,-1,-1,-1,-1,-1);
							sound_play(sndGusha);
							with(other){playEnemySound(SOUND_CLASH);}
							Flash(COLOR_BLOOD,1.0,0.001);
							Quake(15,15);
							Fluid(other.x+other.Direction*32,other.y,COLOR_BLOOD,65,5,20,90,other.Direction*180,0.5);
							StopVoice(V_MUSE,1);
							CryingVoiceRandom_High();
						}
						if(random(100)<2){
							addDamage(10,-1,-1,-1,-1,-1,-1);
							if(global.PlayerHP>-100) SpecialVoice(V_OE,irandom(5));
							if( random(100)<50 ) with(other){playEnemySound(SOUND_BITE);}
							if( random(100)<50 ) with(other){playEnemySound(SOUND_CLASH);}
							if( random(100)<50 ) sound_play(sndGusha);
							if( random(100)<50 ) sound_play(sndBone00);
							Flash(COLOR_BLOOD,1.0,0.01);
							Quake(15,15);
							Fluid(other.x+other.Direction*32,other.y,COLOR_BLOOD,45,5,20,90,other.Direction*180,0.5);
						}
						break;
				}
				if(MOTIONEND) MotionChange(MotionNum,49,1);
			}
			if(MOTIONEND){
				MotionChange(CATCH_HORIZON,19,1);
			}
			break;
		case BITE_VERTICAL :
			move_contact_solid(270,96);
			if(1<KeyFrmNum && KeyFrmNum<14){ with(HeadCollision){ INV = 0; } }
			switch(KeyFrmNum){
				case 1 : hitchk = 0; break;
				case 4 :
					if(KEYFRAME){
						Quake(15,15);
						playEnemySound(SOUND_TOBIDASU);
						repeat(15){	/* --------------------------------- */
							new = instance_create(x-32+64*random(1),y-32+64*random(1),objWallHahen);
							new.speed = random(10);
							new.direction = random(180);
							new.depth = depth - 10000;
						}			/* --------------------------------- */
					}
				case 5 :
				case 6 :
				case 7 :
					if(!hitchk){
						col = collision_line( HeadPosX,HeadPosY,preHeadPosX,preHeadPosY,objPlayerDoll,0,1);
						with( col ){
							if(!INV && !BINDED){
								other.hitchk = 1;
								DamageVoiceRandom_Mid();
								if(global.PlayerHP != global.PlayerHPMAX){
									Direction = other.Direction;
									addDamage(10,-1, -1, -1, -1, -1, -1);
									with(other){
										startBind( col,BIND_CATCH_VERTICAL,0,other.BINDED_BOSSWORM_CATCH_VERTICAL,0,1 );
										MotionChange(CATCH_VERTICAL,0,1);
									}
								}else{
									if(Direction!=other.Direction)	addDamage(30,FLYING_0, 0, 1, FLYING_0, 0, 2);
									else							addDamage(30,FLYING_1, 0, 1, FLYING_1, 0, 2);
									hspeed = 5*other.Direction*-1;
									vspeed = -20;
								}
								sound_play(sndHit00);
								Quake(15,15);
							}
						}
					}
					break;
			}
			if(MOTIONEND){
				x = objPlayerDoll.x-16+random(1)*32;
				BiteCount += 1;
				hitchk = 0;
				if(BiteCount>5) MotionChange(INTOMOVE,0,2);
				else			MotionChange(BITE_VERTICAL,2+irandom(1),1+irandom(2));
			}
			break;
		case CATCH_VERTICAL :
			if(BindTarget){
				if(!BindTarget.BINDED && !isGameOver()){
						BiteCount = 5;
						DamageVoiceRandom_Low();
						with(BindTarget){ MotionChange(DOWN_0,0,2); }
						endBind();
						MotionChange(BITE_VERTICAL,11,10);
						break;
				}
			}
			switch(KeyFrmNum){
				case 1 : 
					if(KEYFRAME) Fluid(HeadPosX,HeadPosY,COLOR_BLOOD,25,5,20,70,40,0.5);
					break;
				case 19:
					if(KEYFRAME) playEnemySound(SOUND_CLASH);
				case 14:
					if(KEYFRAME){
						addDamage(5,-1,-1,-1,-1,-1,-1);
						SpecialVoice(V_OE,irandom(5));
						Quake(15,15);
						playEnemySound(SOUND_BITE);
						Fluid(HeadPosX,HeadPosY,COLOR_BLOOD,35,5,20,80,20,0.5);
					}
					break;
				case 22:
					if(KEYFRAME){
						SpecialVoice(V_OE,irandom(5));
						addDamage(60,-1,-1,-1,-1,-1,-1);
						Flash(COLOR_BLOOD,1.0,0.001);
						Quake(15,15);
						sound_play(sndGusha);
					}
				case 23:
					FluidWithScale(HeadPosX,HeadPosY,COLOR_BLOOD,15,5,20,85,10,0.7,0.5,depth+1000);
					break;
				case 24:
					if(KEYFRAME) playEnemySound(SOUND_DRAIN);
					break;
				case 7 : 
					if(KEYFRAME){
						addDamage(5,-1,-1,-1,-1,-1,-1);
						DamageVoiceRandom_Mid();
						sound_play(sndHit00);
						Quake(15,15);
						Fluid(HeadPosX,HeadPosY,COLOR_BLOOD,25,5,0,180,40,0.5);
					}
					break;
				case 9 : 
					if(global.PlayerHP > global.PlayerHPMAX*0.25){
						Direction = -1+2*irandom(1);
						BindTarget.Direction = Direction;
						startBind( BindTarget,BIND_CATCH_VERTICAL,0,BindTarget.BINDED_BOSSWORM_CATCH_VERTICAL,4,3 );
						MotionChange(CATCH_VERTICAL,4,3);
					}
					break;
				case 22 : 
					global.GameOver = true;
					break;
			}
			if(MOTIONEND){
				startBind( BindTarget,BIND_CATCH_VERTICAL,0,BindTarget.BINDED_BOSSWORM_CATCH_VERTICAL,24,1 );
				MotionChange(CATCH_VERTICAL,24,1);
			}
			break;
		case BITE_VERTICAL2 :
			move_contact_solid(90,96);
			if(1<KeyFrmNum && KeyFrmNum<14){ with(HeadCollision){ INV = 0; } }

			switch(KeyFrmNum){
				case 1 : hitchk = 0; break;
				case 4 :
					if(KEYFRAME){
						Quake(15,15);
						playEnemySound(SOUND_TOBIDASU);
						repeat(15){	/* --------------------------------- */
							new = instance_create(x-32+64*random(1),y-32+64*random(1),objWallHahen);
							new.speed = random(10);
							new.direction = random(-180);
							new.depth = depth - 10000;
						}			/* --------------------------------- */
					}
				case 5 :
				case 6 :
				case 7 :
					if(!hitchk){
						col = collision_line( HeadPosX,HeadPosY,preHeadPosX,preHeadPosY,objPlayerDoll,0,1);
						with( col ){
							if(!INV && !BINDED){
								other.hitchk = 1;
								DamageVoiceRandom_Mid();
								if(global.PlayerHP != global.PlayerHPMAX){
									Direction = other.Direction;
									addDamage(10,-1, -1, -1, -1, -1, -1);
									with(other){
										startBind( col,BIND_CATCH_VERTICAL2,0,other.BINDED_BOSSWORM_CATCH_VERTICAL2,0,1 );
										MotionChange(CATCH_VERTICAL2,0,1);
									}
								}else{
									if(Direction!=other.Direction)	addDamage(30,FLYING_0, 0, 1, FLYING_0, 0, 2);
									else							addDamage(30,FLYING_1, 0, 1, FLYING_1, 0, 2);
									hspeed = 5*other.Direction*-1;
									vspeed = 20;
								}
								sound_play(sndHit00);
								Quake(15,15);
							}
						}
					}
					break;
			}
			if(MOTIONEND){
				x = objPlayerDoll.x-16+random(1)*32;
				BiteCount += 1;
				hitchk = 0;
				if(BiteCount>5) MotionChange(INTOMOVE,0,2);
				else			MotionChange(BITE_VERTICAL2,2+irandom(1),1+irandom(2));
			}
			break;
		case CATCH_VERTICAL2 :
			if(BindTarget){
				if(!BindTarget.BINDED && !isGameOver()){
						BiteCount = 5;
						DamageVoiceRandom_Low();
						with(BindTarget){ MotionChange(DOWN_0,0,2); }
						endBind();
						MotionChange(BITE_VERTICAL2,11,3);
						break;
				}
			}

			with(BindTarget){
				switch(KeyFrmNum){
					case  4 :
					case 11 :
						if(KEYFRAME){
							addDamage(8,-1,-1,-1,-1,-1,-1);
							sound_play(sndHit00);
							Quake(15,15);
							DamageVoiceRandom_Mid();
						}
						break;
					case 15 :
					case 20 :
						if(KEYFRAME){
							addDamage(10,-1,-1,-1,-1,-1,-1);
							sound_play(sndHit00);
							Quake(15,15);
							DamageVoiceRandom_Mid();
						}
						break;
					case 23 :
					case 26 :
					case 27 :
					case 31 :
						if(KEYFRAME){
							addDamage(15,-1,-1,-1,-1,-1,-1);
							Quake(15,15);
							Fluid(other.x,other.y-32,COLOR_BLOOD,20,0,20,180,180,0.5);
							Flash(COLOR_BLOOD,1.0,0.1);
							if(random(100)<50) SpecialVoice(V_OE,irandom(5));
							sound_play(sndBone00);
						}
						break;

					case  7 :
						if(random(100)<5){
							MotionChange(MotionNum,8,2);
							with(other){MotionChange(MotionNum,8,2);}
						}else{
							MotionChange(MotionNum,6,1);
							with(other){MotionChange(MotionNum,6,1);}
						}
						break;
					case 12 :
						if(KEYFRAME){
							if(global.PlayerHP>30){
								MotionChange(MotionNum,6,3);
								with(other){MotionChange(MotionNum,6,3);}
							}else global.GameOver = true;
						}
						break;
					case 40 :
						with(other){ FluidWithScale(x,y-32,COLOR_BLOOD,2,0,5,260,20,0.7,0.5,depth+1000); }
						if(KEYFRAME){
								Fluid(other.x,other.y-32,COLOR_BLOOD,40,0,5,180,180,0.5);
								Flash(COLOR_BLOOD,1.0,0.001);
								Quake(15,35);
								sound_play(sndGusha);
								Macro_CutHead();
						}
						break;
					case 41 :
						if(KEYFRAME){
								Fluid(other.x,other.y-32,COLOR_BLOOD,30,0,20,260,20,0.5);
								with(other){
									with(BindTarget){ MotionChange(DOWN_1,0,10); }
									endBind();
									MotionChange(BITE_VERTICAL2,24,1);
								}
								move_contact_solid(90,96);
						}
				}
			}
			if(MOTIONEND){
				MotionChange(CATCH_VERTICAL2,24,1);
			}
			break;

		case OUT :
			switch(KeyFrmNum){
				default : 
					move_contact_solid(90-90*Direction,96);
					break;
				case 4 :
					move_contact_solid(90-90*Direction,96);
					if(KEYFRAME){
						Quake(15,15);
						playEnemySound(SOUND_TOBIDASU);
						repeat(15){	/* --------------------------------- */
							new = instance_create(x-32+64*random(1),y-32+64*random(1),objWallHahen);
							new.speed = random(10);
							new.direction = random(-180);
							new.depth = depth - 10000;
						}			/* --------------------------------- */
					}
					break;
				case 5 :
				case 6 :
					repeat(15){	/* --------------------------------- */
						new = instance_create(x-32+64*random(1),y-32+64*random(1),objWallHahen);
						new.speed = random(10);
						new.direction = random(-180);
						new.depth = depth - 10000;
					}			/* --------------------------------- */
					break;
				case 7 :
				case 8 :
					Move(-10*Direction,0);
					break;
			}
			if(MOTIONEND){
				MotionChange(WALK,0,1);
			}
			break;
		case INTO :
			BiteCount = 0;
			if(KeyFrmNum<12){
				move_contact_solid(90+90*Direction,96);

				Quake(5,5);
				if(Step mod 2 == 0) playEnemySound(SOUND_HORU);
				repeat(5){	/* --------------------------------- */
					new = instance_create(x-32+64*random(1),y-32+64*random(1),objWallHahen);
					new.speed = random(10);
					new.direction = 90 - random(180*Direction);
					new.depth = depth - 10000;
				}			/* --------------------------------- */
			}
			if(KeyFrmNum==12 && KEYFRAME) Direction *= -1;
			if(MOTIONEND){
				MoveMode = -1 + 2*irandom(1)
				MotionChange(INTOMOVE,0,1);
			}
			break;
		case INTOMOVE :
			if( BiteCount>5 ){
				if(place_meeting(x+32,y,objBlock) || place_meeting(x-32,y,objBlock)){
					/* ---横接地--- */
					if(place_meeting(x+32,y,objBlock)) Direction = 1;
					if(place_meeting(x-32,y,objBlock)) Direction =-1;
					move_contact_solid(90-90*Direction,96);
					/* ---穴から出る--- */
					if(place_meeting(x,y+32,objBlock)) MotionChange(WALK,0,1);
					else{
					/* ---床に向かう--- */
						Move(0,15);
						Quake(5,5);
						if(Step mod 2 == 0) playEnemySound(SOUND_HORU);
						repeat(5){	/* --------------------------------- */
							new = instance_create(x-32+64*random(1),y-32+64*random(1),objWallHahen);
							new.speed = random(10);
							new.direction = random(180*Direction);
							new.depth = depth - 10000;
						}			/* --------------------------------- */
					}
				}else{
					/* ---縦接地--- */
					move_contact_solid(180+90*MoveMode,96);
					/* ---壁に向かう--- */
					if(objPlayerDoll.x > x) Move(-15,0);
					else					Move( 15,0);

					Quake(5,5);
					if(Step mod 2 == 0) playEnemySound(SOUND_HORU);
					repeat(5){	/* --------------------------------- */
						new = instance_create(x-32+64*random(1),y-32+64*random(1),objWallHahen);
						new.speed = random(10);
						new.direction = random(180*Direction);
						new.depth = depth - 10000;
					}			/* --------------------------------- */
				}
			}else{
				if(place_meeting(x,y+1,objBlock) || place_meeting(x,y-1,objBlock)){
					/* ---縦接地--- */
					move_contact_solid(180+90*MoveMode,96);
					/* ---キャラに向かう--- */
					if( abs(x - objPlayerDoll.x)<32 ){
						x = objPlayerDoll.x-8+random(1)*16;
						if(MoveMode) MotionChange(BITE_VERTICAL ,0,1);
						else		 MotionChange(BITE_VERTICAL2,0,1);
					}else{
						if(objPlayerDoll.x > x) Move( 15,0);
						else					Move(-15,0);

						Quake(5,5);
						if(Step mod 2 == 0) playEnemySound(SOUND_HORU);
						repeat(5){	/* --------------------------------- */
							new = instance_create(x-32+64*random(1),y-32+64*random(1),objWallHahen);
							new.speed = random(10);
							new.direction = random(180*Direction);
							new.depth = depth - 10000;
						}			/* --------------------------------- */
					}
				}else{
					/* ---横接地--- */
					if(place_meeting(x+32,y,objBlock)) Direction = 1;
					if(place_meeting(x-32,y,objBlock)) Direction =-1;
					move_contact_solid(90-90*Direction,96);
					/* ---高さを合わせる--- */
					if( playerDistance<290 ){
						y = objPlayerDoll.y-8+random(1)*16;
						MotionChange(BITE_HORIZON,0,1);
					}else{
						Move(0,15*MoveMode);

						Quake(5,5);
						if(Step mod 2 == 0) playEnemySound(SOUND_HORU);
						repeat(5){	/* --------------------------------- */
							new = instance_create(x-32+64*random(1),y-32+64*random(1),objWallHahen);
							new.speed = random(3);
							new.direction = 90 + random(180*Direction);
							new.depth = depth - 10000;
						}			/* --------------------------------- */
					}
				}
			}
			break;
		case TACKLE :
			with(HeadCollision){INV = 0;}
			switch(KeyFrmNum){
				case 1 : hitchk = 0; break;
				case 4 :
					if(Move(-20.0*Direction,0)){ MotionChange(TACKLE,8,1); playEnemySound(SOUND_TOBIDASU); Quake(15,15)}
				case 5 :
					if(Move(-20.0*Direction,0)){ MotionChange(TACKLE,8,1); playEnemySound(SOUND_TOBIDASU); Quake(15,15)}
				case 6 :
					if(Move(-20.0*Direction,0)){ MotionChange(TACKLE,8,1); playEnemySound(SOUND_TOBIDASU); Quake(15,15)}
				case 7 :
					if(Move(-60.0*Direction,0)){ MotionChange(TACKLE,8,1); playEnemySound(SOUND_TOBIDASU); Quake(15,15)}
					if(!hitchk){
						with( collision_line( HeadCollision.x-Direction*96,HeadCollision.y,HeadCollision.xprevious,HeadCollision.yprevious,objPlayerDoll,0,1) ){
							if(!INV && !BINDED){
								other.hitchk = 1;
								DamageVoiceRandom_Mid();
								if(Direction!=other.Direction)	addDamage(30,FLYING_0, 0, 1, FLYING_0, 0, 2);
								else							addDamage(30,FLYING_1, 0, 1, FLYING_1, 0, 2);
								hspeed = 60*other.Direction*-1;
								vspeed = -6;
								sound_play(sndHit00);
								Quake(15,15);
							}
						}
					}
					break;
				case 8 :
				case 9 :
				case 10 :
				case 11 :
					gravity = 0;
					speed   = 0;
					break;
			}
			if(MOTIONEND){
				MotionChange(WALK,1,1);
			}
			break;
		case TURN :
			with(HeadCollision){INV = 0;}
			switch(KeyFrmNum){
				case 12 :
					if(KEYFRAME){
						Move(300.0*Direction,0);
						Direction = Direction*-1;
						Move(-50.0*Direction,0);
					}
					break;
			}
			if(MOTIONEND){
				MotionChange(WALK,1,1);
				Move(-30.0*Direction,0);
			}
			break;
		case DEAD_MOTION :
			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){
				effect_create_above(ef_explosion,x,y,2,make_color_rgb(163,73,164));
				Flash(c_white,0.1,0.05);
				Fluid(x,y,make_color_rgb(163,73,164),35,5,20,0,180,0.5);
				Quake(5,5);
				sound_play(sndFluid);
				with(objShutter_Akesime){ flag = 0; }
				instance_destroy();
			}
			break;
	}
}

preHeadPosX	= HeadPosX;
preHeadPosY	= HeadPosY;