#東方弾幕風
#Title[破符「破壊妖蝶」]
#Text[]
#Image[]
#BackGround[]
#PlayLevel[]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main
{
#include_function ".\フランドール.txt"


	let name    = "破符「破壊妖蝶」";

	//初期位置
	let xini    =GetCenterX;
	let yini    =GetCenterY;

	@Initialize{
	CutIn(YOUMU,name,"",0,0,0,0);
	SetX(GetCenterX);
	SetY(GetClipMinY + 120);
	SetLife(750);
	SetTimer(100);
	SetScore(500000);
	SetDamageRate(20,0);
	SetInvincibility(300);

	LoadGraphic(imgboss);
	SetTexture(imgboss);
	SetGraphicRect(0,0,127,127);
	BreakBatafryShot(200,0,22.5,16,20);
	Shot();
	}

	@MainLoop{
	if(OnBomb() == false){
	SetCollisionA(GetX,GetY,36);
	SetCollisionB(GetX,GetY,24);}

	yield;
	}

	@DrawLoop{
	DrawGraphic(GetX,GetY);
	}

	@Finalize{
	DeleteGraphic(imgboss);
	CreateItem(ITEM_BOMB,GetX,GetY);
	}

	task BreakBatafryShot(wait,minangle,addangle,way,atk){
	let i=minangle;
	loop(60){yield;}
	loop{
	loop(way){let shot1=1;
	CreateShotA(shot1,GetX(),GetY(),30);
	SetShotDataA(shot1,0,1.5,i,0,0,0,RED22);
	let j = 0;
		while(j<= atk){let shot2=2;
		CreateShotA(shot2,0,0,10);
		SetShotDataA(shot2,0,rand(0.1,0.3),rand(0,360),0,rand(0,0.05),3,RED04);
		j++;
		AddShot(45,shot1,shot2,0);}
	SetShotKillTime(shot1,46);
	FireShot(shot1);
	i+=addangle;}
	loop(wait){yield;}
	}
	}


	task Shot(){
	loop(200){yield;}
	let angle = rand(0,360);
	loop{
	loop(50){yield;}
	Allshot(2,angle,20,RED11,0);
	Allshot(2.4,angle,20,RED11,0);
	Allshot(2.8,angle,20,RED11,0);
	Allshot(3.2,angle,20,RED11,0);
	Allshot(3.6,angle,20,RED11,0);
	angle = rand(0,360);
	}
	}

}