/*-----重力設定--------------------------*/
speed = 0; /* 動かないし！ */

with(objEnemyEdit){ if(Edit_Play) exit; }

/*-----キャラクタとの情報の取得---------------*/
playerDistance = point_distance(x,y,objPlayerDoll.x,objPlayerDoll.y);
playerDirection = point_direction(x,y,objPlayerDoll.x,objPlayerDoll.y);

/*-----モーション毎の処理--------------------*/

if(!ChangeMotion){
	switch(MotionNum){
		/* =========== 飛び出す向きの決定 =========== */
		case CHECK_DIR :
			MotionChange(WAIT,0,1);
			break;
		case WAIT :
			if(playerDistance<80){
				playEnemySound(SOUND_ATTACK);
				MotionChange(UP,0,1);
			}
			break;
		case UP :
			switch(KeyFrmNum){
				case 2 : 
					if(KEYFRAME){
						col = collision_circle( x,y-64, 32,objPlayerDoll,0,1);
						with( col ){
							if(!INV){
								DamageVoiceRandom_High();
								if(BINDED){
									addDamage(40, -1, -1, -1, -1, -1, -1);
								}else{
									addDamage(40,DAMAGE_0, 0, 1, DOWN_1, 0, 2); 
									hspeed = 15*Direction;
									if(isGameOver()){
										Flash(c_red,1,0.05);
										with(other){
											switch(floor(random(3.9))){
												case 0 :
													FinishNumber = 1;
													startBind( col,BIND_FINISH_UP,0,other.BINDED_TRAP_PILE_FINISH,0,1 );
													break;
												case 1 :
													SpecialVoice(V_MUSE,0);
													FinishNumber = 2;
													startBind( col,BIND_FINISH_UP,0,other.BINDED_TRAP_PILE_FINISH2,0,1 );
													break;
												case 2 :
													SpecialVoice(V_MUSE,0);
													SpecialVoice(V_HA,4);
													/* おなかのパーツに大ダメージ！ */
													with(objCommon_Body){
														with(DrawTarget){
														PartsDamage(other.id,-random(100),0);
														PartsBloodDamage(other.id,-random(100),0);
														}
													}
													FinishNumber = 3;
													startBind( col,BIND_FINISH_UP,0,other.BINDED_TRAP_PILE_FINISH3,0,1 );
													break;
												case 3 :
													SpecialVoice(V_MUSE,0);
													SpecialVoice(V_HA,4);
													/* おなかのパーツに大ダメージ！ */
													with(objCommon_Body){
														with(DrawTarget){
														PartsDamage(other.id,-random(100),0);
														PartsBloodDamage(other.id,-random(100),0);
														}
													}
													FinishNumber = 4;
													startBind( col,BIND_FINISH_UP,0,other.BINDED_TRAP_PILE_FINISH4,0,1 );
													break;
											}
											MotionChange(FINISH,0,1);
										}
									}
								}
								Fluid(x,y,COLOR_BLOOD,5,2,20, 80,20,0.5);
								Fluid(x,y,COLOR_BLOOD,5,2,20,260,20,0.5);
								Flash(c_red,0.2,0.05);
								sound_play(sndHit02);
								Quake(15,15);
							}
						}
					}
					break;
			}
			if(MOTIONEND) MotionChange(WAIT,0,1);
			break;
		case FINISH :
			switch(FinishNumber){
				case 1 : 
					Fluid(objPlayerDoll.HEAD.x,	objPlayerDoll.HEAD.y-28,COLOR_BLOOD,BloodAmount,2,BloodAmount*2+3,80,20,0.5);
					break;
				case 2 : 
					Fluid(objPlayerDoll.HEAD.x,	objPlayerDoll.HEAD.y,COLOR_BLOOD,BloodAmount,2,BloodAmount*2+3,80,20,0.5);
					Process[ProcessNum[PARTS_PILE_TIP2]].depth = objPlayerDoll.depth - 1001;
					break;
				case 3 : 
					FluidWithScale(objPlayerDoll.HEAD.x,	objPlayerDoll.HEAD.y+16,COLOR_BLOOD,BloodAmount,2,BloodAmount*2+3,80,20,0.5,0.3,objPlayerDoll.depth-1000);
					Process[ProcessNum[PARTS_PILE_TIP2]].depth = objPlayerDoll.depth - 1001;
					break;
				case 4 : 
					if(objPlayerDoll.KeyFrmNum>40){
						FluidWithScale(objPlayerDoll.HEAD.x+objPlayerDoll.Direction*8,objPlayerDoll.HEAD.y,COLOR_BLOOD,BloodAmount,2,BloodAmount*2+3,80,20,0.5,0.3,objPlayerDoll.depth-1000);
					}else{
						FluidWithScale(objPlayerDoll.HEAD.x+objPlayerDoll.Direction,objPlayerDoll.HEAD.y,COLOR_BLOOD,BloodAmount,2,BloodAmount*2+3,80,20,0.5,0.3,objPlayerDoll.depth-1000);
					}
					Process[ProcessNum[PARTS_PILE_TIP2]].depth = objPlayerDoll.depth - 1001;
					break;
			}
			Fluid(objPlayerDoll.BODY_BOTTOM.x,	objPlayerDoll.BODY_BOTTOM.y,COLOR_BLOOD,BloodAmount,2,BloodAmount*2+5,250,40,0.5);
			BloodAmount -= 0.1;
			if(BloodAmount<0){
				BloodAmount = 0;
				if(random(100)<30) BloodAmount = 1;
			}

			break;
	}
}