#e
#Title[Ԓʏ2]
#Text[]
#ScriptVersion[2]

script_enemy_main
{//Enemy01
	let count=0;
	let cx=GetCenterX();//STGV[̒SxW擾
	let cy=GetCenterY();//STGV[̒SyW擾
	let imgExRumia=GetCurrentScriptDirectory~"img\ExRumia.png";
	let imgExRumiaBack=GetCurrentScriptDirectory~"img\ExRumiaBack.png";
	@Initialize
	{
		SetMovePosition02(cx,cy-120,60);
		SetLife(3000);
		SetDamageRate(100,100);
		SetTimer(60);
		SetGraphicRect(1,1,64,64);
		SetInvincibility(60);
		LoadGraphic(imgExRumia);
		SetTexture(imgExRumia);	
		shottask;
		shottask2;
	}
	@MainLoop
	{
		yield;
		SetCollisionA(GetX(),GetY(),24);
		SetCollisionB(GetX(),GetY(),24);
	}
	@Finalize
	{

	}
	@DrawLoop
	{
		SetGraphicRect(1,1,64,64);
		SetAlpha(255);
		DrawGraphic(GetX(),GetY());
	}
	task shottask
	{
		let angle=0;
		let s=0;
		loop
		{
			wait(120);
			Concentration01(60);
			wait(60);
			let ga =GetAngleToPlayer;
			loop(30)
			{
				CreateShotA(s,GetX,GetY,30);
				SetShotDirectionType(ABSOLUTE);
				SetShotDataA(s,0,1,angle,0,0,2,YELLOW01);
				SetShotDataA(s,60,1,ga,0,0,2,YELLOW01);
				FireShot(s);
				angle+=12;
			}
		}
	}
	task shottask2
	{
		let angle=0;
		let flag=0;
		let s=0;
		let ling=1;
		wait(90);
		loop
		{
			loop(2)
			{
				let angle2=rand(0,360);
				loop(10)
				{
					CreateShotA(s,GetX,GetY,10);
					SetShotDirectionType(ABSOLUTE);
					SetShotDataA(s,0,5,angle2,0,0,2,YELLOW05);
					SetShotDataA(s,ling,1,angle,0,0,2,YELLOW05);
					angle2+=36;
					FireShot(s);
				}
				angle+=180;
			}
			angle+=16;
			if(flag==1)
			{
				ling--;
			}
			else
			{
				ling++;
			}
			if(ling==10)
			{
				flag=1;
			}
			if(ling==1)
			{
				flag=0;
			}
			wait(10);
		}
	}
	function wait(w) 
	{
		loop(w)
		{
			yield;
		}
	}
}