#e
#Title[䕄uUږ͗l̒̒v]
#Text[]
#ScriptVersion[2]

script_enemy_main
{
	let cx=GetCenterX();//STGV[̒SxW擾
	let cy=GetCenterY();//STGV[̒SyW擾
	let imgExRumia=GetCurrentScriptDirectory~"img\ExRumia.png";
	let imgback=GetCurrentScriptDirectory~"img\RyuukaBack.png";
	let angle=0;
	LoadUserShotData(GetCurrentScriptDirectory~"shot.txt");
	@Initialize
	{
		SetScore(30000);
		SetLife(500);
		SetDamageRate(10,8);
		SetMovePosition02(cx,cy-120,60);
		SetTimer(60);
		SetGraphicRect(1,1,64,64);
		SetInvincibility(150);
		LoadGraphic(imgExRumia);
		SetTexture(imgExRumia);	
		shottask;
		shot2task;
		CutIn(YOUMU,"䕄uUږ͗l̒̒v",0,0,0,0,0);
	}
	@MainLoop
	{
		yield;
		SetCollisionA(GetX(),GetY(),24);
		SetCollisionB(GetX(),GetY(),24);
	}
	@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 s3=2;
		let s4=3;
		let s5=4;
		let s6=5;
		SetShotAutoDeleteClip(512,512,512,512);
		wait(120);
		loop
		{
			wait(3);
			let time=40;
			SetShotDirectionType(ABSOLUTE);
			CreateShotA(s,GetClipMinX,GetClipMaxY,0);	
			SetShotDataA(s,0,6,0,0,0,2,80);
			loop(4)
			{
				shot(time,240,6,s,s2);
				time+=20;
			}
			time=40;
			CreateShotA(s3,0,0,0);
			SetShotDataA(s3,0,6,240,0,0,3,80);
			loop(4)
			{
				shot(time,0,6,s3,s4);
				time+=20;
			}	
			CreateShotA(s5,0,0,0);
			SetShotDataA(s5,0,6,0,0,0,3,80);
			time=20;
			loop(4)
			{
				shot(time,120,6,s5,s6);
				time+=20;
			}	
			time=20;
			loop(4)
			{
				shot(time,300,6,s5,s6);
				time+=20;
			}	
			AddShot(20,s3,s5,0);
			CreateShotA(s5,0,0,0);
			SetShotDataA(s5,0,6,180,0,0,3,80);
			time=0;
			loop(4)
			{
				shot(time,120,6,s5,s6);
				time+=20;
			}	
			time=0;
			loop(4)
			{
				shot(time,300,6,s5,s6);
				time+=20;
			}	
			AddShot(20,s3,s5,0);
			AddShot(20,s,s3,0);
			FireShot(s);
		}
	}
	task shot2task
	{
		let s=0;
		wait(180);
		loop
		{
			wait(20);
			shot2(s,rand(GetClipMinX,GetClipMaxX),GetClipMaxY+32,270);
			shot2(s,rand(GetClipMinX,GetClipMaxX),GetClipMinY-32,90);
			shot2(s,GetClipMaxX+32,rand(GetClipMinY,GetClipMaxY),180);
			shot2(s,GetClipMinX-32,rand(GetClipMinY,GetClipMaxY),0);
		}
	}
	function shot (let time,let angle,let speed,let tipe,let tipe2)
	{
		CreateShotA(tipe2,0,0,0);
		SetShotDataA(tipe2,0,speed,angle,0,0,3,80);
		AddShot(time,tipe,tipe2,0);
	}
	function shot2(let shotid,let shotx,let shoty,let angle)
	{
		CreateShotA(shotid,shotx,shoty,0);
		SetShotDirectionType(ABSOLUTE);
		SetShotDataA(shotid,0,2,angle,0,0,0,80);
		FireShot(shotid);
	}
	function wait(w) 
	{
		loop(w)
		{
			yield;
		}
	}
}