#東方弾幕風
#Title[熾天使「セラフィムの光輪」]
#Text[激重注意！ミシャクジ様をレーザーにしたら天使の輪っかに・・・。だが重い！！重すぎる！！難易度もおそらく一番高い気が・・・。]

#BackGround[Default]
#BGM[.\BGM\thA07]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main
{
	let count=90;
	let imgExRumia=GetCurrentScriptDirectory~"img\ExRumia.png";	

	let imgLittle=GetCurrentScriptDirectory~"img\RumiaCutIn.png";
        let flame=-100;
	let imgeffect_magic=GetCurrentScriptDirectory~"img\effect_magic.png";
	let imgback04_06=GetCurrentScriptDirectory~"img\back04_06.png";
	let imgAngle=0;

        @Initialize
	{

		SetLife(500);//ライフを500に設定
		SetDamageRate(10,10);//披ダメージを10%に設定
		SetTimer(60);//時間制限を60秒に設定
		SetGraphicRect(1,1,64,64);//描画元矩形を設定		
		LoadGraphic(imgExRumia);//画像「img\ExRumia.png」を読みこむ
		LoadGraphic(imgeffect_magic); 
		LoadGraphic(imgback04_06);		

                CutIn(YOUMU,"熾天使「セラフィムの光輪」",imgLittle,1,1,350,525);//スペルカード名表示
		SetScore(30000);//スペルカードボーナスを30000に設定
                
                SetMovePosition03(GetCenterX,GetCenterY-115,30,5);

	}
	
	@MainLoop
	{
 
          let j=rand(0,360);
          if(flame>0)
           {
		if(count<170&&count%40==0)		
                {

                            let angle = -90;
                            loop(45) {
                                     CreateShot01(GetX, GetY, 1, angle+j, WHITE21, 0);
                                     angle += 8;
                                     }

                        
                 }
            }

          if(count == 250) 
           {
           
             let dimasama=0;
             let misyakujisama=0;
             let i=0;
            
              loop(36)
               {
                CreateLaserC(dimasama,GetX,GetY,10,96,RED12,0);
              
                SetLaserDataC(dimasama,0,12,i+j,3,-0.8,3);
                SetLaserDataC(dimasama,60,NULL,NULL,0.8,0.03,4);
                FireShot(dimasama);


                CreateLaserC(misyakujisama,GetX,GetY,10,96,BLUE12,0);
                SetLaserDataC(misyakujisama,0,12,i+j,-3,-0.8,3);
                SetLaserDataC(misyakujisama,60,NULL,NULL,-0.8,0.03,4);
                FireShot(misyakujisama);
                i+=10;
               }
                    
            }

		           if(count==80)		
                                        {
                                          let j=5;
                                          while(j>1)
                                              {
                                               let radius = 100;
                                               let angle = 90;
                                               loop(90) {
                                                         let g = GetX + offsetX(radius, angle);
                                                         let t = GetY + offsetY(radius, angle);
                                                         CreateLaser01(g, t, j, angle, 70,4,AQUA01, 30);
                                                         angle += 8;
                                                         }
                                               j-=1
                                               }
                                         }



        if(count==350){count = 0;}

           
	SetCollisionA(GetX(),GetY(),32);//当たり判定(自弾)登録
	SetCollisionB(GetX(),GetY(),24);//当たり判定(体当たり)登録
               
	count++;
        flame++;
	}
	
	@Finalize
	{//読みこんだファイルを削除

 		DeleteGraphic(imgExRumia);	
		DeleteGraphic(imgeffect_magic);
		DeleteGraphic(imgback04_06);  
                  
          loop(30)
              {
	       CreateItem(ITEM_SCORE,GetX+rand(-100,100),GetY+rand(20,100));
               }

         
               
	}
	
	@DrawLoop
	{
		//Exルーミア描画
		
                SetGraphicRect(64,1,127,64);                             
		SetAlpha(255);
		SetTexture(imgExRumia);
		DrawGraphic(GetX(),GetY());
	      

			SetGraphicRect(0,80,150,230);
			SetAlpha(255);
			SetGraphicAngle(0,0,-imgAngle);
			SetTexture(imgeffect_magic);
			DrawGraphic(GetX(),GetY());
			imgAngle+=0.5;

			SetGraphicRect(300,230,450,380);
			SetAlpha(255);
			SetGraphicAngle(0,0,imgAngle);
			SetTexture(imgeffect_magic);
			DrawGraphic(GetX(),GetY());
                              
	}

	@BackGround
	{
	//スペルカード時の背景部分
	//無くてもよい


		SetTexture(imgback04_06);
		SetGraphicRect(1,1,512,512);
		SetAlpha(100);
		SetGraphicAngle(0,0,0);
		DrawGraphic(GetCenterX,GetCenterY);
		
	}

    function offsetX(radius, angle) {
        return radius * cos(angle);
    }

    function offsetY(radius, angle) {
        return radius * sin(angle);
    }

}


