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

	@Initialize{
	shotinit;
	SetMovePosition02(GetCenterX, GetCenterY-100, 120);
	LoadSE(shot);
	LoadSE(death);
	SetInvincibility(120);
	SetLife(1000);
	 LoadGraphic(Enemy);
        
	}

	@MainLoop {
	SetCollisionA(GetX, GetY, 18);
	SetCollisionB(GetX, GetY, 12);
	if(frame3>660){
	SetMovePosition02(GetCenterX, GetY-5, 10);
	}
	if(frame2 == 120){
	Concentration01(60);
	PlaySE(charge);
	}

	if(GetY<GetClipMinY-20){VanishEnemy;}
	if(frame == 59){

	let a   = 0;
        let num = 20; //Change this number here to specify the number of bullets in the ring.
        
        loop(num)
        {
            CreateShot01(GetX, GetY, 3, a+90, YELLOW02, 0);
            a += 360/num;
	PlaySE(shot);
		

}

}

	if(frame == 60){
	CreateShot01(GetX, GetY, 3, GetAngleToPlayer, RED03, 5);
	CreateShot01(GetX, GetY, 2.75, rand(5, -5)+GetAngleToPlayer, RED01, 7);
	CreateShot01(GetX, GetY, 2.72, rand(5, -5)+GetAngleToPlayer, RED01, 7);
	CreateShot01(GetX, GetY, 2.59, rand(5, -5)+GetAngleToPlayer, RED01, 7);
	CreateShot01(GetX, GetY, 2.465, rand(5, -5)+GetAngleToPlayer, RED01, 7);
	CreateShot01(GetX, GetY, 1.928298398, rand(5, -5)+GetAngleToPlayer, RED05, 7);
	CreateShot01(GetX, GetY, 2.136544646334634, rand(5, -7)+GetAngleToPlayer, RED05, 8);
	CreateShot01(GetX, GetY, 2.23133543, rand(5, -5)+GetAngleToPlayer, RED05, 8);
	CreateShot01(GetX, GetY, 1.644354234234234, rand(5, -5)+GetAngleToPlayer, RED05, 8);
	CreateShot01(GetX, GetY, 1.7635434354354, rand(5, -5)+GetAngleToPlayer, RED05, 8);
	CreateShot01(GetX, GetY, 1.2349349834, rand(5, -5)+GetAngleToPlayer, RED05, 8);
	CreateShot01(GetX, GetY, 1.918272, rand(5, -5)+GetAngleToPlayer, RED05, 8);
	CreateShot01(GetX, GetY, 1.9, rand(5, -5)+GetAngleToPlayer, RED05, 8);
	frame=30;
	}


	if (GetY>500){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(GetY>GetClipMinY+20){ PlaySE(death); loop(rand_int(10, 30)){
	CreateItem(ITEM_SCORE,GetX + rand(-20,20),GetY + rand(-20,20));
	}
    }
	}
	}