#TouhouDanmakufu
#Title[Mid-Boss Machin]
#Text[Mid-Boss du stage 1]
#Image[]
#BGM[script\DanMUku\Stage1\Stage1.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\Stage1\Image\Machin.png";
    let count=-100;
    let a=GetAngleToPlayer;
    let d=10;
    let tir ="script\DanMUku\Stage1\Son\tir.wav";
    let z = 0;
    let w = 0.5;
   @Initialize
   {
      LoadUserShotData("script\DanMUku\MUtir\MUtir.txt");
      LoadGraphic(imgEnemy);
      LoadSE(tir);
            SetLife(2800);
            SetTimer(30);
            SetInvincibility(60);
            SetEnemyMarker(true);
            SetMovePosition02(GetCenterX, GetCenterY - 100, 120);        
   }
   
   @MainLoop
   {
          SetCollisionA(GetX, GetY, 16);
        SetCollisionB(GetX, GetY, 16);
if(count==0)
{
PlaySE(tir);
loop(28)
{
CreateShot02(GetX, GetY, 1, a, 0.1, 5, 81, d);
a+=26;
d+=0.5;
}
}
if(count==40)
{
SetMovePosition02(GetX, GetY+100, 40);
}
if(count==80)
{
PlaySE(tir);
loop(28)
{
CreateShot02(GetX, GetY, 1, a, 0.1, 5, 81, d);
d+=0.5;
a-=26;
}
}
if(count==110)
{
SetMovePosition02(GetX-50, GetY-100, 40);
}
if(count==150)
{
loop(28)
{
PlaySE(tir);
CreateShot02(GetX, GetY, 1, a, 0.1, 5, 81, d);
d+=0.5;
a+=26;
}
}
if(count==170)
{
SetMovePosition02(GetX+100, GetY+100, 40);
}
if(count==210)
{
loop(28)
{
PlaySE(tir);
CreateShot02(GetX, GetY, 1, a, 0.1, 5, 81, d);
d+=0.5;
a-=26;
}
}
if(count==220)
{
SetMovePosition02(GetX-50, GetY-100, 40);
}
if(count==250)
{
PlaySE(tir);
loop(9)
{
CreateShot01(GetX, GetY, 0.5, a, GREEN03, 0);
a+=40;
}
}
if(count==300)
{
count=-1;
}
a=GetAngleToPlayer;
d=10;
count++;
   }
   @Finalize
   {
loop(8)
{
CreateItem(ITEM_SCORE, rand(GetX-20, GetX+20), rand(GetY-20, GetY+20));  
}

	if (GetMissCountInThisSpell==0) {
		SetCommonData("B", true);
	}

      DeleteGraphic(imgEnemy);
   }
   
   @DrawLoop
   {
            SetColor(255,255,255);
            SetRenderState(ALPHA);
            SetTexture(imgEnemy);
            SetGraphicRect(0,0,16*1.5,16*1.5);
            DrawGraphic(GetX,GetY+z);
     if(z==10){w=-0.5;}
     if(z==-10){w=0.5;}
z+=w;
	DrawText("Machin", GetClipMinX+10, GetClipMinY+15, 12, 255);
   }

}
