#TouhouDanmakufu
#Title[Mid-Boss Maritin NSC]
#Text[Attaque du Mid-Boss du stage 3]
#Image[]
#BGM[script\DanMUku\Stage3\Stage3.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\Stage3\Image\Maritin.png";
    let count = -120;
    let t = 0;
    let a = 0;
    let angle = 0;
    let tir ="script\DanMUku\Stage1\Son\tir.wav";
    let laser ="script\DanMUku\Stage2\Son\laser.wav";
    let id = 0;
    let s =0;
    let d = 0;

   @Initialize
   {
            LoadUserShotData("script\DanMUku\MUtir\MUtir.txt");
            LoadGraphic(imgEnemy);
            SetLife(1800);
            SetTimer(40);
            SetInvincibility(100);
            SetEnemyMarker(true);
            SetMovePosition02(GetCenterX, GetCenterY+100, 120);           
   }
   
   @MainLoop
   {
        SetCollisionA(GetX, GetY, 16);
        SetCollisionB(GetX, GetY, 16);
if(count>=0)
{
	SetSpeed(4);
	SetAngle(a);
	a-=2;
}
if(count%200==0&&count>0)
{
angle=90;
s=0.5;
CreateLaserC(id, rand(GetClipMinX+10, GetClipMaxX-10), GetClipMinY, 5, 150, 8, 0);
SetLaserDataC(id, 0, 2, angle, 0, 0, 2);
SetLaserDataC(id, 20, 2, angle+20, s, 0, 2);
SetLaserDataC(id, 40, 2, angle-20, -s, 0, 2);
SetLaserDataC(id, 60, 2, angle+20, s, 0, 2);
SetLaserDataC(id, 80, 2, angle-20, -s, 0, 2);
SetLaserDataC(id, 100, 2, angle+20, s, 0, 2);
SetLaserDataC(id, 120, 2, angle-20, -s, 0, 2);
SetLaserDataC(id, 140, 2, angle+20, s, 0, 2);
SetLaserDataC(id, 160, 2, angle-20, -s, 0, 2);
SetLaserDataC(id, 180, 2, angle+20, s, 0, 2);
SetLaserDataC(id, 200, 2, angle-20, -s, 0, 2);
SetLaserDataC(id, 220, 2, angle+20, s, 0, 2);
s=20;
SetLaserDataC(id, 240, 6, -angle-20, -s, 0, 2);
SetLaserDataC(id, 260, 6, -angle+20, s, 0, 2);
SetLaserDataC(id, 280, 6, -angle-20, -s, 0, 2);
SetLaserDataC(id, 300, 6, -angle+20, s, 0, 2);
SetLaserDataC(id, 320, 6, -angle+20, s, 0, 2);
SetLaserDataC(id, 340, 6, -angle-20, -s, 0, 2);
SetLaserDataC(id, 360, 6, -angle+20, s, 0, 2);
SetLaserDataC(id, 380, 6, -angle-20, -s, 0, 2);
SetLaserDataC(id, 400, 6, -angle+20, s, 0, 2);
SetLaserDataC(id, 420, 6, -angle-20, -s, 0, 2);
SetLaserDataC(id, 440, 6, -angle+20, s, 0, 2);
SetLaserDataC(id, 460, 6, -angle-20, -s, 0, 2);
SetLaserDataC(id, 480, 6, -angle+20, s, 0, 2);
SetLaserDataC(id, 500, 6, -angle-20, -s, 0, 2);
SetLaserDataC(id, 520, 6, -angle+20, s, 0, 2);
SetLaserDataC(id, 540, 6, -angle+20, s, 0, 2);
SetLaserDataC(id, 560, 6, -angle-20, -s, 0, 2);
SetLaserDataC(id, 580, 6, -angle+20, s, 0, 2);
SetLaserDataC(id, 600, 6, -angle-20, -s, 0, 2);
SetLaserDataC(id, 620, 6, -angle+20, s, 0, 2);
SetLaserDataC(id, 640, 6, -angle-20, -s, 0, 2);
SetLaserDataC(id, 660, 6, -angle+20, s, 0, 2);
SetLaserDataC(id, 680, 6, -angle-20, -s, 0, 2);
SetLaserDataC(id, 700, 6, -angle+20, s, 0, 2);
SetLaserDataC(id, 720, 2, -angle, 0, 0, 2);
FireShot(id);
PlaySE(laser);
id++;
}
if(count%50==0&&count>0)
{
d= GetAngleToPlayer;
PlaySE(tir);
loop(20)
{
CreateShot01(GetX, GetY, 1.5, d, 14, 0);
d+=18;
}
}
count++;
t+=10;
yield;
   }
   @Finalize
   {
      DeleteGraphic(imgEnemy);
   }
   
   @DrawLoop
   {
            SetColor(255,255,255);
            SetRenderState(ALPHA);
            SetTexture(imgEnemy);
            SetGraphicAngle (0, 0, t);
            SetGraphicRect(0, 0, 28, 35);
            DrawGraphic(GetX,GetY);
	DrawText("Maritin", GetClipMinX+10, GetClipMinY+15, 12, 255);
   }

}
