
script_enemy_main
{
	#include_script".\..\..\EnemyBossSystem.txt";
	#include_script".\Sakuya_AnimeLib.txt";
	
	tex_enemy=filedir~"Sakuya_Main.png";
	
	@Initialize
	{
		SetLife(3500);
		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,60);
			local
			{
				let file=GetCurrentScriptDirectory~"Sakuya_Familier02.txt";
				let speed=3;
				let wide=120;
				ascent(a in 0..2)
				{
					let p=GetAngleToPlayer;
					let angle=p-wide/2;
					while(angle<=p+wide/2+1)
					{
						CreateEnemyFromFile(file,GetX,GetY,speed,angle,a);
						angle+=wide;
					}
					wide+=90;
					wait(30);
				}
			}
			wait(60);
			loop(2)
			{
				let wt=120;
				SetMovePosition02(cenX+rand(-80,80),minY+rand(110,140),wt);
				SetAction(ACT_MOVE,wt);
				let L=12;
				let p=GetAngleToPlayer;
				loop(L)
				{
					let way=10;
					let speed=1;
					let angle=p;
					let gra=175;
					let delay=10;
					while(angle<p+360)
					{
						let v=30;
						let sx=GetX+v*cos(angle);
						let sy=GetY+v*sin(angle);
						CreateShot02(sx,sy,0,angle,speed/60,speed,gra,delay);
						angle+=360/way;
					}
					p+=(360/way)/2;
					wait(wt/L);
				}
				wait(30);
			}
			wait(60);
		}
	}
	
	task MainThread_Advanced{}
	task MainThread_Unlimited{}
	
}