#TouhouDanmakufu
#Title[Mid-Boss Agent 1]
#Text[1er Mid-Boss du stage 2]
#Image[]
#BGM[script\DanMUku\Stage2\Stage2.mp3]
#Player[script\DanMUku\Joueur\KorA\KorHosik.txt, script\DanMUku\Joueur\KorB\KorB.txt, script\DanMUku\Joueur\KorC\KorC.txt]
#ScriptVersion[2]

script_enemy_main
{    
    let imgEnemy ="script\DanMUku\Stage2\Image\Agent.png";
    let count=-127;
    let angle= 0;
    let r = 50;
    let a = 32;
    let b = 64;
    let o = 0;
    let boo = "script\DanMUku\Stage2\Son\boo.wav";

   @Initialize
   {
            LoadGraphic(imgEnemy);
            SetLife(3000);
            SetTimer(30);
            SetInvincibility(100);
            SetEnemyMarker(true);
            SetMovePosition02(GetCenterX, GetCenterY-100, 120);        
   }
   
   @MainLoop
   {
if(count<0)
{
o+=2;
}
if(count==0)
{
PlaySE(boo);
a=64;
b=96;
}
if(count>0)
{
if(count%4==0)
{
}
else{
loop(3)
{
CreateShot01(GetX+r*cos(angle), GetY+r*sin(angle), 2, angle, BLUE12, 10);
angle+=360/3;
}
}
}
if(count>0&&count<100)
{
angle+=4.05;
}
if(count>100&&count<150)
{
angle-=4.05;
}
if(count>150&&count<200)
{
angle-=8.05;
}
if(count>200&&count<300)
{
angle+=6;
}
if(count>300&&count<400)
{
angle+=11;
r--;
}
if(count>400&&count<500)
{
r++;
angle-=2.05;
}
if(count==520)
{
count=0;
}
count++;
   }
   @Finalize
   {
      DeleteGraphic(imgEnemy);
CreateItem(ITEM_SCORE, rand(GetX-20, GetX+20), rand(GetY-20, GetY+20));  
CreateItem(ITEM_SCORE, rand(GetX-20, GetX+20), rand(GetY-20, GetY+20));  
CreateItem(ITEM_SCORE, rand(GetX-20, GetX+20), rand(GetY-20, GetY+20));  
CreateItem(ITEM_SCORE, rand(GetX-20, GetX+20), rand(GetY-20, GetY+20));  
CreateItem(ITEM_SCORE, rand(GetX-20, GetX+20), rand(GetY-20, GetY+20));  
CreateItem(ITEM_SCORE, rand(GetX-20, GetX+20), rand(GetY-20, GetY+20));  
CreateItem(ITEM_SCORE, rand(GetX-20, GetX+20), rand(GetY-20, GetY+20));  
CreateItem(ITEM_SCORE, rand(GetX-20, GetX+20), rand(GetY-20, GetY+20));  
CreateItem(ITEM_SCORE, rand(GetX-20, GetX+20), rand(GetY-20, GetY+20));  
CreateItem(ITEM_SCORE, rand(GetX-20, GetX+20), rand(GetY-20, GetY+20)); 
	if (GetMissCountInThisSpell==0) {
		SetCommonData("B", true);
	} 
   }
   
   @DrawLoop
   {
            SetColor(255,255,255);
            SetRenderState(ALPHA);
            SetAlpha(o);
            SetTexture(imgEnemy);
            SetGraphicRect(a, 0, b, 32);
            DrawGraphic(GetX,GetY);
	DrawText("Agent", GetClipMinX+10, GetClipMinY+15, 12, 255);
   }

}
