#東方弾幕風
#Title[木符「ハウスダストレヴァリエ」]
#Text[試作]
#ScriptVersion[2]
script_enemy_main
{
	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(500);
		SetDamageRate(10,8);
		SetMovePosition02(cx,cy-120,60);
		SetTimer(60);
		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);//当たり判定(自弾)登録
		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;
		wait(60);
		loop
		{
			wait(60);
			loop(24)
			{
				CreateShotA(s,GetX,GetY,30);
				SetShotDirectionType(SEQUENCE);
				SetShotDataA(s,0,rand(3,5),rand(0,360),0,-0.1,1,8);
				FireShot(s);
			}
			loop(7)
			{
				CreateShotA(s,GetClipMaxX,rand(GetClipMinY,GetClipMaxY),0);
				SetShotDirectionType(ABSOLUTE);
				SetShotDataA(s,0,rand(1,5),rand(120,150),0,-0.1,2,8);
				FireShot(s);
			}
			loop(7)
			{
				CreateShotA(s,rand(GetClipMinX,GetClipMaxX),GetClipMinY,0);
				SetShotDirectionType(ABSOLUTE);
				SetShotDataA(s,0,rand(1,5),rand(120,150),0,-0.1,2,8);
				FireShot(s);
			}
			loop(7)
			{
				CreateShotA(s,GetClipMinX,rand(GetClipMinY,GetClipMaxY),0);
				SetShotDirectionType(ABSOLUTE);
				SetShotDataA(s,0,rand(1,5),rand(30,60),0,-0.1,2,8);
				FireShot(s);
			}
			loop(7)
			{
				CreateShotA(s,rand(GetClipMinX,GetClipMaxX),GetClipMinY,0);
				SetShotDirectionType(ABSOLUTE);
				SetShotDataA(s,0,rand(1,5),rand(30,60),0,-0.1,2,8);
				FireShot(s);
			}
		}
	}
	function wait(w) 
	{
		loop(w)
		{
			yield;
		}
	}
}