#東方弾幕風
#Title[時壊「時の破滅」]
#Text[]
#Image[]
#BackGround[]
#PlayLevel[]
#Player[FREE]
#ScriptVersion[2]

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

	let name    = "時壊「時の破滅」";
	let imgtati = "";
	let frame   = 0;

	//初期位置
	let xini    =GetCenterX;
	let yini    =GetClipMinY + 120;

	@Initialize{
	CutIn(YOUMU,name,imgtati,0,0,0,0);

	SetLife(3500);
	SetTimer(69);
	SetScore(500000);
	SetDamageRate(70,0);

	LoadGraphic(imgboss);
	SetTexture(imgboss);
	SetGraphicRect(0,0,127,127);

	Shot();
	yield;
	SetMovePosition03(xini,yini,5,10);
	}

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

	yield;
	}

	@DrawLoop{
	DrawGraphic(GetX,GetY);
	}

	@Finalize{
	DeleteGraphic(imgboss);

	CreateItem(ITEM_1UP,GetX,GetY);
	}

	function StopShot(speed,fast,bullet,count){
	CreateShotA(254,rand(32,416),GetY,0);
	SetShotDataA(254,0,0,90,0,0,0,bullet);
	SetShotDataA(254,150 - count,speed,NULL,0,fast,3,bullet);
	FireShot(254);
	}

	function RShot(atk,angle,speed){
	let angleA = angle;
	loop(atk){ReflectShot( GetX, GetY, 1, angleA , 1, true, true, true, true, BLUE04, 0 );
	angleA++;}
	}

	function AllShot(speed,dir,way,bullet,delay){
	ascent(let i in 0..way){
	CreateShot01(GetX,GetY,speed,dir+(360/way*i),bullet,delay);
	}
	}

	task Shot(){
	loop{
		let count = 0;
		let angle = 0;
		loop(90){yield;}
		loop(10){AllShot(3,angle,12,RED03,0);
			loop(30){yield;}
			angle += 4;}
		loop(60){yield;}
		TimeStop(150,1,1,1);
		loop(120){count++;
			StopShot(rand(0.1,0.4),rand(0.01,0.3),AQUA11,count);
			yield;}
		loop(210){yield;}
		loop(25){RShot(rand(4,12),rand(0,360),2);
			loop(8){yield;}}
		}
	}
}