script_enemy_main
{
	#include_script".\..\..\EnemySystem.txt";
	
	@Initialize
	{
		point=0;
		EnemyInitialize(40);
		MoveThread;
	}
	@MainLoop{EnemyMainLoopSystem(10);yield;}
	@DrawLoop{}
	@Finalize{EnemyFinalize;}
	
	//---------------------------------------------------------------
	//---------------------------------------------------------------
	task MainThread_Standard{}
	
	//---------------------------------------------------------------
	//---------------------------------------------------------------
	task MainThread_Advanced
	{
	}
	
	
	//---------------------------------------------------------------
	//---------------------------------------------------------------
	task MainThread_Unlimited
	{
		State;
		wait(enemyargument*20);
		wait(60);
		loop(3)
		{
			let p=GetAngleToPlayer;
			local
			{
				let speed=[1,2,3,4];
				let angle=p;
				let gra=22;
				let delay=10;
				ascent(a in 0..length(speed))
				{
					CreateShot01(GetX,GetY,speed[a],angle,gra,delay);
				}
			}
			let wt=100;
			SetMovePositionHermite(cenX+rand(-170,170),minY+160+rand(-120,140),0,0,0,0,wt);
			wait(wt);
			local
			{
				let way=5;
				
				let speed=0.8;
				let angle=p;
				let gra=29;
				let delay=0;
				while(angle<p+360)
				{
					CreateShot02(GetX,GetY,0,angle,speed/60,speed,gra,delay);
					angle+=360/way;
				}
			}
			wait(60);
		}
		vanishflg=true;
		local
		{
			let p=GetAngleToPlayer;
			let wide=30;
			
			let speed=1;
			let angle=p-wide/2;
			let gra=70;
			let delay=20;
			while(angle<=p+wide/2+1)
			{
				CreateShot02(GetX,GetY,0,angle,speed/100,speed,gra,delay);
				angle+=2;
			}
		}
		task State
		{
			while(!vanishflg)
			{
				let gra=6;
				let delay=4;
				CreateShotA(1,GetX,GetY,delay);
				SetShotDataA(1,0,0,0,0,0,0,gra);
				SetShotKillTime(1,0);
				FireShot(1);
				yield;
			}
			if(GetLife<lifelimit){AddLife(-lifelimit);}
			else{VanishEnemy;}
		}
	}
	
	
	task MoveThread
	{
		let speedbase=enemyspeed;
		while(enemyspeed>0)
		{
			SetSpeed(enemyspeed);
			enemyspeed-=speedbase/80;
			yield;
		}
	}
}