#東方弾幕風
#Title[魔槍「スピア・ザ・ロンギヌス」]
#Text[イエスの処刑に用いられたといわれる槍。画面外から戻ってくる高速自機狙いというありえない初見殺し。自重できずにやってしまった・・orz  サーセン]

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

script_enemy_main
{
	let count=0;
	let cx=GetCenterX();//STGシーンの中心x座標を取得;
	let imgExRumia=GetCurrentScriptDirectory~"img\ExRumia.png";
	let imgExRumiaBack=GetCurrentScriptDirectory~"img\ExRumiaBack.png";
        let power0=GetCurrentScriptDirectory~"SE\power0.wave";
        let tan00=GetCurrentScriptDirectory~"SE\tan00.wave";
	let imgLittle=GetCurrentScriptDirectory~"img\RumiaCutIn.png";
	let imgCircle=GetCurrentScriptDirectory~"img\circle6_m.png";
	let imgAngle=0;
	let imgback04_06=GetCurrentScriptDirectory~"img\back04_06.png";
	let freeze04=GetCurrentScriptDirectory~"SE\freeze04.wave";
	let data_usershot=GetCurrentScriptDirectory~"USERSHOT\data_usershot.txt";	

        @Initialize
	{
		SetScore(30000);//スペルカードボーナスを30000に設定
		SetLife(360);//ライフを300に設定
		SetDamageRate(10,3);//披ダメージを10%に設定
		SetTimer(60);//時間制限を60秒に設定

		SetGraphicRect(1,1,64,64);//描画元矩形を設定
		SetInvincibility(80);//敵を30フレーム無敵にする
		
		LoadGraphic(imgExRumia);//画像「img\ExRumia.png」を読みこむ
		LoadGraphic(imgback04_06);		
		LoadGraphic(imgCircle);
                LoadSE(power0);
		LoadSE(freeze04);
		LoadUserShotData(data_usershot);
		SetMovePosition02(cx+100,100,60);//座標(cx,60)へ60フレームかけて移動する
		Concentration01(150);
		CutIn(YOUMU,"魔槍「スピア・ザ・ロンギヌス」",imgLittle,1,1,350,525);//スペルカード名表示
	}
	
	@MainLoop
	{
		SetShotDirectionType(PLAYER);//弾の角度を自機基準に変更
		if(count==190){Concentration02(115);}
		if(count==180){PlaySE(power0);}
		if(count==350){PlaySE(freeze04);}
		if(count==395){PlaySE(freeze04);}
		if(count==455){PlaySE(freeze04);}
		if(count==515){PlaySE(freeze04);}



		if(count==330)
			{//ホーミング弾作製

			SetShotAutoDeleteClip(600,600,600,600);
			let Ronginus1 =1;
			let Ronginus2 =2;
			let Ronginus3 =3;
			let Ronginus4 =4;
			let ta1 =5;
			let Hosaki1 =6;
			let ta2 =5;
			let Hosaki2 =7;
			let ta3 =5;
			let Hosaki3 =8;
			let ta4 =5;
			let Hosaki4 =9;

			CreateLaserC(Ronginus1,GetX-20,GetY,7,24,PURPLE11,30);
			SetLaserDataC(Ronginus1,0,5,0,0,0.55,12);
			SetShotKillTime(Ronginus1,61);
			CreateLaserC(Hosaki1,GetX-20,GetY,12,12,PURPLE32,30);
			SetLaserDataC(Hosaki1,0,12,0,0,0,5);
			SetShotKillTime(Hosaki1,61);

			CreateLaserC(Ronginus2,0,0,7,24,PURPLE11,0);
			SetLaserDataC(Ronginus2,0,5,0,0,0.55,12);
			SetShotKillTime(Ronginus2,61);
			CreateLaserC(Hosaki2,0,0,12,12,PURPLE32,0);
			SetLaserDataC(Hosaki2,0,12,0,0,0,5);
			SetShotKillTime(Hosaki2,61);

			CreateLaserC(Ronginus3,0,0,7,24,PURPLE11,0);
			SetLaserDataC(Ronginus3,0,5,0,0,0.55,12);
			SetShotKillTime(Ronginus3,61);
			CreateLaserC(Hosaki3,0,0,12,12,PURPLE32,0);
			SetLaserDataC(Hosaki3,0,12,0,0,0,5);
			SetShotKillTime(Hosaki3,61);
	
			CreateLaserC(Ronginus4,0,0,7,24,PURPLE11,0);
			SetLaserDataC(Ronginus4,0,5,0,0,0.55,12);
			SetShotKillTime(Ronginus4,120);
			CreateLaserC(Hosaki4,0,0,12,12,PURPLE32,0);
			SetLaserDataC(Hosaki4,0,12,0,0,0,5);
			SetShotKillTime(Hosaki4,120);
			
			let i=0;
                        while(i<60)
			{//360回繰り返す
				let Shotang=rand(0,360);
				let ta1=10;
				CreateShotA(ta1,0,0,60);//taを作製
				SetShotDataA(ta1,0,7,Shotang,0,-0.7,0,PURPLE01);
				SetShotDataA(ta1,180,0.1,0,0,0.3,10,PURPLE32);
				SetShotKillTime(ta1,400);
				AddShot(i,Ronginus1,ta1,0);//shotAにtaを登録;
				i+=3;
			}

			let j=0;
                        while(j<60)
			{//360回繰り返す
				let Shotang=rand(0,360);
				let ta2=10;
				CreateShotA(ta2,0,0,60);//taを作製
				SetShotDataA(ta2,0,7,Shotang,0,-0.7,0,PURPLE01);
				SetShotDataA(ta2,180,0.1,0,0,0.3,10,PURPLE32);
				SetShotKillTime(ta2,400);
				AddShot(j,Ronginus2,ta2,0);//shotAにtaを登録;
				j+=3;
			}

			let k=0;
                        while(k<60)
			{//360回繰り返す
				let Shotang=rand(0,360);
				let ta3=10;
				CreateShotA(ta3,0,0,60);//taを作製
				SetShotDataA(ta3,0,7,Shotang,0,-0.7,0,PURPLE01);
				SetShotDataA(ta3,180,0.1,0,0,0.3,10,PURPLE32);
				SetShotKillTime(ta3,400);
				AddShot(k,Ronginus3,ta3,0);//shotAにtaを登録;
				k+=3;
			}

			let l=0;
			let emem=GetAngleToPlayer();
                        while(l<80)
			{//360回繰り返す
				let Shotang=rand(0,360);
				let ta1=10;
				CreateShotA(ta4,0,0,60);//taを作製
				SetShotDataA(ta4,0,7,Shotang,0,-0.7,0,PURPLE01);
				SetShotDataA(ta4,180,0.1,0,0,0.3,10,PURPLE32);
				SetShotKillTime(ta4,400);
				AddShot(l,Ronginus4,ta4,0);//shotAにtaを登録;
				l+=3;
			}
			
			AddShot(0,Hosaki4,Ronginus4,0); 
			AddShot(60,Ronginus3,Hosaki4,0); 
			AddShot(0,Hosaki3,Ronginus3,0); 
			AddShot(60,Ronginus2,Hosaki3,0); 
			AddShot(0,Hosaki2,Ronginus2,0); 
			AddShot(45,Ronginus1,Hosaki2,0); 
			FireShot(Ronginus1);
			FireShot(Hosaki1);




				
			}

				
			


                if(count==660)
			{
			SetShotAutoDeleteClip(300,300,300,300);
			SetMovePositionRandom01(75,40,5,GetClipMinX()+100,80,GetClipMaxX()-100,150);
			count=0;
			}
	

		SetCollisionA(GetX(),GetY(),48);//当たり判定(自弾)登録
		SetCollisionB(GetX(),GetY(),12);//当たり判定(体当たり)登録
		count++;
	}
	
	@Finalize
	{//読みこんだファイルを削除
		DeleteGraphic(imgExRumia);	
		SetShotAutoDeleteClip(64,64,64,64);
		CreateItem(ITEM_1UP,GetX,GetY-60);
		loop(8)
		{
			CreateItem(ITEM_SCORE,GetX+rand(-100,100),GetY-rand(20,100));
		}
	}
	
	@DrawLoop
	{
		//Exルーミア描画
                if(GetSpeedX()==0)
			{
			if(count<360){SetGraphicRect(64,64,127,127)};
			if(count>=360){SetGraphicRect(1,1,64,64);}
			}
		else if(GetSpeedX()>0){SetGraphicRect(192,1,255,64);}
	        else if(GetSpeedX()<0){SetGraphicRect(128,1,191,64);}
		SetGraphicAngle(0,0,0);
		SetAlpha(255);
		SetTexture(imgExRumia);
		DrawGraphic(GetX(),GetY());

		SetGraphicRect(129,1,256,128);
		SetAlpha(100);
		SetGraphicAngle(0,0,-imgAngle);
		SetTexture(imgCircle);
		DrawGraphic(GetX(),GetY());
		imgAngle+=1;
	}

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


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


}


	


	
	}
