script_enemy_main{
	let Enemy = GetCurrentScriptDirectory~"fairies.png";
	let frame = 0;
	let frame2= 0;
	let frame3= 0;
	let ani = 0;
	let shot = GetCurrentScriptDirectory~"shot.wav";
	#include_function ".\lib\SHOT_REPLACE\shot_replace.dnh";
	let death = GetCurrentScriptDirectory~"explode.wav";

	@Initialize{
	shotinit;
	SetMovePosition02(GetCenterX+90, GetCenterY-100, 120);
	LoadSE(shot);
	SetLife(400);
	LoadSE(death);
	LoadGraphic(Enemy);
        

	}

	@MainLoop {
	SetCollisionA(GetX, GetY, 18);
	SetCollisionB(GetX, GetY, 10);
	
	


	if(frame3==240){
	SetMovePosition02(GetCenterX-90, GetCenterY-100, 120);
	}

	if(frame3>420){
	SetMovePosition02(GetX-5, GetCenterY-100, 10);
	}


	if(frame == 60){
	CreateShot01(GetX, GetY, 3.5, 180+frame2, BLUE12, 15);
	CreateShot01(GetX, GetY, 3.5, 180-frame2, BLUE12, 15);
	CreateShot01(GetX, GetY, 3.5, 360+frame2, BLUE12, 15);
	CreateShot01(GetX, GetY, 3.5, 360-frame2, BLUE12, 15);
	PlaySE(shot);
	frame = 58;
	}

	if (GetX<GetClipMinX-20){VanishEnemy;}

	frame++;
	frame2+=5;
	frame3++;
	yield;
	}

	
	@DrawLoop {
	 SetTexture(Enemy);
	ani+=0.5;
	if(ani>0 && ani<2){
	SetGraphicRect(65, 449, 130, 510);
	}
	if(ani>9){
	SetGraphicRect(131, 449, 193, 510);
}
	if(ani>2 && ani<4){
	SetGraphicRect(0, 449, 63, 510);
	}

	if(ani>4 && ani<6){
	SetGraphicRect(198, 449, 255, 510); 
	}

	if(ani>6 && ani<9){
	SetGraphicRect(257, 449, 320, 510);
	}
	if(ani==10){
	ani=0;
	}
 DrawGraphic(GetX, GetY);
}
	 @Finalize {
	
	if(GetX>GetClipMinX+20){ PlaySE(death); loop(rand_int(1, 3)){
	CreateItem(ITEM_SCORE,GetX + rand(-20,20),GetY + rand(-20,20));
	}
    }
	}
	}