script_enemy_main
{
        let csd     = GetCurrentScriptDirectory;
	let speed = GetSpeed;
	let angle = GetAngle;
	let num = GetArgument;
	let imgEnemy;
	if(num<=1)
	{
		imgEnemy=csd~"..\lib\fairy_red.png";
	}
	if(num>=2)
	{
		imgEnemy=csd~"..\lib\fairy_blue.png";
	}

	let SelectedDifficult=GetCommonDataDefault("SELECTEDDIFFICULT","Normal");

    @Initialize {
        SetLife(300);
        SetDamageRate(100,100);
	SetTexture(imgEnemy);
	//Initialize_Fairy(7);
	Tmain;
	}

    @MainLoop {
	//if(GetLife<1000){VanishEnemy;}
	BulletNum=GetEnemyShotCount;
	ascent(let i in -1..2)
	{
	SetGroundCollision(GetX+i*16,GetY,32);
	}
	//MSDSetCollisionAForBigEnemy(GetX(),GetY(),48);
	yield;
    }

        @DrawLoop {
	//	SetGraphicScale(1,1);
	//	SetColor(ZakoColor[0],ZakoColor[1],ZakoColor[2]);
	//	DrawFairy(imgEnemy);
		DrawMagicCircle("WHITE",0.50);
	}

        @Finalize
        {
		MagicCircleBreak(GetX,GetY,1,0.5);
		FinalizeItemAndShotnumWithDelete(5);
        } 

task Tmain
{
yield;
OutDamageRateZero;
AutoErazeTime(1200);
GetDamege;
MagicColor;
move;

alternative(GetCommonDataDefault("SELECTEDDIFFICULT","None"))
case("Moderate")
{
shotM;
}
case("Extream")
{
shotE;
}
case("Apocalypse")
{
shotA;
}

}


task move
{
//	SetMovePosition02(GetCenterX,GetCenterY-64,480);
//	wait(241);
	SetSpeed(0.75);
	SetAngle(90);
}

task shotM
{
wait(30);
loop(8)
{
CreateEnemyFromFile(csd~"Stage2Enemy01b.txt",GetX+25*cos(90+20*num+90),GetY+25*sin(90+20*num+90),1.5,90+20*num,1);
CreateEnemyFromFile(csd~"Stage2Enemy01b.txt",GetX+25*cos(90+20*num-90),GetY+25*sin(90+20*num-90),1.5,90+20*num,1);
wait(60);
}
}
/////////////////////////////////////////////////////
task shotE
{
wait(30);
loop(8)
{
CreateEnemyFromFile(csd~"Stage2Enemy01b.txt",GetX+30*cos(20*num+90)+25*cos(90+20*num+90),GetY+30*sin(20*num+90)+25*sin(90+20*num+90),1.5,90+20*num,1);
CreateEnemyFromFile(csd~"Stage2Enemy01b.txt",GetX+30*cos(20*num+90)+25*cos(90+20*num-90),GetY+30*sin(20*num+90)+25*sin(90+20*num-90),1.5,90+20*num,1);
wait(60);
}
}
/////////////////////////////////////////////////////////
task shotA
{
wait(30);
loop(8)
{
CreateEnemyFromFile(csd~"Stage2Enemy01b.txt",GetX+30*cos(20*num+90)+25*cos(90+20*num+90),GetY+30*sin(20*num+90)+25*sin(90+20*num+90),1.5,90+20*num,1);
CreateEnemyFromFile(csd~"Stage2Enemy01b.txt",GetX+30*cos(20*num+90)+25*cos(90+20*num-90),GetY+30*sin(20*num+90)+25*sin(90+20*num-90),1.5,90+20*num,1);
wait(60);
}
}

#include_function ".\..\txt/StageEnemydata.txt"
#include_function ".\..\lib\lib_anime_fairy.txt"
}

#include_script ".\..\txt/EnemyShotData.txt"