#東方弾幕風
#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;
		if(count>=1)
		{
			if(count%60==0)
			{
				let angle=rand(0,360);
				loop(30)
				{
					SetShotDirectionType(SEQUENCE);
					CreateShotA(s,GetX,GetY,0);	
					SetShotDataA(s,0,3,angle,0,0,2,89);
					SetShotDataA(s,30,1,90,0,0,2,89);
					FireShot(s);
					angle+=6;
				}
				loop(30)
				{
					SetShotDirectionType(SEQUENCE);
					CreateShotA(s,GetX,GetY,0);	
					SetShotDataA(s,0,3,angle,0,0,2,94);
					SetShotDataA(s,30,1,-90,0,0,2,94);
					FireShot(s);
					angle+=6;
				}
			}
			SetCollisionA(GetX(),GetY(),24);//当たり判定(自弾)登録
			SetCollisionB(GetX(),GetY(),24);//当たり判定(体当たり)登録
			SetPlayerX(GetPlayerX+rand(-2,2));
			SetPlayerY(GetPlayerY+rand(-2,2));
		}
	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());
	}
}