#e
#Title[u̖Sv]
#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(500);
		SetDamageRate(10,10);
		SetMovePosition02(cx,cy-120,60);
		SetTimer(60);
		SetGraphicRect(1,1,64,64);
		SetInvincibility(60);
		LoadGraphic(imgExRumia);
		SetTexture(imgExRumia);	
		shottask;
		CutIn(YOUMU,"u̖Sv",0,0,0,0,0);
	}
	@MainLoop
	{
		yield;
		SetCollisionA(GetX(),GetY(),24);//蔻(e)o^
		SetCollisionB(GetX(),GetY(),24);//蔻(̓)o^
	}
	@Finalize
	{
		loop(8)
		{
			CreateItem(ITEM_SCORE,cx+rand(-100,100),rand(20,100));
		}
	}
	@DrawLoop
	{
		SetGraphicRect(1,1,64,64);
		SetAlpha(255);
		DrawGraphic(GetX(),GetY());
	}
	task shottask
	{
		let s=0;
		let s2=1;
		let angle2=30;
		wait(120);
		loop
		{
			if(GetEnemyLife>=250)
			{
				wait(30);
				shot(s,s2,rand(30,90),1);
				wait(30);
				shot(s,s2,rand(30,90),0);
			}
			else if(GetEnemyLife<=250&&GetEnemyLife>=100)
			{
				loop(2)
				{
					wait(3);
					shot(s,s2,rand(30,90),1);
				}
				loop(2)
				{
					wait(3);
					shot(s,s2,rand(30,90),0);
				}
				wait(45);
			}
			else if(GetEnemyLife<=100)
			{
				loop(5)
				{
					wait(3);
					shot(s,s2,rand(30,90),1);
				}
				loop(5)
				{
					wait(3);
					shot(s,s2,rand(30,90),0);
				}
				wait(60);
			}
			loop(24)
			{
				CreateShotA(s,GetX,GetY,0);
				SetShotDataA(s,0,1,angle2,0,0,3,9);
				FireShot(s);
				angle2-=10;
			}
			angle2=30;
		}
	}
	function shot(let shotid,let shotid2,let shottime,let right)
	{
		let long =48;
		let speed=2;
		let po =0;
		let point=0;
		let r=90;
		let angle=0;
		let carb=0;
		let time=shottime;
		if(right==1)
		{
			point=GetClipMaxX+32;
			angle=rand(220,260);
			carb=rand(-1,0);
		}
		else
		{
			point=GetClipMinX-32;
			angle=rand(320,280);
			carb=rand(1,0);
		}
		CreateLaserC(shotid,point,cy+120,10,long,160,0);
		SetLaserDataC(shotid,0,6,angle,carb,0,2);
		loop(12)
		{
			CreateShotA(shotid2,0,0,0);
			SetShotDataA(shotid2,0,0,90,0,0,3,253);
			SetShotDataA(shotid2,shottime-time,0,rand(260,280),0,0,3,74);
			SetShotDataA(shotid2,shottime-time+10,0,rand(85,95),0,0.1,speed,74);
			AddShot(time,shotid,shotid2,48);	
			time-=4;
			speed-=0.03;
		}
		SetShotKillTime(shotid,shottime);
		FireShot(shotid);
	}
	function wait(w) 
	{
		loop(w)
		{
			yield;
		}
	}
}