if( place_free(x,y+1) ){
	air = true;
	gravity = 0.98;
	gravity_direction = 270;
}else{
	air = false;
	hspeed = hspeed*0.9;
	gravity = 0;
	gravity_direction = 0;
}

if(motion==0){
	hspeed = 0;
	if(objPlayer.x > x){
		image_xscale = -1;
		if( place_free(x+2,y) ) x = x+2;
	}else{
		image_xscale = 1;
		if( place_free(x-2,y) ) x = x-2;
	}
}

if(point_distance(x,y,objPlayer.x,objPlayer.y)<200 && !air && motion==0){
	if(objPlayer.x > x) image_xscale = -1;
	else image_xscale = 1;
	force_motion(1,0,2);
}

if( !air && motion==1 && number==3 && KEYFRAME){
	force_motion(2,0,2);
	vspeed = -10;
	hspeed = 10*-image_xscale;
}else if( !air && motion==2 ) force_motion(3,0,2);

if( motion==2 && !IF_VOID() ){
	if(!image_xscale) check = collision_enemy(x+hspeed,y,60,20,0,-1,round(random(2)),30,60);
	else check = collision_enemy(x+hspeed,y,60,20,180,-1,round(random(2)),30,60);
	if(check){
		hspeed = -hspeed;
		sound_play(sndHit00);
		quake(20,5);
		flash(c_red,0.5,0.1);
	}
}