..#東方弾幕風
#Title[紋符「丸に七曜」]
#Text[初製作スクリプト]
#ScriptVersion[2]

script_enemy_main
{//Enemy01
	let count=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(500);
		SetDamageRate(10,8);
		SetMovePosition02(cx,cy,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;
		let s2=1;
		let angle=rand(0,360);
		loop
		{
			wait(240);
			shot(s,s2);
			wait(60);
			loop(60)
			{
				CreateShotA(s,cx,cy,0);	
				SetShotDirectionType(ABSOLUTE);
				SetShotDataA(s,0,3,angle,0,0,0,80);
				SetShotDataA(s,30,0,angle,0,0,0,80);
				SetShotDataA(s,60,NULL,angle,0,0.01,0.7,80);
				FireShot(s);
				CreateShotA(s2,cx,cy,0);	
				SetShotDataA(s2,0,1,angle,0,-0.01,0,80);
				SetShotDataA(s2,30,0,angle,0,0,0,80);
				SetShotDataA(s2,60,NULL,angle,0,0.01,0.5,80);
				FireShot(s2);
				angle+=6;
			}
		}
	}
	function shot (shotid,shotid2)
	{
		let angle=90;
		let angle2=rand(0,360);
		loop(6)
		{
			CreateShotA(shotid,GetX,GetY,0);
			SetShotDataA(shotid,0,1,angle,0,0,0,80);
			loop(40)
			{
				CreateShotA(shotid2,0,0,0);	
				SetShotDataA(shotid2,0,1,angle2,0,-0.01,0,80);
				SetShotDataA(shotid2,30,0,angle2,0,0,2,80);
				SetShotDataA(shotid2,60,NULL,angle2,0,0.01,0.5,80);
				AddShot(60,shotid,shotid2,0);
				angle2+=9;
			}
			SetShotKillTime(shotid,61);
			FireShot(shotid);
			angle+=60;
		}
	}
	function wait(w) 
	{
		loop(w)
		{
			yield;
		}
	}
}