
script_enemy_main
{
	#include_script".\..\..\EnemyBossSystem.txt";
	#include_script".\Chen_AnimeLib.txt";
	
	tex_enemy=filedir~"Chen_Main.png";
	
	@Initialize
	{
		SetLife(5000);
		SetTimer(50);
		EnemyBossInitialize;
		SetAnimetion(tex_enemy);
	}
	@MainLoop{EnemyBossMainLoopSystem(50,invincible);yield;}
	@DrawLoop{EnemyBossDrawLoop;}
	@Finalize{EnemyBossFinalize;}
	
	
	
	task MainThread_Standard
	{
		yield;
		SetMovePositionHermite(cenX,minY+150,0,0,0,0,100);
		SetAction(ACT_MOVE,100);
		SetRoll(100);
		wait(120);
		let r=1;
		if(rand_int(0,1)){r=-r;}
		loop
		{
			SetAction(ACT_SHOT_A,100);
			let lp=0;
			loop(2)
			{
				let way=21;
				let p=atan2(GetPlayerY-GetY,GetPlayerX-GetX);
				let speed=6;
				let speedB=1;
				let gra=[113,118];
				let delay=10;
				while(speed>=1.2)
				{
					let angle=p;
					while(angle<p+360)
					{
						CreateShotA(1,GetX,GetY,delay);
						SetShotDataA(1,0,0,angle,0,speed/60,speed,gra[lp]);
						let cnt=50;
						local
						{
							let angleB=angle+160*r;
							CreateShotA(2,0,0,0);
							SetShotDataA(2,0,0,angleB,0,speedB/60,speedB,gra[lp]);
							AddShot(cnt,1,2,0);
						}
						FireShot(1);
						angle+=360/way;
					}
					speed/=1.2;
				}
				wait(120);
				lp++;
				r=-r;
			}
			SetMovePositionHermite(cenX+rand(-80,80),minY+rand(140,160),0,0,0,0,100);
			SetAction(ACT_MOVE,100);
			SetRoll(100);
			loop(3)
			{
				let wide=8;
				let way=15;
				let p=rand(0,360);
				let speed=3;
				let angleA=p;
				let gra=136;
				let delay=10;
				while(angleA<p+360)
				{
					let angleB=angleA-wide/2;
					while(angleB<=angleA+wide/2+1)
					{
						CreateShot02(GetX,GetY,0,angleB,speed/60,speed,gra,delay);
						angleB+=2;
					}
					angleA+=360/way;
				}
				wait(50);
			}
		}
	}
	
	task MainThread_Advanced{}
	task MainThread_Unlimited{}
	
}