#東方弾幕風
#Title[模写「駆け抜ける星屑」]
#Text[試作]
#ScriptVersion[2]

script_enemy_main
{//Enemy01
	SetDurableSpellCard;
	let base=0;
	let count=0;
	let count2=0;
	let s=0;
	let cx=GetCenterX();//STGシーンの中心x座標を取得
	let cy=GetCenterY();//STGシーンの中心y座標を取得
	let imgExRumia=GetCurrentScriptDirectory~"img\ExRumia.png";
	let imgExRumiaBack=GetCurrentScriptDirectory~"img\ExRumiaBack.png";
	LoadUserShotData(GetCurrentScriptDirectory~"shot.txt");
	@Initialize
	{
		SetScore(30000);
		SetLife(1);
		SetDamageRate(0,0);
		SetMovePosition02(cx,cy-120,60);
		SetTimer(33);
		SetGraphicRect(1,1,64,64);
		SetInvincibility(60);
		LoadGraphic(imgExRumia);
		
SetTexture(imgExRumia);	
		shottask;
		CutIn(YOUMU,"模写「駆け抜ける星屑」",0,0,0,0,0);//スペルカード名表示
	}
	@MainLoop
	{
		yield;
		SetCollisionA(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 spase=60;
		loop
		{
			if(GetTimer<=21)
			{
				spase=45;
			}
			if(GetTimer<=15)
			{
				spase=30;
			}
			if(GetTimer<=9)
			{
				spase=20;
			}
			wait(60);
			base=GetPlayerX;
			Concentration01(60);
			wait(60);
			SetMovePosition02(base,GetClipMaxY,30);
			MotionBlur(SHOT,30,122);
			loop(6)
			{
				loop(2)
				{
					CreateShot01(GetX,GetY,rand(0.5,4),rand(GetAngle-200,GetAngle-160),rand_int(137,144),0);
				}
				wait(5);
				let angle=rand(0,360);
				loop(360/spase)
				{
					CreateShotA(s,GetX,GetY,0);
					SetShotDataA(s,0,3,angle,0,-0.05,0,rand_int(137,144));
					SetShotDataA(s,180,0.1,NULL,0,0.05,3,NULL);
					FireShot(s);
					angle+=spase;
				}
			}
			wait(60);
			let p=0;
			if(count%2==0)
			{
				p=rand(cx,GetClipMaxX);
			}
			else
			{
				p=rand(GetClipMinX,cx);
			}
			SetMovePosition02(p,GetClipMinY,30);
			count++;
		}
	}
	function wait(w) 
	{
		loop(w)
		{
			yield;
		}
	}
}