script_enemy_main{
	let Enemy = GetCurrentScriptDirectory~"fairies.png";
	let frame = rand_int(0, -20);
	let shot = GetCurrentScriptDirectory~"shot.wav";
	#include_function ".\lib\SHOT_REPLACE\shot_replace.dnh";
	let death = GetCurrentScriptDirectory~"explode.wav";
	let ani =0;
	@Initialize{
	shotinit;
	LoadSE(death);
	LoadSE(shot);
	SetLife(60);
	 LoadGraphic(Enemy);
       
        

	}

	@MainLoop {
	SetCollisionA(GetX, GetY, 10);
	SetCollisionB(GetX, GetY, 10);
	SetMovePosition02(GetX, GetY+1, 2);

	if(frame> rand_int(0, 30)){
	CreateShot01(GetX, GetY, 3.5, GetAngleToPlayer, RED12, 1);
	PlaySE(shot);
	frame = -30;
	}

	if (GetY>500){VanishEnemy;}

	frame++;
	
	}

	 @DrawLoop {
	 SetTexture(Enemy);
	ani++;
	if(ani>0 && ani<4){
	SetGraphicRect(33, 349, 66, 385);
	}
	if(ani>16){
	SetGraphicRect(66, 349, 97, 385);
}
	if(ani>4 && ani<8){
	SetGraphicRect(0, 349, 33, 385);
	}

	if(ani>8 && ani<12){
	SetGraphicRect(99, 349, 129, 385); 
	}

	if(ani>12 && ani<16){
	SetGraphicRect(129, 349, 162, 385);
	}
	if(ani==17){
	ani=0;
	}

	 DrawGraphic(GetX, GetY);
    }
	 @Finalize {
	
	if(GetY<500){
PlaySE(death);

loop(rand_int(1, 3)){
	
	CreateItem(ITEM_SCORE,GetX + rand(-20,20),GetY + rand(-20,20));
	}
    }
	}
	}