#東方弾幕風
#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(700);
		SetDamageRate(10,0);
		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 angle=-30;
		let a=3;
		let base =GetAngleToPlayer;
		wait(120);
		loop
		{
			loop(10)
			{
				loop(10)
				{
					shot(1,105+angle,2);
					shot(1,-75+angle,-2);
					shot(0,35+angle,0);
					shot(0,-5+angle,0);
					angle+=a;
					wait(3);
				}
				a*=-1;
			}
			wait(60);
			loop(10)
			{
				loop(36)
				{
					CreateShot01(GetX,GetY,rand(1,4),angle,74,0);
					yield;
					angle+=10;
				}
			}
		}
	}
	function shot(let hand,let angle,let plus)
	{
		let s=0;
		SetShotDirectionType(PLAYER);
		CreateShotA(s,GetX,GetY,0);	
		SetShotDataA(s,0,4,angle,0,0,2,188);
		if(hand==1)
		{
			SetShotDataA(s,60,5,plus,0,0,2,188);
		}
		FireShot(s);
	}
	function wait(w) 
	{
		loop(w)
		{
			yield;
		}
	}
}