distance = point_distance(x,y,objPlayer.x,objPlayer.y);

if( place_free(x,y+1) ){
	air = true;
	gravity = 0.98;
	gravity_direction = 270;
}else{
	air = false;
	hspeed = hspeed*0.85;
	gravity = 0;
	gravity_direction = 0;
}
/*-- モーション動作 --*/
switch(motion){
	case 4 : 
		MOVE(4*-image_xscale,0);
		break;
	case 5 : 
		switch(number){
			case 4 : if(KEYFRAME) sound_play(sndSwing4); break;
			case 5 : 
			case 6 : 
				if(BIND_ABLE()){
					if(image_xscale) check = collision_enemy(Parts[5].x,Parts[5].y,50,20,250,-1,1,40,60);
					else check = collision_enemy(Parts[5].x,Parts[5].y,50,20,300,-1,1,40,60);
					if(check){
						sound_play(sndHit05);
						quake(20,5);
						Blood(check.x,check.y,20,0.1,0.5,0,180,5,10,c_red);
					}
				}
				MOVE(12*-image_xscale,0);
				break;
		}
		break;
	case 6 : 
		switch(number){
			case 4 : if(KEYFRAME) sound_play(sndSwing4); break;
			case 5 : 
			case 6 : 
				if(BIND_ABLE()){
					if(image_xscale) check = collision_enemy(Parts[9].x,Parts[9].y,50,20,180,-1,1,40,60);
					else check = collision_enemy(Parts[9].x,Parts[9].y,50,20,0,-1,1,40,60);
					if(check){
						sound_play(sndHit05);
						quake(20,5);
						Blood(check.x,check.y,20,0.1,0.5,0,180,5,10,c_red);
					}
				}
				MOVE(12*-image_xscale,0);
				break;
		}
		break;
	case 7 : 
		switch(number){
			case 3 : if(KEYFRAME) sound_play(sndSwing4); break;
			case 4 : 
				if(BIND_ABLE()){
					if(image_xscale) check = collision_enemy(Parts[5].x,Parts[5].y,50,20,180,-1,2,40,60);
					else check = collision_enemy(Parts[5].x,Parts[5].y,50,20,0,-1,2,40,60);
					if(check){
						sound_play(sndHit05);
						quake(20,5);
						Blood(check.x,check.y,20,0.1,0.5,0,180,5,10,c_red);
					}
				}
				MOVE(12*-image_xscale,0);
				break;
		}
		break;
	case 8 : 
		switch(number){
			case 6 :
			case 7 :
			case 8 :
				MOVE(15*image_xscale,0);
				break;
		}
		break;
}

/*-- 遷移 --*/
if(!force_change){
	switch(motion){
		case 0 :
			if(objPlayer.x > x) image_xscale = -1;
			else image_xscale = 1;
			if(objPlayer.b1==2){ force_motion(8,0,2); break; }
			if(distance<400) force_motion(4,0,3);
			else if(distance<220){
				if(random(100)<10){
					if(random(100)<33) force_motion(7,0,3);
					else if(random(100)<50) force_motion(5,0,3);
					else force_motion(6,0,3);
				}
			}
			break;
		case 4 : 
			if(objPlayer.b1==2){ force_motion(8,0,2); break; }
			if(50<distance && distance<90) force_motion(0,0,3);
			else if(80<distance && distance<220){
				if(random(100)<10){
					if(objPlayer.x > x) image_xscale = -1;
					else image_xscale = 1;
					if(random(100)<33) force_motion(7,0,3);
					else if(random(100)<50) force_motion(5,0,3);
					else force_motion(6,0,3);
				}
			}
			break;
		case 8 : 
			switch(number){
				case 1 : 
				case 2 : 
				case 3 : 
					INV = 30;
					if(CATCH) force_motion(8,6,1);
					break;

				case 5 : force_motion(0,0,3); break;
				case 9 : if(random(100)<50) force_motion(7,0,3); break;	 			
			}
			break;
	}
}