script_enemy_main
{
	#include_script".\..\..\EnemySystem.txt";
	
	@Initialize
	{
		point=0;
		EnemyInitialize(5);
		MoveThread;
	}
	@MainLoop{EnemyMainLoopSystem(10);yield;}
	@DrawLoop{}
	@Finalize{EnemyFinalize;}
	
	//---------------------------------------------------------------
	//---------------------------------------------------------------
	task MainThread_Standard{}
	
	//---------------------------------------------------------------
	//---------------------------------------------------------------
	task MainThread_Advanced
	{
		State;
		while(!vanishflg){yield;}
		local
		{
			let p=GetAngleToPlayer;
			let wide=240;
			let way=17;
			let speed=[2.4,1.6];
			let gra=[31,15];
			let delay=7;
			let angle=p-wide/2;
			let lp=0;
			while(angle<=p+wide/2+1)
			{
				CreateShot02(GetX,GetY,0,angle,speed[lp%2]/90,speed[lp%2],gra[lp%2],delay);
				angle+=wide/(way-1);
				lp++;
			}
		}
		
		task State
		{
			while(GetX>=minX&&GetX<=maxX&&GetY>=minY&&GetY<=maxY){yield;}
			vanishflg=true;
			yield;
			VanishEnemy;
		}
	}
	
	
	//---------------------------------------------------------------
	//---------------------------------------------------------------
	task MainThread_Unlimited{}
	
	
	task MoveThread
	{
		while(!vanishflg)
		{
			local
			{
				let gra=8;
				let delay=3;
				CreateShotA(1,GetX,GetY,delay);
				SetShotDataA(1,0,0,0,0,0,0,gra);
				SetShotKillTime(1,0);
				FireShot(1);
			}
			SetSpeed(enemyspeed);
			enemyspeed+=0.2;
			yield;
		}
		if(GetLife<lifelimit){AddLife(-lifelimit);}
		else{VanishEnemy;}
	}
}