#e
#Title[͎ʁun[̓ł̔v]
#Text[]
#ScriptVersion[2]

script_enemy_main
{//Enemy01
	SetDurableSpellCard;
	let base=0;
	let count=0;
	let count2=0;
	let cx=GetCenterX();//STGV[̒SxW擾
	let cy=GetCenterY();//STGV[̒SyW擾
	let imgExRumia=GetCurrentScriptDirectory~"img\ExRumia.png";
	let imgExRumiaBack=GetCurrentScriptDirectory~"img\ExRumiaBack.png";
	LoadUserShotData(GetCurrentScriptDirectory~"shot.txt");
	@Initialize
	{
		SetScore(30000);
		SetLife(1);
		SetDamageRate(0,0);
		SetTimer(33);
		SetGraphicRect(1,1,64,64);
		LoadGraphic(imgExRumia);	
		LoadGraphic(imgExRumiaBack);

		SetMovePosition02(cx,-128,120);

		Concentration01(120);
		CutIn(YOUMU,"͎ʁun[̓ł̔v",0,0,0,0,0);
	}
	@MainLoop
	{
		let spase=90;
		if(GetTimer<=21)
		{
			spase=60;
		}
		if(GetTimer<=15)
		{
			spase=45;
		}
		if(GetTimer<=9)
		{
			spase=30;
		}
		if(count==60)
		{
			base=GetPlayerX;
			Concentration01(60);
		}
		if(count==120)
		{
			SetMovePosition02(base,GetClipMaxY,30);
		};
		if(count==150)
		{
		};
		if(count==180)
		{
			let p=0;
			if(count2%2==0)
			{
				p=rand(cx,GetClipMaxX);
			}
			else
			{
				p=rand(GetClipMinX,cx);
			}
			SetMovePosition02(p,GetClipMinY,30);
		}
		if(count>120&&count<150)
		{
			let s=0;
			let s2=0;
			let angle=rand(0,360);
			if(count%5==0)
			{
				loop(360/spase){
					CreateShotA(s,GetX,GetY,0);
					SetShotDataA(s,0,3,angle,0,-0.03,0,rand_int(137,144));
					SetShotDataA(s,360,0.1,NULL,0.5,0.05,3,NULL);
					FireShot(s);
					angle+=spase;
				}
			}
			if(count==121)
			{
			CreateLaserB(s2,1024,360,155,0);
			SetLaserDataB(s2,0,0,64,0,GetAngle,0,GetAngle-180,0);
			SetShotKillTime(s2,60);
			FireShot(s2);
			}
		}
		count++;
		if(count==181)
		{
			count=0;
			count2++;
		}
		SetCollisionA(GetX(),GetY(),24);
	}
	@Finalize
	{//ǂ݂񂾃t@C폜
		loop(8)
		{
			CreateItem(ITEM_SCORE,cx+rand(-100,100),rand(GetY-40,GetY+40));
		}
	}
	
	@DrawLoop
	{
		//Ex[~A`
		if(count<270){SetGraphicRect(64,64,127,127)};
		if(count>=270){SetGraphicRect(1,1,64,64);}
		SetAlpha(255);
		SetTexture(imgExRumia);
		DrawGraphic(GetX(),GetY());
	}
}