#東方弾幕風
#Title[中ボス通常]
#Text[ただの交差弾だが、角度が深く入ってくるので少し飛鉢っぽい気もする]
#ScriptVersion[2]
#Player[FREE]

script_enemy_main {
   	let imgBoss   = GetCurrentScriptDirectory~"img\dot_wriggle.png";
   	let frame     =  -120;
    	let angleBase = 90;
	let arrow01=GetCurrentScriptDirectory~"SE\arrow01.wav";
   	let familiar= GetCurrentScriptDirectory~"img\familiar.png";
	let imgAngle=0;
	let data_usershot=GetCurrentScriptDirectory~"USERSHOT\data_usershot.txt";

    @Initialize {
        SetX(-100);
        SetY(-50);
        SetLife(5000);

	SetTimer(60);//時間制限を60秒に設定
        LoadGraphic(imgBoss);
        LoadGraphic(familiar);
	LoadSE(arrow01);
	LoadUserShotData(data_usershot);

    }

    @MainLoop 
    {
      SetCollisionA(GetX, GetY, 24);
      SetCollisionB(GetX, GetY, 24);

	if(frame==-100){SetMovePosition03(GetCenterX,120,10,6);}
      frame++;
      let j=rand(0,360);
       
        if(frame>0&&frame <181&&frame%60==0) 
         {
           PlaySE(arrow01);
           let dimasama=0;
           let misyakujisama=0;
           let i=0;
     	   SetShotAutoDeleteClip(150,150,150,150);
            loop(18)
             {
              CreateShotA(dimasama,GetX+100,GetY,0);
              SetShotDataA(dimasama,0,8,i+j,1.2,-0.3,1,143);
              SetShotDataA(dimasama,100,NULL,NULL,0.15,0,1,143);
              FireShot(dimasama);


              CreateShotA(misyakujisama,GetX-100,GetY,0);
              SetShotDataA(misyakujisama,0,8,i+j,-1.2,-0.3,1,143);
              SetShotDataA(misyakujisama,100,NULL,NULL,-0.15,0,1,143);
              FireShot(misyakujisama);
              i+=20;
             }
           
           
           
          }
        if(frame >240&&frame<421&&frame%60==0) 
         {
           PlaySE(arrow01);
           let dimasama=0;
           let misyakujisama=0;
           let i=0;
     	   SetShotAutoDeleteClip(100,100,100,100);
            loop(18)
             {
              CreateShotA(dimasama,GetX+100,GetY,0);
              SetShotDataA(dimasama,0,8,i+j,-1.2,-0.3,1,142);
              SetShotDataA(dimasama,100,NULL,NULL,0.15,0,1,142);
              FireShot(dimasama);


              CreateShotA(misyakujisama,GetX-100,GetY,0);
              SetShotDataA(misyakujisama,0,8,i+j,1.2,-0.3,1,142);
              SetShotDataA(misyakujisama,100,NULL,NULL,-0.15,0,1,142);
              FireShot(misyakujisama);
              i+=20;
             }
           
           
           
          }

	if(frame==480){frame = 0;}
         
    }

    @DrawLoop {



        SetTexture(imgBoss);
	SetAlpha(255);
	SetGraphicAngle(0,0,0);
        SetGraphicRect(0, 0, 128, 128);
        DrawGraphic(GetX, GetY);

        SetTexture(familiar);
	SetAlpha(200);
	SetGraphicAngle(0,0,-imgAngle);
        SetGraphicRect(48, 48, 96, 96);
        DrawGraphic(GetX+100, GetY);

        SetTexture(familiar);
	SetAlpha(200);
	SetGraphicAngle(0,0,+imgAngle);
        SetGraphicRect(48, 48, 96, 96);
        DrawGraphic(GetX-100, GetY);

	imgAngle+=1;

    }

    @Finalize
	 {
        	DeleteGraphic(imgBoss);

    	}


}