/*-----重力設定--------------------------*/
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);

/*-----モーション毎の処理--------------------*/
if(RECV_DAMAGE){
	playEnemySound(SOUND_DAMAGE);
}

switch(MotionNum){
	case STAND :
		break;
	case WALK : 
		switch(KeyFrmNum){
			case  3 : 
			case  4 : 
			case  5 : 
			case  6 : Move(-4.0*Direction,0); break;
		}
		break;
}

if(!ChangeMotion){
	switch(MotionNum){
		case STAND :
			/* 相手の方を向く */
			if(objPlayerDoll.x > x) Direction = Right;
			else Direction = Left;

			/* 近づいたら歩く */
			if( !air && 100<playerDistance && playerDistance<350) MotionChange(WALK,0,2);
			break;
		case WALK : 
			switch(KeyFrmNum){
				case  1 : Move(-1.0*Direction,0); break;
				case  2 : Move(-2.0*Direction,0); break;
				case  6 : if(KEYFRAME) MotionChange(MotionNum,3,3); break;
			}
			/* 近づいたら歩く */
			if( !air && 100>playerDistance || playerDistance>350) MotionChange(STAND,0,5);
			break;
	}
}