#e
#Title[ґzuȂ₢v]
#Text[]
#ScriptVersion[2]
script_enemy_main
{
	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(600);
		SetDamageRate(10,0);
		SetMovePosition02(cx,cy-120,60);
		SetTimer(80);
		SetGraphicRect(1,1,64,64);
		SetInvincibility(60);
		LoadGraphic(imgExRumia);
		SetTexture(imgExRumia);	
		shottask;
		bombtask;
		CutIn(YOUMU,"ґzuȂ₢v",0,0,0,0,0);//XyJ[h\
	}
	@MainLoop
	{
		yield;
	}
	@Finalize
	{
		loop(16)
		{
			CreateItem(ITEM_SCORE,GetX+rand(-30,30),GetY+rand(-30,30));
		}
		CreateItem(ITEM_1UP,GetX,GetY);
	}
	@DrawLoop
	{
		SetGraphicRect(1,1,64,64);
		DrawGraphic(GetX(),GetY());
	}
	task shottask
	{
		let s=0;
		let r=320;
		let angle=rand(0,360);
		wait(120);
		loop(12)
		{
			angle=rand(0,360);
			loop(90)
			{
				CreateShotA(s,GetPlayerX+r*cos(angle),GetPlayerY+r*sin(angle),30);
				SetShotDataA(s,0,0,angle,0,0,2,221);
				SetShotDataA(s,60,NULL,NULL,rand(-3,3),0.5,200,221);
				FireShot(s);
				angle+=4;
			}
			wait(10);
			r-=20;
		}
		wait(180);
		loop
		{
			loop(6)
			{
				shot(s,cx+rand(0,180)*cos(rand(0,360)),cy+rand(0,180)*sin(rand(0,360)));
				wait(10);
			}
			wait(60);
		}
	}
	task bombtask
	{
		loop
		{
			if(OnBomb)
			{
				SetAlpha(64);
				SetDamageRate(0,0);
			}
			else
			{
				SetAlpha(255);
				SetDamageRate(10,0);
				SetCollisionA(GetX(),GetY(),24);
				SetCollisionB(GetX(),GetY(),24);
			}
			yield;
		}
	}
	function shot(let shotid,let x,let y)
	{
		let angle=rand(0,360);
		loop(30)
		{
			CreateShotA(shotid,x+180*cos(angle),y+180*sin(angle),30);
			SetShotDataA(shotid,0,0,angle,0,0,2,221);
			SetShotDataA(shotid,180,NULL,NULL,rand(-3,3),0.5,200,221);
			FireShot(shotid);
			angle+=12;
		}
	}
	function wait(w) 
	{
		loop(w)
		{
			yield;
		}
	}
}