
script_enemy_main
{
	#include_script".\..\..\EnemyBossSystem.txt";
	#include_script".\Sakuya_AnimeLib.txt";
	
	tex_enemy=filedir~"Sakuya_Main.png";
	
	@Initialize
	{
		SetLife(3000);
		SetTimer(44);
		EnemyBossInitialize;
		SetAnimetion(tex_enemy);
	}
	@MainLoop{EnemyBossMainLoopSystem(50,invincible);yield;}
	@DrawLoop{EnemyBossDrawLoop;}
	@Finalize{EnemyBossFinalize;}
	
	
	
	task MainThread_Standard
	{
		yield;
		SetMovePositionHermite(cenX,minY+120,0,0,0,0,100);
		SetAction(ACT_MOVE,100);
		wait(120);
		let r=1;
		if(rand_int(0,1)){r=-r;}
		loop
		{
			SetAction(ACT_SHOT_B,180);
			let i=rand(0,360);
			let L=9;
			let sp=0;
			loop(L)
			{
				let way=6;
				let angle=i;
				let gra=169;
				let delay=5;
				while(angle<i+360)
				{
					let v=30;
					let sx=GetX+v*cos(angle);
					let sy=GetY+v*sin(angle);
					let speed=3+sp;
					while(speed>=0.8)
					{
						CreateShot01(sx,sy,speed,angle,gra,delay);
						speed/=1.2;
					}
					angle+=360/way;
				}
				i+=(360/way)/L*r;
				sp+=0.7;
				wait(5);
			}
			wait(40);
			let p=GetAngleToPlayer;
			let L=18;
			loop(L)
			{
				let wide=8;
				let angle=p-wide/2;
				let gra=172;
				let delay=10;
				while(angle<=p+wide/2+1)
				{
					let speed=4;
					while(speed>=1.5)
					{
						CreateShot01(GetX,GetY,speed,angle,gra,delay);
						speed/=1.3;
					}
					angle+=2;
				}
				p+=(360/L)*r;
				wait(2);
			}
			SetMovePositionHermite(cenX+rand(-60,60),minY+rand(110,140),0,0,0,0,100);
			SetAction(ACT_MOVE,100);
			wait(100);
			r=-r;
		}
	}
	
	task MainThread_Advanced{}
	task MainThread_Unlimited{}
	
}