#東方弾幕風
#Title[振符「シェイキングウェーブ」]
#Text[試作]
#ScriptVersion[2]

script_enemy_main
{//Enemy01
	let count=0;
	let p=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);
		SetTimer(90);
	
		SetGraphicRect(1,1,64,64);
		SetInvincibility(300);
		
		LoadGraphic(imgExRumia);	
		LoadGraphic(imgExRumiaBack);

		SetMovePosition02(cx,120,60);
		Concentration01(60);
		CutIn(YOUMU,"振符「シェイキングウェーブ」",0,0,0,0,0);//スペルカード名表示
	}
	@MainLoop
	{
		let s=0;
		let base =0;
		function shot(let shotid,let shotx,let shoty)
		{
			CreateShotA(shotid,shotx,shoty,0);
			SetShotDirectionType(ABSOLUTE);
			SetShotDataA(shotid,0,3,30,6,0,0,94);
			SetShotDirectionType(SEQUENCE);
			SetShotDataA(shotid,20,3,0,-6,0,0,94);
			SetShotDataA(shotid,40,3,0,6,0,0,94);
			SetShotDataA(shotid,60,3,0,-6,0,0,94);
			SetShotDataA(shotid,80,3,0,6,0,0,94);
			SetShotDataA(shotid,100,3,0,-6,0,0,94);
			SetShotDataA(shotid,120,3,0,6,0,0,94);
			SetShotDataA(shotid,140,3,0,-6,0,0,94);
			SetShotDataA(shotid,160,3,0,6,0,0,94);
			SetShotDataA(shotid,180,3,0,-6,0,0,94);
			SetShotDataA(shotid,200,3,0,6,0,0,94);
			FireShot(shotid);
		}
			if(count%180==0)
			{
			p=rand(GetClipMinX-32,GetClipMinX+32);
			}
		if(count>=1)
		{
			if(count%180<=60&&count%180>=0)
			{
				loop(8)
				{
					if(count%6==0)
					{
						shot(s,p+base,GetClipMinY);
					}
				base+=60
				}
			}
			SetCollisionA(GetX(),GetY(),24);//当たり判定(自弾)登録
			SetCollisionB(GetX(),GetY(),24);//当たり判定(体当たり)登録
		}
	count++;

	}
	@Finalize
	{//読みこんだファイルを削除
		loop(8)
		{
			CreateItem(ITEM_SCORE,cx+rand(-100,100),rand(20,100));
		}
	}
	
	@DrawLoop
	{
		//Exルーミア描画
		if(count<270){SetGraphicRect(64,64,127,127)};
		if(count>=270){SetGraphicRect(1,1,64,64);}
		SetAlpha(255);
		SetTexture(imgExRumia);
		DrawGraphic(GetX(),GetY());
	}
}